Sha256: b19e1ae27e00da0136d663869a3f2e36aac83228549323bc05a4102e92f73f18

Contents?: true

Size: 1.41 KB

Versions: 14

Compression:

Stored size: 1.41 KB

Contents

module CORL
module Action
class Provision < Plugin::CloudAction
 
  #-----------------------------------------------------------------------------
  # Settings
  
  def configure
    super do
      codes :provision_failure
            
      register :dry_run, :bool, false
    end
  end
  
  #-----------------------------------------------------------------------------
  # Operations
  
  def execute
    super do |node, network|
      info('corl.actions.provision.start')
      
      ensure_node(node) do        
        success = true
        
        if CORL.admin?
          unless node.build_time && File.directory?(network.build_directory)
            success = node.build
          end
        
          if success
            provisioner_info = node.provisioner_info   
        
            node.provisioners.each do |provider, collection|
              provider_info = provisioner_info[provider]
              profiles      = provider_info[:profiles]
          
              collection.each do |name, provisioner|
                if supported_profiles = provisioner.supported_profiles(profiles)
                  profile_success = provisioner.provision(supported_profiles, settings)
                  success         = false unless profile_success
                end
              end
            end
            myself.status = code.provision_failure unless success
          end
        end
      end
    end
  end
end
end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
corl-0.4.29 lib/CORL/action/provision.rb
corl-0.4.28 lib/CORL/action/provision.rb
corl-0.4.27 lib/CORL/action/provision.rb
corl-0.4.26 lib/CORL/action/provision.rb
corl-0.4.25 lib/CORL/action/provision.rb
corl-0.4.24 lib/CORL/action/provision.rb
corl-0.4.23 lib/CORL/action/provision.rb
corl-0.4.22 lib/CORL/action/provision.rb
corl-0.4.21 lib/CORL/action/provision.rb
corl-0.4.20 lib/CORL/action/provision.rb
corl-0.4.19 lib/CORL/action/provision.rb
corl-0.4.18 lib/CORL/action/provision.rb
corl-0.4.17 lib/CORL/action/provision.rb
corl-0.4.16 lib/CORL/action/provision.rb