How can I write a chef vendor that extends an existing provider?

Cookbook A provides LWRP, which I would like to expand with LWRP or HWRP in cookbook B, so that I can do something like the following, where it provider_bwill use the existing code / resources in provider_aand accept additional attributes that it could use for your own actions:

provider_a "A" do
    attr_from_a :value
end

provider_b "B" do
    attr_from_a :value
    attr_from_b :value
end

Is this possible, and still possible, if I want to avoid editing cookbook A?

+1
source share
2 answers

, - LWRP, "" - " ". LWRP , Ruby .

HWRP ( Jenkins - , OO ). LWRP , .

+2

, LWRP , , .

EDIT: , , LWRP LWRP ( , LWRP, ). new_resource.param_a.

, - :

action :install do
  provider_a "A" do
    param_a new_resource.param_a
  end

  provider_b "B" do
    param_a new_resource.param_a
    param_b new_resource.param_b
  end
end
+3

All Articles