Sha256: 270c00edf27d37698ca144e7a19a31171f0a9d9025ab3fc0b1caef1c01059490

Contents?: true

Size: 1.83 KB

Versions: 6

Compression:

Stored size: 1.83 KB

Contents

module VagrantPlugins
module CORL
module Command
class Launcher < ::Vagrant.plugin("2", :command)
  
  include ::CORL::Parallel # Mainly for auto locking of resources
  
  #-----------------------------------------------------------------------------
  
  def self.synopsis
    "execute CORL actions within the defined network"
  end
 
  #-----------------------------------------------------------------------------
  # Property accessors / modifiers
  
  def env
    @env
  end
  
  #-----------------------------------------------------------------------------
  # Execution

  def execute
    # Set the base command so we can access in any actions executed
    ::CORL::Vagrant.command = ::CORL.handle(self)   
    ::CORL.executable(@argv - [ "--" ], "vagrant corl")
  end
  
  #-----------------------------------------------------------------------------
  # Utilities
  
  def vm_machine(name, provider = nil, refresh = false)
    machine = nil
    
    # Mostly derived from Vagrant base command with_target_vms() method 
    provider = provider.to_sym if provider

    env.active_machines.each do |active_name, active_provider|
      if name == active_name
        if provider && provider != active_provider
          raise ::Vagrant::Errors::ActiveMachineWithDifferentProvider,
            :name               => active_name.to_s,
            :active_provider    => active_provider.to_s,
            :requested_provider => provider.to_s
        else
          @logger.info("Active machine found with name #{active_name}. " +
                       "Using provider: #{active_provider}")
          provider = active_provider
          break
        end
      end
    end

    provider ||= env.default_provider
    
    machine = env.machine(name, provider, refresh)
    machine.ui.opts[:color] = :default # TODO: Something better??
    
    machine
  end
end
end
end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
corl-0.4.22 lib/core/vagrant/commands/launcher.rb
corl-0.4.21 lib/core/vagrant/commands/launcher.rb
corl-0.4.20 lib/core/vagrant/commands/launcher.rb
corl-0.4.19 lib/core/vagrant/commands/launcher.rb
corl-0.4.18 lib/core/vagrant/commands/launcher.rb
corl-0.4.17 lib/core/vagrant/commands/launcher.rb