[chef] how to have parameters values in run history report


Chronological Thread 
  • From: gq < >
  • To:
  • Subject: [chef] how to have parameters values in run history report
  • Date: Wed, 23 Sep 2015 11:24:14 +0800 (CST)

Hello
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 Resource
    class ShadowFile < Chef::Resource
      include Poise
      actions :update_min_age, :update_max_age, :disable_inactive_accounts
      default_action :nothing

      state_attrs :maxage, :minage

      attribute :minage,                                 :kind_of => String, :default => '0'
      attribute :maxage,                                 :kind_of => String, :default => '90'
    end
  end

Thanks!


 



  • [chef] how to have parameters values in run history report, gq, 09/22/2015

Archive powered by MHonArc 2.6.16.

§