Class: NovaDsl::Provision
- Inherits:
-
Object
- Object
- NovaDsl::Provision
- Defined in:
- lib/nova/commands/nova_provision.rb
Constant Summary
Constants included from NovaStdoutParser
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(name, &script) ⇒ Provision
constructor
A new instance of Provision.
- #provision_manifest ⇒ Object
- #run ⇒ Object
- #to_s ⇒ Object
Methods included from Common::DefaultAttributeResolver
Methods included from NovaConsoleWrapper
#nova_delete, #nova_flavor_list, #nova_image_list, #nova_list, #nova_provision
Methods included from NovaStdoutParser
#parse_nova_list_stdout, #parse_nova_show_stdout
Constructor Details
#initialize(name, &script) ⇒ Provision
Returns a new instance of Provision.
22 23 24 25 26 27 28 29 |
# File 'lib/nova/commands/nova_provision.rb', line 22 def initialize(name, &script) LOGGER.info("New vm provision, name '#{name}'") raise DslMissParameter.new("Missing vm name argument while processing provisioning ") if name.nil? raise DslMissBody.new("Missing body do...end while processing provisioning") unless block_given? @name = name instance_eval &script self end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Common::DefaultAttributeResolver
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
20 21 22 |
# File 'lib/nova/commands/nova_provision.rb', line 20 def name @name end |
Instance Method Details
#provision_manifest ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/nova/commands/nova_provision.rb', line 35 def provision_manifest LOGGER.debug("Checking provision manifest") vars = self.instance_variables raise DslMissParameter.new("Missing missing parameter 'name'") unless vars.include?(:@name) raise DslMissParameter.new("Missing missing parameter 'image'") unless vars.include?(:@image) raise DslMissParameter.new("Missing missing parameter 'flavor'") unless vars.include?(:@flavor) raise DslMissParameter.new("Missing missing parameter 'key_name'") unless vars.include?(:@key) res = {:name => @name, :image => @image, :flavor => @flavor, :key => @key} res.merge!(:source => @profile) unless @profile.nil? LOGGER.debug("Configuring provision configuration: #{res}") res end |
#run ⇒ Object
31 32 33 |
# File 'lib/nova/commands/nova_provision.rb', line 31 def run nova_provision(provision_manifest) end |
#to_s ⇒ Object
49 50 51 |
# File 'lib/nova/commands/nova_provision.rb', line 49 def to_s "Provision new vm: #{name}, flavor: #{@flavor}, image #{@image} " end |