knife-vsphere 1.2.6 → 1.2.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8385a5227a8b7ca2a3df24c33ad157042949080a
4
- data.tar.gz: a1389be7c172d6d83cd2212a3c783f0787e3814b
3
+ metadata.gz: d1ace6fae44de22b6372e167868b2e3710019f59
4
+ data.tar.gz: 3073721416e47f816a9da1b73570a8625cb9149b
5
5
  SHA512:
6
- metadata.gz: 5a109cb170ebcd0708e395efcc4258aca961fd1f32454559533501de58a37401c0165da0964a74a79556ed4fcdd40c2563bc913155047cb4c0233e074484529d
7
- data.tar.gz: 9cdb024fe3a930c80eefa15d122c2ab7f696723da86f436544873b0611620b9fd6f41629d78e68454f8983a5635f697e052e334ce897ae635f5d96ef6f70e8cc
6
+ metadata.gz: 18b0c95d0f67588d8f103c27f3ce83be4f9e5ddebb393fb20609bcd2fe016710d5a15265e2ad3eaab3a3ab62fb7b2686b82eb4072107ccda8febf69168c8b3b9
7
+ data.tar.gz: cce7f5a115fd16d2d1476a78b03edc932c46acf58a68641bdabbacc2d7d0cfdb0bacf3cd83215ab97f36e19b358729996d1e58957fdfa05e89ba047a620c187a
@@ -83,35 +83,37 @@ class Chef
83
83
  rval
84
84
  end
85
85
 
86
- def vim_connection
87
- conn_opts = {
86
+ def password
87
+ if !get_config(:vsphere_pass)
88
+ # Password is not in the config file - grab it
89
+ # from the command line
90
+ get_password_from_stdin
91
+ elsif get_config(:vsphere_pass).start_with?('base64:')
92
+ Base64.decode64(get_config(:vsphere_pass)[7..-1]).chomp
93
+ else
94
+ get_config(:vsphere_pass)
95
+ end
96
+ end
97
+
98
+ def conn_opts
99
+ {
88
100
  host: get_config(:vsphere_host),
89
101
  path: get_config(:vsphere_path),
90
102
  port: get_config(:vsphere_port),
91
103
  use_ssl: !get_config(:vsphere_nossl),
92
104
  user: get_config(:vsphere_user),
93
- password: get_config(:vsphere_pass),
105
+ password: password,
94
106
  insecure: get_config(:vsphere_insecure),
95
107
  proxyHost: get_config(:proxy_host),
96
108
  proxyPort: get_config(:proxy_port)
97
109
  }
110
+ end
98
111
 
99
- if !conn_opts[:password]
100
- # Password is not in the config file - grab it
101
- # from the command line
102
- conn_opts[:password] = password
103
- elsif conn_opts[:password].start_with?('base64:')
104
- conn_opts[:password] = Base64.decode64(conn_opts[:password][7..-1]).chomp
105
- end
106
-
107
- # opt :debug, "Log SOAP messages", :short => 'd', :default => (ENV['RBVMOMI_DEBUG'] || false)
108
-
109
- vim = RbVmomi::VIM.connect conn_opts
110
- config[:vim] = vim
111
- vim
112
+ def vim_connection
113
+ config[:vim] = RbVmomi::VIM.connect conn_opts
112
114
  end
113
115
 
114
- def password
116
+ def get_password_from_stdin
115
117
  @password ||= ui.ask('Enter your password: ') { |q| q.echo = false }
116
118
  end
117
119
 
@@ -27,7 +27,7 @@ class Chef::Knife::VsphereVmState < Chef::Knife::BaseVsphereCommand
27
27
  option :state,
28
28
  short: '-s STATE',
29
29
  long: '--state STATE',
30
- description: 'The power state to transition the VM into; one of on|off|suspended'
30
+ description: 'The power state to transition the VM into; one of on|off|suspended|reboot'
31
31
 
32
32
  option :wait_port,
33
33
  short: '-w PORT',
@@ -110,6 +110,9 @@ class Chef::Knife::VsphereVmState < Chef::Knife::BaseVsphereCommand
110
110
  when 'reset'
111
111
  vm.ResetVM_Task.wait_for_completion
112
112
  puts "Reset virtual machine #{vmname}"
113
+ when 'reboot'
114
+ vm.RebootGuest
115
+ puts "Reboot virtual machine #{vmname}"
113
116
  end
114
117
 
115
118
  if get_config(:wait_port)
@@ -60,7 +60,15 @@ class Chef::Knife::VsphereVmVmdkAdd < Chef::Knife::BaseVsphereCommand
60
60
  # create the vm folder on the LUN or subsequent operations will fail.
61
61
  unless vmdk_datastore.exists? vmname
62
62
  dc = datacenter
63
- dc._connection.serviceContent.fileManager.MakeDirectory name: vmdk_dir, datacenter: dc, createParentDirectories: false
63
+ begin
64
+ dc._connection.serviceContent.fileManager.MakeDirectory name: vmdk_dir, datacenter: dc, createParentDirectories: false
65
+ rescue RbVmomi::Fault => e
66
+ ui.warn "Ignoring a fault when trying to create #{vmdk_dir}. This may be related to issue #213."
67
+ if log_verbose?
68
+ puts "Chose #{vmdk_datastore.name} out of #{vmdk_datastores.map(&:name).join(', ')}"
69
+ puts e
70
+ end
71
+ end
64
72
  end
65
73
  end
66
74
 
@@ -1,3 +1,3 @@
1
1
  module KnifeVsphere
2
- VERSION = '1.2.6'
2
+ VERSION = '1.2.7'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: knife-vsphere
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.6
4
+ version: 1.2.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ezra Pagel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-12 00:00:00.000000000 Z
11
+ date: 2016-01-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: filesize
@@ -80,6 +80,34 @@ dependencies:
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: 0.10.0
83
+ - !ruby/object:Gem::Dependency
84
+ name: rspec
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rake
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
83
111
  description: VMware vSphere Support for Chef's Knife Command
84
112
  email: ezra@cpan.org
85
113
  executables: []
@@ -147,8 +175,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
147
175
  version: '0'
148
176
  requirements: []
149
177
  rubyforge_project:
150
- rubygems_version: 2.4.5
178
+ rubygems_version: 2.4.8
151
179
  signing_key:
152
180
  specification_version: 4
153
181
  summary: vSphere Support for Knife
154
182
  test_files: []
183
+ has_rdoc: