Class: Chef::PolicyBuilder::Policyfile::RunListExpansionIsh
- Inherits:
-
Struct
- Object
- Struct
- Chef::PolicyBuilder::Policyfile::RunListExpansionIsh
- Defined in:
- lib/chef/policy_builder/policyfile.rb
Instance Attribute Summary collapse
-
#recipes ⇒ Object
Returns the value of attribute recipes.
-
#roles ⇒ Object
Returns the value of attribute roles.
Instance Method Summary collapse
-
#to_h ⇒ Object
(also: #to_hash)
Implementing the parts of the RunListExpansion interface we need to properly send this through to events.run_list_expanded as it is expecting a RunListExpansion object.
- #to_json(*opts) ⇒ Object
Instance Attribute Details
#recipes ⇒ Object
Returns the value of attribute recipes
43 44 45 |
# File 'lib/chef/policy_builder/policyfile.rb', line 43 def recipes @recipes end |
#roles ⇒ Object
Returns the value of attribute roles
43 44 45 |
# File 'lib/chef/policy_builder/policyfile.rb', line 43 def roles @roles end |
Instance Method Details
#to_h ⇒ Object Also known as: to_hash
Implementing the parts of the RunListExpansion interface we need to properly send this through to events.run_list_expanded as it is expecting a RunListExpansion object.
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/chef/policy_builder/policyfile.rb', line 48 def to_h # It looks like version only gets populated in the expanded_run_list when # using a little used feature of roles to version lock cookbooks, so # version is not reliable in here anyway (places like Automate UI are # not getting version out of here. # # Skipped will always be false as it can only be true when two expanded # roles contain the same recipe. = recipes.map do |r| { type: "recipe", name: r, skipped: false, version: nil } end data_collector_hash = {} data_collector_hash[:id] = "_policy_node" data_collector_hash[:run_list] = data_collector_hash end |
#to_json(*opts) ⇒ Object
67 68 69 |
# File 'lib/chef/policy_builder/policyfile.rb', line 67 def to_json(*opts) to_h.to_json(*opts) end |