knife-esx 0.2 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,8 +1,8 @@
1
1
  # 0.2 - 2012/02/28
2
2
 
3
- * Added --batch and --async options
3
+ * **Added --batch and --async options**
4
4
 
5
- Inspired by spiceweasel from Matt Ray (https://github.com/mattray/spiceweasel), I've added a batch mode where a YAML file describes the VMs you want to bootstrap.
5
+ Inspired by spiceweasel from Matt Ray (https://github.com/mattray/spiceweasel), I've added a batch mode where a YAML file describes the VMs you want to bootstrap and where (you can deploy to multiple hypervisors).
6
6
 
7
7
  knife esx vm create --batch batch.yml
8
8
 
@@ -43,23 +43,26 @@ If you want to bootstrap the VMs asynchronously, use the --async flag.
43
43
 
44
44
  knife esx vm create --batch batch.yml --async
45
45
 
46
- Standard output and error log is redirected to /tmp/knife_esx_vm_create_VMNAME.log, so if we use the deploy script from above, three log files will be created:
46
+ When using batch mode, standard output and error is redirected to /tmp/knife_esx_vm_create_VMNAME.log, so if we use the deploy script from above, three log files will be created:
47
47
 
48
48
  /tmp/knife_esx_vm_create_test1.log
49
49
  /tmp/knife_esx_vm_create_test2.log
50
50
  /tmp/knife_esx_vm_create_test3.log
51
51
 
52
- * Added --skip-bootstrap flag. If the flag is used the VM will be created but
52
+ * **Added --skip-bootstrap flag**
53
+
54
+ If the flag is used the VM will be created but
53
55
  the bootstrap template/script won't be executed (it also means that Chef won't be installed).
54
56
 
55
- * Fixed bug preventing knife-esx to create a VM when the hypervisor has an empty root password.
57
+ * **Fixed bug preventing knife-esx to create a VM when the hypervisor has an empty root password.**
58
+
59
+ **KNOWN ISSUES**
56
60
 
57
- KNOWN ISSUES
58
61
  * To use --batch without --skip-bootstrap, the ssh user (--ssh-user) needs to be able to sudo without asking for a password (i.e. adding something like 'ubuntu ALL=(ALL) NOPASSWD: ALL' to /etc/sudoers in the appliance template) otherwise the bootstraping process won't work if more than one VM is being deployed.
59
62
 
60
63
  # 0.1.5 - 2012/02/25
61
64
 
62
- * Patch from @pperezrubio adding multiple networks support
65
+ * **Patch from @pperezrubio adding multiple networks and fixed MAC address support**
63
66
 
64
67
  knife esx vm create --vm-disk ubuntu-oneiric.vmdk \
65
68
  --vm-name testvm --datastore datastore1 \
@@ -20,6 +20,7 @@ require 'chef/knife/esx_base'
20
20
  require 'open4'
21
21
  require 'celluloid'
22
22
  require 'singleton'
23
+ require 'yaml'
23
24
 
24
25
  module KnifeESX
25
26
  class DeployScript
@@ -108,18 +109,18 @@ module KnifeESX
108
109
  optstring << " - #{k}:".ljust(25) + "#{v}\n" unless k =~ /password/
109
110
  end
110
111
  log_file = "/tmp/knife_esx_vm_create_#{@name.to_s.strip.chomp.gsub(/\s/,'_')}.log"
111
- CLogger.instance.info! "Bootstrapping VM #{@name} \n#{optstring.join}"
112
- CLogger.instance.info! "VM #{@name} bootstrap log: #{log_file}"
112
+ KnifeESX::CLogger.instance.info! "Bootstrapping VM #{@name} \n#{optstring.join}"
113
+ KnifeESX::CLogger.instance.info! "VM #{@name} bootstrap log: #{log_file}"
113
114
  @status = Open4.popen4("knife esx vm create --vm-name #{@name} #{args} #{extra_args} > #{log_file} 2>&1") do |pid, stdin, stdout, stderr|
114
115
  @out << stdout.read.strip
115
116
  @err << stderr.read.strip
116
117
  end
117
118
  if @status == 0
118
- CLogger.instance.info! "[#{@name}] deployment finished OK"
119
+ KnifeESX::CLogger.instance.info! "[#{@name}] deployment finished OK"
119
120
  else
120
- CLogger.instance.error! "[#{@name}] deployment FAILED"
121
+ KnifeESX::CLogger.instance.error! "[#{@name}] deployment FAILED"
121
122
  @err.each_line do |l|
122
- CLogger.instance.error! "[#{@name}] #{l.chomp}"
123
+ KnifeESX::CLogger.instance.error! "[#{@name}] #{l.chomp}"
123
124
  end
124
125
  end
125
126
  return @status, @out, @err
@@ -280,7 +281,7 @@ class Chef
280
281
  $stdout.sync = true
281
282
 
282
283
  if config[:batch]
283
- CLogger.instance.info "Running in batch mode. Extra arguments will be ignored."
284
+ KnifeESX::CLogger.instance.info "Running in batch mode. Extra arguments will be ignored."
284
285
  if not config[:async]
285
286
  counter = 0
286
287
  script = KnifeESX::DeployScript.new(config[:batch])
@@ -288,17 +289,17 @@ class Chef
288
289
  counter += 1
289
290
  status, stdout, stderr = job.run
290
291
  if status == 0
291
- CLogger.instance.info 'Ok'
292
+ KnifeESX::CLogger.instance.info 'Ok'
292
293
  else
293
- CLogger.instance.error 'Failed'
294
+ KnifeESX::CLogger.instance.error 'Failed'
294
295
  stderr.each_line do |l|
295
296
  ui.error l
296
297
  end
297
298
  end
298
299
  end
299
300
  else
300
- CLogger.instance.info! "Asynchronous boostrapping selected"
301
- CLogger.instance.info! "Now do something productive while I finish my job ;)"
301
+ KnifeESX::CLogger.instance.info! "Asynchronous boostrapping selected"
302
+ KnifeESX::CLogger.instance.info! "Now do something productive while I finish my job ;)"
302
303
  script = KnifeESX::DeployScript.new(config[:batch])
303
304
  futures = []
304
305
  script.each_job do |job|
@@ -1,6 +1,6 @@
1
1
  module Knife
2
2
  module ESX
3
- VERSION = "0.2"
3
+ VERSION = "0.2.1"
4
4
  MAJOR, MINOR, TINY = VERSION.split('.')
5
5
  end
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: knife-esx
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.2'
4
+ version: 0.2.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-02-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: esx
16
- requirement: &12088940 !ruby/object:Gem::Requirement
16
+ requirement: &19203900 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 0.3.2
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *12088940
24
+ version_requirements: *19203900
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: terminal-table
27
- requirement: &12088520 !ruby/object:Gem::Requirement
27
+ requirement: &19203400 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *12088520
35
+ version_requirements: *19203400
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: chef
38
- requirement: &12087940 !ruby/object:Gem::Requirement
38
+ requirement: &19202600 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0.10'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *12087940
46
+ version_requirements: *19202600
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: celluloid
49
- requirement: &12087280 !ruby/object:Gem::Requirement
49
+ requirement: &19201620 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0.9'
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *12087280
57
+ version_requirements: *19201620
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: open4
60
- requirement: &12086840 !ruby/object:Gem::Requirement
60
+ requirement: &19530300 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,7 +65,7 @@ dependencies:
65
65
  version: '0'
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *12086840
68
+ version_requirements: *19530300
69
69
  description: ESX Support for Chef's Knife Command
70
70
  email:
71
71
  - rubiojr@frameos.org
@@ -109,7 +109,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
109
109
  version: '0'
110
110
  requirements: []
111
111
  rubyforge_project:
112
- rubygems_version: 1.8.16
112
+ rubygems_version: 1.8.17
113
113
  signing_key:
114
114
  specification_version: 3
115
115
  summary: ESX Support for Chef's Knife Command