Class: VagrantPlugins::CORL::Command::Launcher

Inherits:
Object
  • Object
show all
Includes:
CORL::Parallel
Defined in:
lib/core/vagrant/commands/launcher.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.synopsisObject




11
12
13
# File 'lib/core/vagrant/commands/launcher.rb', line 11

def self.synopsis
  "execute CORL actions within the defined network"
end

Instance Method Details

#envObject


Property accessors / modifiers



18
19
20
# File 'lib/core/vagrant/commands/launcher.rb', line 18

def env
  @env
end

#executeObject


Execution



25
26
27
28
29
# File 'lib/core/vagrant/commands/launcher.rb', line 25

def execute
  # Set the base command so we can access in any actions executed
  ::CORL::Vagrant.command = ::CORL.handle(self)
  ::CORL.executable(ARGV - [ 'corl', '--' ], "[ vagrant ] corl")
end

#vm_machine(name, provider = nil, refresh = false) ⇒ Object


Utilities



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/core/vagrant/commands/launcher.rb', line 34

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