I am quite new to chef development. Now I am developing a cookbook to check the /etc/shadow file and correct them if violate with settings. for example to run command “chage -M 90 userid” to change the max age for the user to 90, which is the agreed setting.
In order to help user better understand what happen, I want to keep the original max age setting, as well as the new setting, and view them in the run history report.
I studied the chef document, what I learned is to use “state_attrs” to declare them, and then I checked some sample like the file.rb in chef embedded resource, seems that it is quite straight forward.
But after I added the statement in resources, I still can not see them in run history report…
Help are appreciated to advise me how to achieve the objective! thanks!
BTW, here is what I did in the cookbook:
class ShadowFile < Chef::Resource
actions :update_min_age, :update_max_age, :disable_inactive_accounts
state_attrs :maxage, :minage attribute :minage, :kind_of => String, :default => '0' attribute :maxage, :kind_of => String, :default => '90' end