Class: Topo::Provision::MachineGenerator
- Inherits:
-
ResourceGenerator
- Object
- ResourceGenerator
- Topo::Provision::MachineGenerator
- Defined in:
- lib/topo/provision/generators/machine.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#lazy_attributes ⇒ Object
readonly
Returns the value of attribute lazy_attributes.
-
#machine_options ⇒ Object
readonly
Returns the value of attribute machine_options.
-
#normal_attributes ⇒ Object
readonly
Returns the value of attribute normal_attributes.
Attributes inherited from ResourceGenerator
#name, #resource_attributes, #resource_type, #undeploy_action
Instance Method Summary collapse
-
#initialize(data) ⇒ MachineGenerator
constructor
A new instance of MachineGenerator.
- #stop ⇒ Object
Methods inherited from ResourceGenerator
#default_action, #default_resource_template, #deploy, #do_action, #template, #template_root_dir, #undeploy
Methods included from Topo::ParseGen
#convert_keys_to_sym, #convert_keys_to_sym_deep, #expand_ref, #lazy_attribute_to_s, #topo_refs, #value_from_path
Constructor Details
#initialize(data) ⇒ MachineGenerator
Returns a new instance of MachineGenerator.
31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/topo/provision/generators/machine.rb', line 31 def initialize(data) @resource_type ||= "machine" super @undeploy_action = "destroy" @normal_attributes = data['attributes']||{} @lazy_attributes = data['lazy_attributes']||{} %w[run_list chef_environment tags ].each do |key| @resource_attributes[key] = data[key] if data.key? key end opts = data['provisioning']['machine_options'] @machine_options = convert_keys_to_sym(opts) if opts end |
Instance Attribute Details
#lazy_attributes ⇒ Object (readonly)
Returns the value of attribute lazy_attributes.
29 30 31 |
# File 'lib/topo/provision/generators/machine.rb', line 29 def lazy_attributes @lazy_attributes end |
#machine_options ⇒ Object (readonly)
Returns the value of attribute machine_options.
29 30 31 |
# File 'lib/topo/provision/generators/machine.rb', line 29 def @machine_options end |
#normal_attributes ⇒ Object (readonly)
Returns the value of attribute normal_attributes.
29 30 31 |
# File 'lib/topo/provision/generators/machine.rb', line 29 def normal_attributes @normal_attributes end |
Instance Method Details
#stop ⇒ Object
44 45 46 |
# File 'lib/topo/provision/generators/machine.rb', line 44 def stop() puts(template("stop").result(binding)) end |