@@ -36,14 +36,14 @@ def destroy(name=nil)
36
36
end
37
37
38
38
39
- desc "status" , "Show the status of the current Vagrant AWS environment."
40
- def status
39
+ desc "status [NAME] " , "Show the status of the current Vagrant AWS environment."
40
+ def status ( name = nil )
41
41
state = nil
42
- results = target_vms . collect do |vm |
42
+ results = target_vms ( name ) . collect do |vm |
43
43
state = vm . created? ? vm . vm . state . to_s : 'not_created'
44
44
"#{ vm . name . to_s . ljust ( 25 ) } #{ state . gsub ( "_" , " " ) } "
45
45
end
46
- state = target_vms . length == 1 ? state : "listing"
46
+ state = target_vms ( name ) . length == 1 ? state : "listing"
47
47
@env . ui . info ( I18n . t ( "vagrant.commands.status.output" ,
48
48
:states => results . join ( "\n " ) ,
49
49
:message => I18n . t ( "vagrant.plugins.aws.commands.status.#{ state } " ) ) ,
@@ -54,9 +54,9 @@ def status
54
54
desc "ssh [NAME]" , "SSH into the currently running Vagrant AWS environment."
55
55
method_options %w( execute -e ) => :string
56
56
def ssh ( name = nil )
57
- raise Vagrant ::Errors ::MultiVMTargetRequired , :command => "ssh" if target_vms . length > 1
57
+ raise Vagrant ::Errors ::MultiVMTargetRequired , :command => "ssh" if target_vms ( name ) . length > 1
58
58
59
- ssh_vm = target_vms . first
59
+ ssh_vm = target_vms ( name ) . first
60
60
ssh_vm . env . actions . run ( VagrantAWS ::Action ::PopulateSSH )
61
61
62
62
if options [ :execute ]
@@ -113,9 +113,9 @@ def resume(name=nil)
113
113
desc "ssh_config [NAME]" , "outputs .ssh/config valid syntax for connecting to this environment via ssh"
114
114
method_options %w{ host_name -h } => :string
115
115
def ssh_config ( name = nil )
116
- raise Vagrant ::Errors ::MultiVMTargetRequired , :command => "ssh_config" if target_vms . length > 1
116
+ raise Vagrant ::Errors ::MultiVMTargetRequired , :command => "ssh_config" if target_vms ( name ) . length > 1
117
117
118
- ssh_vm = target_vms . first
118
+ ssh_vm = target_vms ( name ) . first
119
119
raise Vagrant ::Errors ::VMNotCreatedError if !ssh_vm . created?
120
120
ssh_vm . env . actions . run ( VagrantAWS ::Action ::PopulateSSH )
121
121
@@ -134,9 +134,9 @@ def ssh_config(name=nil)
134
134
method_option :image_name , :aliases => '-f' , :type => :string , :banner => "name of created image"
135
135
method_option :image_desc , :aliases => '-d' , :type => :string , :banner => "description of created image"
136
136
def box_create ( name = nil )
137
- raise Vagrant ::Errors ::MultiVMTargetRequired , :command => "box_create" if target_vms . length > 1
137
+ raise Vagrant ::Errors ::MultiVMTargetRequired , :command => "box_create" if target_vms ( name ) . length > 1
138
138
139
- ami_vm = target_vms . first
139
+ ami_vm = target_vms ( name ) . first
140
140
ami_vm . env . actions . run ( :aws_create_image , {
141
141
'package.output' => options [ :image_name ] || env . config . package . name ,
142
142
'image.register' => options [ :register ] ,
0 commit comments