Module: Vagrant::Command::Helpers
Instance Method Summary collapse
-
#initialize_environment(args, options, config) ⇒ Object
Initializes the environment by pulling the environment out of the configuration hash and sets up the UI if necessary.
-
#target_vms(name = nil) ⇒ Object
This returns an array of VM objects depending on the arguments given to the command.
Instance Method Details
#initialize_environment(args, options, config) ⇒ Object
Initializes the environment by pulling the environment out of the configuration hash and sets up the UI if necessary.
6 7 8 9 |
# File 'lib/vagrant/command/helpers.rb', line 6 def initialize_environment(args, , config) raise Errors::CLIMissingEnvironment if !config[:env] @env = config[:env] end |
#target_vms(name = nil) ⇒ Object
This returns an array of VM objects depending on the arguments given to the command.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/vagrant/command/helpers.rb', line 13 def target_vms(name=nil) raise Errors::NoEnvironmentError if !env.root_path name ||= self.name rescue nil @target_vms ||= begin if env.multivm? return env.vms_ordered if !name vm = env.vms[name.to_sym] raise Errors::VMNotFoundError, :name => name if !vm else raise Errors::MultiVMEnvironmentRequired if name vm = env.vms.values.first end [vm] end end |