chef-metal 0.11.beta.4 → 0.11.beta.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/lib/chef/provider/machine.rb +1 -0
- data/lib/chef_metal/convergence_strategy/install_cached.rb +10 -5
- data/lib/chef_metal/convergence_strategy/install_msi.rb +9 -4
- data/lib/chef_metal/convergence_strategy/install_sh.rb +6 -4
- data/lib/chef_metal/convergence_strategy/precreate_chef_objects.rb +10 -6
- data/lib/chef_metal/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 64ea86f29c6071ee79f33641c14a1f789cfcd332
|
4
|
+
data.tar.gz: 26b76360f2199924897ce4e86e68be5fd21dff0e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6fc3b908d5393e2729fee78d50a9edf1f561748c93a4336b871fafa22f17898b50b3248dee66a7350399631c95de2c9431562352d67fc8267d47a68271196501
|
7
|
+
data.tar.gz: b6e096f975a6807a2ecb313ba8de45c4611aea368ebf84004ed3ba14257025f75f5ce4b302317a98ac2c7275aa032295d74983e5786cb563bbab8eb502c64b56
|
data/CHANGELOG.md
CHANGED
@@ -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
|
-
|
23
|
-
|
24
|
-
|
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,
|
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
|
-
|
20
|
-
|
21
|
-
|
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.
|
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
|
-
|
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
|
-
|
160
|
-
node_perms =
|
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
|
-
|
163
|
-
|
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
|
|
data/lib/chef_metal/version.rb
CHANGED
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
|
+
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.
|
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.
|
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
|