Class: ChefTimestamp
- Inherits:
-
Chef::Handler
- Object
- Chef::Handler
- ChefTimestamp
- Defined in:
- lib/chef-handler-timestamp.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Instance Method Summary collapse
-
#initialize(config = {}) ⇒ ChefTimestamp
constructor
A new instance of ChefTimestamp.
- #report ⇒ Object
Constructor Details
#initialize(config = {}) ⇒ ChefTimestamp
Returns a new instance of ChefTimestamp.
29 30 31 |
# File 'lib/chef-handler-timestamp.rb', line 29 def initialize(config = {}) @config = config end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
27 28 29 |
# File 'lib/chef-handler-timestamp.rb', line 27 def config @config end |
Instance Method Details
#report ⇒ Object
33 34 35 36 37 38 39 |
# File 'lib/chef-handler-timestamp.rb', line 33 def report if run_status.success? time = Time.now.to_i Chef::Log.info "Generating new Chef success timestamp with value #{time}" ::File.open("#{Chef::Config[:file_cache_path]}/chef-success-timestamp", 'w') {|f| f.puts time} end end |