chef-metal 0.11.beta.4 → 0.11.beta.5

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: deec69f3616cfbff829b76545fc7c85de4d2f2c9
4
- data.tar.gz: 0e60cbb1b3676930193f72b25c95efe8ca83e437
3
+ metadata.gz: 64ea86f29c6071ee79f33641c14a1f789cfcd332
4
+ data.tar.gz: 26b76360f2199924897ce4e86e68be5fd21dff0e
5
5
  SHA512:
6
- metadata.gz: 5ad2143eda51d06ef8b116bb59b512e77b60db04a46f3e10c122e636a49798cba0f661877c9ec61bcedaebb8f35f22fe1021cf00cc5c9110b007e2b63b688c48
7
- data.tar.gz: 87852ac0f52c21e801cb49bfb82386cd61180ab39fc2047fdfd67aabc3fc8ac8df2dd3ded37bdfecc282919bb057bb6c5ac0409d1198a8aed87de2671a802e62
6
+ metadata.gz: 6fc3b908d5393e2729fee78d50a9edf1f561748c93a4336b871fafa22f17898b50b3248dee66a7350399631c95de2c9431562352d67fc8267d47a68271196501
7
+ data.tar.gz: b6e096f975a6807a2ecb313ba8de45c4611aea368ebf84004ed3ba14257025f75f5ce4b302317a98ac2c7275aa032295d74983e5786cb563bbab8eb502c64b56
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Chef Metal Changelog
2
2
 
3
+ ## 0.11.beta.5 (5/28/2014)
4
+
5
+ - fix issue setting Hosted Chef ACLs on nodes
6
+ - fix single-machine converge crash
7
+
3
8
  ## 0.11.beta.2 (5/27/2014)
4
9
 
5
10
  - Bring in cheffish-0.5.beta.2
@@ -25,6 +25,7 @@ class Chef::Provider::Machine < Chef::Provider::LWRPBase
25
25
  action_allocate
26
26
  machine = current_driver.ready_machine(action_handler, machine_spec, machine_options)
27
27
  machine_spec.save(action_handler)
28
+ machine
28
29
  end
29
30
 
30
31
  action :setup do
@@ -19,9 +19,11 @@ module ChefMetal
19
19
  # - :client_rb_path, :client_pem_path
20
20
  # - :chef_version, :prerelease, :package_cache_path
21
21
  def initialize(convergence_options, config)
22
- super
23
- @convergence_options[:client_rb_path] ||= '/etc/chef/client.rb'
24
- @convergence_options[:client_pem_path] ||= '/etc/chef/client.pem'
22
+ convergence_options = Cheffish::MergedConfig.new(convergence_options, {
23
+ :client_rb_path => '/etc/chef/client.rb',
24
+ :client_pem_path => '/etc/chef/client.pem'
25
+ })
26
+ super(convergence_options, config)
25
27
  @chef_version ||= convergence_options[:chef_version]
26
28
  @prerelease ||= convergence_options[:prerelease]
27
29
  @package_cache_path ||= convergence_options[:package_cache_path] || "#{ENV['HOME']}/.chef/package_cache"
@@ -32,6 +34,9 @@ module ChefMetal
32
34
  @package_cache_lock = Mutex.new
33
35
  end
34
36
 
37
+ attr_reader :client_rb_path
38
+ attr_reader :client_pem_path
39
+
35
40
  def setup_convergence(action_handler, machine)
36
41
  super
37
42
 
@@ -51,8 +56,8 @@ module ChefMetal
51
56
  action_handler.open_stream(machine.node['name']) do |stdout|
52
57
  action_handler.open_stream(machine.node['name']) do |stderr|
53
58
  command_line = "chef-client"
54
- command_line << "-l #{config[:log_level].to_s}" if config[:log_level]
55
- machine.execute(action_handler, "chef-client",
59
+ command_line << " -l #{config[:log_level].to_s}" if config[:log_level]
60
+ machine.execute(action_handler, command_line,
56
61
  :stream_stdout => stdout,
57
62
  :stream_stderr => stderr,
58
63
  :timeout => @chef_client_timeout)
@@ -7,6 +7,7 @@ module ChefMetal
7
7
  @@install_msi_cache = {}
8
8
 
9
9
  def initialize(convergence_options, config)
10
+ super
10
11
  @install_msi_url = convergence_options[:install_msi_url] || 'http://www.opscode.com/chef/install.msi'
11
12
  @install_msi_path = convergence_options[:install_msi_path] || "%TEMP%\\#{File.basename(@install_msi_url)}"
12
13
  @chef_client_timeout = convergence_options.has_key?(:chef_client_timeout) ? convergence_options[:chef_client_timeout] : 120*60 # Default: 2 hours
@@ -16,15 +17,19 @@ module ChefMetal
16
17
  attr_reader :install_msi_path
17
18
 
18
19
  def setup_convergence(action_handler, machine)
19
- system_drive = machine.execute_always('$env:SystemDrive').stdout.strip
20
- convergence_options[:client_rb_path] ||= "#{system_drive}\\chef\\client.rb"
21
- convergence_options[:client_pem_path] ||= "#{system_drive}\\chef\\client.pem"
20
+ if !convergence_options.has_key?(:client_rb_path) || !convergence_options.has_key?(:client_pem_path)
21
+ system_drive = machine.execute_always('$env:SystemDrive').stdout.strip
22
+ @convergence_options = Cheffish::MergedConfig.new(convergence_options, {
23
+ :client_rb_path => "#{system_drive}\\chef\\client.rb",
24
+ :client_pem_path => "#{system_drive}\\chef\\client.pem"
25
+ })
26
+ end
22
27
 
23
28
  super
24
29
 
25
30
  # Install chef-client. TODO check and update version if not latest / not desired
26
31
  if machine.execute_always('chef-client -v').exitstatus != 0
27
- # TODO ssh verification of install.sh before running arbtrary code would be nice?
32
+ # TODO ssh verification of install.msi before running arbtrary code would be nice?
28
33
  # TODO find a way to cache this on the host like with the Unix stuff.
29
34
  # Limiter is we don't know how to efficiently upload large files to
30
35
  # the remote machine with WMI.
@@ -7,11 +7,13 @@ module ChefMetal
7
7
  @@install_sh_cache = {}
8
8
 
9
9
  def initialize(convergence_options, config)
10
- super
10
+ convergence_options = Cheffish::MergedConfig.new(convergence_options, {
11
+ :client_rb_path => '/etc/chef/client.rb',
12
+ :client_pem_path => '/etc/chef/client.pem'
13
+ })
14
+ super(convergence_options, config)
11
15
  @install_sh_url = convergence_options[:install_sh_url] || 'http://www.opscode.com/chef/install.sh'
12
16
  @install_sh_path = convergence_options[:install_sh_path] || '/tmp/chef-install.sh'
13
- @convergence_options[:client_rb_path] ||= '/etc/chef/client.rb'
14
- @convergence_options[:client_pem_path] ||= '/etc/chef/client.pem'
15
17
  @chef_client_timeout = convergence_options.has_key?(:chef_client_timeout) ? convergence_options[:chef_client_timeout] : 120*60 # Default: 2 hours
16
18
  end
17
19
 
@@ -36,7 +38,7 @@ module ChefMetal
36
38
  action_handler.open_stream(machine.node['name']) do |stdout|
37
39
  action_handler.open_stream(machine.node['name']) do |stderr|
38
40
  command_line = "chef-client"
39
- command_line << "-l #{config[:log_level].to_s}" if config[:log_level]
41
+ command_line << " -l #{config[:log_level].to_s}" if config[:log_level]
40
42
  machine.execute(action_handler, command_line,
41
43
  :stream_stdout => stdout,
42
44
  :stream_stderr => stderr,
@@ -149,18 +149,22 @@ module ChefMetal
149
149
 
150
150
  # If using enterprise/hosted chef, fix acls
151
151
  if chef_server[:chef_server_url] =~ /\/+organizations\/.+/
152
- grant_client_node_permissions(chef_server, machine.name, ["read", "update"])
152
+ grant_client_node_permissions(action_handler, chef_server, machine.name, ["read", "update"])
153
153
  end
154
154
  end
155
155
 
156
156
  # Grant the client permissions to the node
157
157
  # This procedure assumes that the client name and node name are the same
158
- def grant_client_node_permissions(chef_server, node_name, perms)
159
- rest = Chef::REST.new(chef_server[:chef_server_url])
160
- node_perms = rest.get("/nodes/#{node_name}/_acl")
158
+ def grant_client_node_permissions(action_handler, chef_server, node_name, perms)
159
+ api = Cheffish.chef_server_api(chef_server)
160
+ node_perms = api.get("/nodes/#{node_name}/_acl")
161
161
  perms.each do |p|
162
- node_perms[p]['actors'] << node_name unless node_perms[p]['actors'].include?(node_name)
163
- rest.put("/nodes/#{node_name}/_acl/#{p}", p => node_perms[p])
162
+ if !node_perms[p]['actors'].include?(node_name)
163
+ action_handler.perform_action "Add #{node_name} to client #{p} ACLs" do
164
+ node_perms[p]['actors'] << node_name
165
+ api.put("/nodes/#{node_name}/_acl/#{p}", p => node_perms[p])
166
+ end
167
+ end
164
168
  end
165
169
  end
166
170
 
@@ -1,3 +1,3 @@
1
1
  module ChefMetal
2
- VERSION = '0.11.beta.4'
2
+ VERSION = '0.11.beta.5'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chef-metal
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.beta.4
4
+ version: 0.11.beta.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Keiser
@@ -86,14 +86,14 @@ dependencies:
86
86
  requirements:
87
87
  - - '='
88
88
  - !ruby/object:Gem::Version
89
- version: 0.5.beta.2
89
+ version: 0.5.beta.3
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - '='
95
95
  - !ruby/object:Gem::Version
96
- version: 0.5.beta.2
96
+ version: 0.5.beta.3
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: chef-metal-fog
99
99
  requirement: !ruby/object:Gem::Requirement