knife-rackspace 0.9.1 → 0.9.2

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## v0.9.2
2
+ * KNIFE-480 Add support for user-data
3
+ * --secret-file support for bootstrap
4
+
1
5
  ## v0.9.1
2
6
  * KNIFE-460 Remove extraneous flavor reloads
3
7
  * KNIFE-459 Add support for config-drive
@@ -17,7 +17,7 @@ Gem::Specification.new do |s|
17
17
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
18
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
19
  s.add_dependency "knife-windows"
20
- s.add_dependency "fog", '~> 1.16'
20
+ s.add_dependency "fog", '>= 1.22'
21
21
  s.add_dependency "chef", ">= 0.10.10"
22
22
  s.require_paths = ["lib"]
23
23
 
@@ -107,7 +107,7 @@ class Chef
107
107
  :description => "The version of Chef to install",
108
108
  :proc => Proc.new { |v| Chef::Config[:knife][:bootstrap_version] = v }
109
109
 
110
- option :distro,
110
+ option :distro,
111
111
  :short => "-d DISTRO",
112
112
  :long => "--distro DISTRO",
113
113
  :description => "Bootstrap a distro using a template; default is 'chef-full'",
@@ -209,12 +209,21 @@ class Chef
209
209
  :proc => Proc.new { |k| Chef::Config[:knife][:rackspace_config_drive] = k },
210
210
  :default => "false"
211
211
 
212
+ option :rackspace_user_data_file,
213
+ :long => "--rackspace_user_data_file USERDATA",
214
+ :description => "User data file will be placed in the openstack/latest/user_data directory on the config drive",
215
+ :proc => Proc.new { |k| Chef::Config[:knife][:rackspace_user_data] = k }
216
+
212
217
  option :ssh_keypair,
213
218
  :long => "--ssh-keypair KEYPAIR_NAME",
214
219
  :description => "Name of existing nova SSH keypair. Public key will be injected into the instance.",
215
220
  :proc => Proc.new { |v| Chef::Config[:knife][:rackspace_ssh_keypair] = v },
216
221
  :default => nil
217
222
 
223
+ option :secret_file,
224
+ :long => "--secret-file SECRET_FILE",
225
+ :description => "A file containing the secret key to use to encrypt data bag item values",
226
+ :proc => Proc.new { |sf| Chef::Config[:knife][:secret_file] = sf }
218
227
 
219
228
  def load_winrm_deps
220
229
  require 'winrm'
@@ -336,6 +345,7 @@ class Chef
336
345
  :flavor_id => locate_config_value(:flavor),
337
346
  :metadata => Chef::Config[:knife][:rackspace_metadata],
338
347
  :disk_config => Chef::Config[:knife][:rackspace_disk_config],
348
+ :user_data => user_data,
339
349
  :config_drive => locate_config_value(:rackspace_config_drive) || false,
340
350
  :personality => files,
341
351
  :keypair => Chef::Config[:knife][:rackspace_ssh_keypair]
@@ -353,6 +363,8 @@ class Chef
353
363
  msg_pair("Flavor", server.flavor.name)
354
364
  msg_pair("Image", server.image.name)
355
365
  msg_pair("Metadata", server.metadata.all)
366
+ msg_pair("ConfigDrive", server.config_drive)
367
+ msg_pair("UserData", Chef::Config[:knife][:rackspace_user_data])
356
368
  msg_pair("RackConnect Wait", rackconnect_wait ? 'yes' : 'no')
357
369
  msg_pair("ServiceLevel Wait", rackspace_servicelevel_wait ? 'yes' : 'no')
358
370
  msg_pair("SSH Key", Chef::Config[:knife][:rackspace_ssh_keypair])
@@ -435,6 +447,20 @@ class Chef
435
447
  msg_pair("Environment", config[:environment] || '_default')
436
448
  msg_pair("Run List", config[:run_list].join(', '))
437
449
  end
450
+
451
+ def user_data
452
+ file = Chef::Config[:knife][:rackspace_user_data]
453
+ return unless file
454
+
455
+ begin
456
+ filename = File.expand_path(file)
457
+ content = File.read(filename)
458
+ rescue Errno::ENOENT => e
459
+ ui.error "Unable to read source file - #{filename}"
460
+ exit 1
461
+ end
462
+ content
463
+ end
438
464
 
439
465
  def bootstrap_for_node(server, bootstrap_ip_address)
440
466
  bootstrap = Chef::Knife::Bootstrap.new
@@ -466,7 +492,7 @@ class Chef
466
492
  bootstrap.config[:encrypted_data_bag_secret] = config[:encrypted_data_bag_secret]
467
493
  bootstrap.config[:encrypted_data_bag_secret_file] = config[:encrypted_data_bag_secret_file]
468
494
  bootstrap.config[:secret] = locate_config_value(:secret)
469
- bootstrap.config[:secret_file] = locate_config_value(:secret_file)
495
+ bootstrap.config[:secret_file] = locate_config_value(:secret_file) || ""
470
496
 
471
497
  Chef::Config[:knife][:hints] ||= {}
472
498
  Chef::Config[:knife][:hints]["rackspace"] ||= {}
@@ -1,6 +1,6 @@
1
1
  module Knife
2
2
  module Rackspace
3
- VERSION = '0.9.1'
3
+ VERSION = '0.9.2'
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-rackspace
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.1
4
+ version: 0.9.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2014-03-06 00:00:00.000000000 Z
14
+ date: 2014-05-10 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: knife-windows
@@ -34,17 +34,17 @@ dependencies:
34
34
  requirement: !ruby/object:Gem::Requirement
35
35
  none: false
36
36
  requirements:
37
- - - ~>
37
+ - - ! '>='
38
38
  - !ruby/object:Gem::Version
39
- version: '1.16'
39
+ version: '1.22'
40
40
  type: :runtime
41
41
  prerelease: false
42
42
  version_requirements: !ruby/object:Gem::Requirement
43
43
  none: false
44
44
  requirements:
45
- - - ~>
45
+ - - ! '>='
46
46
  - !ruby/object:Gem::Version
47
- version: '1.16'
47
+ version: '1.22'
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: chef
50
50
  requirement: !ruby/object:Gem::Requirement