Class: RunData
- Inherits:
-
Chef::Handler
- Object
- Chef::Handler
- RunData
- Defined in:
- lib/chef-handler-run-data.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #defaults ⇒ Object
-
#initialize(options = defaults) ⇒ RunData
constructor
A new instance of RunData.
- #report ⇒ Object
Constructor Details
#initialize(options = defaults) ⇒ RunData
Returns a new instance of RunData.
29 30 31 |
# File 'lib/chef-handler-run-data.rb', line 29 def initialize( = defaults) @path = [:path] end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
27 28 29 |
# File 'lib/chef-handler-run-data.rb', line 27 def @options end |
Instance Method Details
#defaults ⇒ Object
33 34 35 36 |
# File 'lib/chef-handler-run-data.rb', line 33 def defaults return { :path => Chef::Config[:file_cache_path] } end |
#report ⇒ Object
38 39 40 41 42 43 44 45 |
# File 'lib/chef-handler-run-data.rb', line 38 def report if run_status.success? Chef::Log.info "Writing node information to #{@path}/successful-run-data.json" Chef::FileCache.store('successful-run-data.json', Chef::JSONCompat.to_json_pretty(data), 0640) else Chef::Log.error 'Chef run was not successful! Cancelling successful run data write' end end |