[[chef-dev]] Re: [[chef-dev]] Re: [[chef-dev]] new package resource action :reconfig


Chronological Thread 
  • From: Laurent < >
  • To: Dennis Klein < >
  • Cc:
  • Subject: [[chef-dev]] Re: [[chef-dev]] Re: [[chef-dev]] new package resource action :reconfig
  • Date: Sun, 07 Aug 2011 16:44:39 +0200

Dennis Klein 
< >
 writes:

>>> https://gist.github.com/1129625 ;(this is only a hack, but to get an idea 
>>> about how it could look like)
>
>> Ok.
>> dpkg-reconfigure is idempotent but from what i read the resource will
>> be set updated_by_last_action on every run. (dpkg-reconfigure always
>> returns 0 whether changes have been made or not)
>
>> I'd say option 3 is the only way to go. What extra packages are you
>> thinking of ?
>
> I was thinking of the package debconf-utils which is not installed by 
> default and which comes along with a command debconf-get-selections. But 
> one could also work with debconf-show I guess.

Ok, yes i was thinking of parsing the result of debconf-show.

> I wonder what level of idempotency we need to achiev because when I look at 
> the various file and template resources chef is shipping they basically 
> dont care about the actual state of the live file they write. They just 
> determine the state change depending on the chef-client cache (afaik, pls 
> correct me, if I am wrong here). So, I feel to go along with the common 
> "chef sense" of idempotency even option 1 would be sufficient ?!

I can't really say.

> If we would go with option 3, what do you think about putting the config 
> value retrieval logic into ohai and the comparison logic only into the 
> package providers (Could this work with chef-solo too?!).

Same here, I must admit I had the same question when i started writing
a lrwp. In the end i chose the load_current_resource way. If i could
require ohai plugins in my cookbook or lwrp i might do it with an ohai
plugin. (in that case I guess that would be easier to have the
attributes indexed)

Concerning the response file, at the moment i'm using the logic you
described in point 1, debconf-set-selection and dpkg-reconfigure are
run from an execute resource when a response_file template changes.
(guess i can make a definition out of that)

For point 2, you just have to find a way to detect if dpkg-reconfigure
actually did something to set updated_by_last_action correctly.
in the end i guess you'll have to compare the result of debconf-show
before and after "preseed_package". if it's different then run
dpkg-reconfigure and set updated_by_last_action to true.

-- 
Laurent



Archive powered by MHonArc 2.6.16.

§