Sha256: cfea5396b139e0d97d1c60ad3f01218e1d8d3dfdb7d3898074d5f66fb5a5a9b9

Contents?: true

Size: 1.49 KB

Versions: 11

Compression:

Stored size: 1.49 KB

Contents

module CORL
module Action
class Provision < Plugin::CloudAction
 
  #-----------------------------------------------------------------------------
  # Settings
  
  def configure
    super do
      codes :network_failure,
            :provision_failure
            
      register :dry_run, :bool, false
    end
  end
  
  #-----------------------------------------------------------------------------
  # Operations
  
  def execute
    super do |node, network|
      if network && node
        info('corl.actions.provision.start')
        
        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
      else
        myself.status = code.network_failure  
      end
    end
  end
end
end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
corl-0.4.15 lib/CORL/action/provision.rb
corl-0.4.14 lib/CORL/action/provision.rb
corl-0.4.13 lib/CORL/action/provision.rb
corl-0.4.12 lib/CORL/action/provision.rb
corl-0.4.11 lib/CORL/action/provision.rb
corl-0.4.10 lib/CORL/action/provision.rb
corl-0.4.9 lib/CORL/action/provision.rb
corl-0.4.8 lib/CORL/action/provision.rb
corl-0.4.7 lib/CORL/action/provision.rb
corl-0.4.6 lib/CORL/action/provision.rb
corl-0.4.5 lib/CORL/action/provision.rb