rvc 1.2.1 → 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION +1 -1
- data/lib/rvc/modules/vim.rb +8 -4
- data/lib/rvc/modules/vm.rb +7 -6
- data/lib/rvc/option_parser.rb +1 -1
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.2.
|
1
|
+
1.2.2
|
data/lib/rvc/modules/vim.rb
CHANGED
@@ -36,6 +36,7 @@ opts :connect do
|
|
36
36
|
summary 'Open a connection to ESX/VC'
|
37
37
|
arg :uri, "Host to connect to"
|
38
38
|
opt :insecure, "don't verify ssl certificate", :short => 'k', :default => (ENV['RBVMOMI_INSECURE'] == '1')
|
39
|
+
opt :rev, "Override protocol revision", :type => :string
|
39
40
|
end
|
40
41
|
|
41
42
|
rvc_alias :connect
|
@@ -57,7 +58,7 @@ def connect uri, opts
|
|
57
58
|
:port => 443,
|
58
59
|
:path => '/sdk',
|
59
60
|
:ns => 'urn:vim25',
|
60
|
-
:rev => '4.0',
|
61
|
+
:rev => (opts[:rev]||'4.0'),
|
61
62
|
:ssl => true,
|
62
63
|
:insecure => insecure
|
63
64
|
break
|
@@ -69,9 +70,12 @@ def connect uri, opts
|
|
69
70
|
end
|
70
71
|
end
|
71
72
|
|
72
|
-
|
73
|
-
|
74
|
-
|
73
|
+
unless opts[:rev]
|
74
|
+
# negotiate API version
|
75
|
+
rev = vim.serviceContent.about.apiVersion
|
76
|
+
vim.rev = [rev, '4.1'].min
|
77
|
+
end
|
78
|
+
|
75
79
|
isVC = vim.serviceContent.about.apiType == "VirtualCenter"
|
76
80
|
|
77
81
|
# authenticate
|
data/lib/rvc/modules/vm.rb
CHANGED
@@ -379,7 +379,8 @@ rvc_alias :ssh
|
|
379
379
|
|
380
380
|
def ssh vm, cmd, opts
|
381
381
|
ip = vm_ip vm
|
382
|
-
|
382
|
+
cmd_arg = cmd ? Shellwords.escape(cmd) : ""
|
383
|
+
ssh_cmd = "ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -l #{Shellwords.escape opts[:login]} #{Shellwords.escape ip} #{cmd_arg}"
|
383
384
|
system_fg(ssh_cmd)
|
384
385
|
end
|
385
386
|
|
@@ -397,7 +398,7 @@ def rvc vm
|
|
397
398
|
env = Hash[%w(RBVMOMI_PASSWORD RBVMOMI_HOST RBVMOMI_USER RBVMOMI_SSL RBVMOMI_PORT
|
398
399
|
RBVMOMI_FOLDER RBVMOMI_DATASTORE RBVMOMI_PATH RBVMOMI_DATACENTER
|
399
400
|
RBVMOMI_COMPUTER).map { |k| [k,nil] }]
|
400
|
-
cmd = "rvc #{ip}"
|
401
|
+
cmd = "rvc #{Shellwords.escape ip}"
|
401
402
|
system_fg(cmd, env)
|
402
403
|
end
|
403
404
|
|
@@ -411,7 +412,7 @@ rvc_alias :ping
|
|
411
412
|
|
412
413
|
def ping vm
|
413
414
|
ip = vm_ip vm
|
414
|
-
system_fg "ping #{ip}"
|
415
|
+
system_fg "ping #{Shellwords.escape ip}"
|
415
416
|
end
|
416
417
|
|
417
418
|
|
@@ -567,7 +568,7 @@ end
|
|
567
568
|
opts :clone do
|
568
569
|
summary "Clone a VM"
|
569
570
|
arg :src, nil, :lookup => VIM::VirtualMachine
|
570
|
-
arg :dst, "Path to new VM"
|
571
|
+
arg :dst, "Path to new VM", :lookup_parent => VIM::Folder
|
571
572
|
opt :pool, "Resource pool", :short => 'p', :type => :string, :lookup => VIM::ResourcePool
|
572
573
|
opt :host, "Host", :short => 'h', :type => :string, :lookup => VIM::HostSystem
|
573
574
|
opt :template, "Create a template", :short => 't'
|
@@ -576,7 +577,7 @@ opts :clone do
|
|
576
577
|
end
|
577
578
|
|
578
579
|
def clone src, dst, opts
|
579
|
-
folder =
|
580
|
+
folder, name = *dst
|
580
581
|
diskMoveType = nil
|
581
582
|
|
582
583
|
if opts[:linked]
|
@@ -585,7 +586,7 @@ def clone src, dst, opts
|
|
585
586
|
end
|
586
587
|
|
587
588
|
task = src.CloneVM_Task(:folder => folder,
|
588
|
-
:name =>
|
589
|
+
:name => name,
|
589
590
|
:spec => {
|
590
591
|
:location => {
|
591
592
|
:diskMoveType => diskMoveType,
|
data/lib/rvc/option_parser.rb
CHANGED
@@ -91,7 +91,7 @@ class OptionParser < Trollop::Parser
|
|
91
91
|
if spec[:multi]
|
92
92
|
err "missing argument '#{name}'" if spec[:required] and argv.empty?
|
93
93
|
a = (argv.empty? ? spec[:default] : argv.dup)
|
94
|
-
a = a.map { |x| postprocess_arg x, spec }.inject(:+)
|
94
|
+
a = a.map { |x| postprocess_arg x, spec }.inject([], :+)
|
95
95
|
err "no matches for '#{name}'" if spec[:required] and a.empty?
|
96
96
|
args << a
|
97
97
|
argv.clear
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: rvc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 1.2.
|
5
|
+
version: 1.2.2
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Rich Lane
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-04-
|
13
|
+
date: 2011-04-14 00:00:00 -07:00
|
14
14
|
default_executable: rvc
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|