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

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.synopsisObject




9
10
11
# File 'lib/core/vagrant/commands/launcher.rb', line 9

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

Instance Method Details

#envObject


Property accessors / modifiers



16
17
18
# File 'lib/core/vagrant/commands/launcher.rb', line 16

def env
  @env
end

#executeObject


Execution



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

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



32
33
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
# File 'lib/core/vagrant/commands/launcher.rb', line 32

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