knife-zero 1.15.3 → 1.16.0.pre1
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/knife/zero_converge.rb +34 -3
- data/lib/knife-zero/bootstrap_ssh.rb +13 -0
- data/lib/knife-zero/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9dc4464b0ebe5babb1012fec6d849b0fbc3d9b08
|
4
|
+
data.tar.gz: 258b4f0893a60245da187c947184bbe756efc544
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 34d76dffa90a49468451c030034867b8e449c104decb81e607222a3060f95e5de81e3fcccb0381ac3ae536b12c695486077f01879de39b7e756b3fb74538ef53
|
7
|
+
data.tar.gz: 671cc93e8c418609c8bece5b647283cc60f8a449d81ea2fbe5c3fd11de3f17b07ba7962f8a16990c06988e88ad7a71fb47f3ed03402ae9b2c290ea55c9d9e31b
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'chef/knife'
|
2
2
|
require 'chef/knife/zero_base'
|
3
3
|
require 'chef/application/client'
|
4
|
+
require 'chef/config_fetcher'
|
4
5
|
require 'knife-zero/bootstrap_ssh'
|
5
6
|
require 'knife-zero/helper'
|
6
7
|
|
@@ -20,7 +21,9 @@ class Chef
|
|
20
21
|
self.options[:use_sudo_password] = Bootstrap.options[:use_sudo_password]
|
21
22
|
|
22
23
|
## Import Features from chef-client
|
23
|
-
|
24
|
+
self.options[:json_attribs] = Chef::Application::Client.options[:json_attribs]
|
25
|
+
|
26
|
+
### > 12.5.1
|
24
27
|
self.options[:named_run_list] = Chef::Application::Client.options[:named_run_list]
|
25
28
|
|
26
29
|
if ::Knife::Zero::Helper.required_chef_version?('12.8.1')
|
@@ -70,6 +73,9 @@ class Chef
|
|
70
73
|
end
|
71
74
|
|
72
75
|
validate_options!
|
76
|
+
if @config[:json_attribs]
|
77
|
+
@config[:chef_client_json] = fetch_json_from_url
|
78
|
+
end
|
73
79
|
|
74
80
|
@name_args = [@name_args[0], start_chef_client]
|
75
81
|
end
|
@@ -81,6 +87,7 @@ class Chef
|
|
81
87
|
s << ' -l debug' if @config[:verbosity] and @config[:verbosity] >= 2
|
82
88
|
s << " -S http://127.0.0.1:#{::Knife::Zero::Helper.zero_remote_port}"
|
83
89
|
s << " -o #{@config[:override_runlist]}" if @config[:override_runlist]
|
90
|
+
s << ' -j /etc/chef/chef_client_json.json' if @config[:json_attribs]
|
84
91
|
s << " --splay #{@config[:splay]}" if @config[:splay]
|
85
92
|
s << " -n #{@config[:named_run_list]}" if @config[:named_run_list]
|
86
93
|
s << " --skip-cookbook-sync" if @config[:skip_cookbook_sync]
|
@@ -95,6 +102,13 @@ class Chef
|
|
95
102
|
ui.error("--override_runlist and --named_run_list are exclusive")
|
96
103
|
exit 1
|
97
104
|
end
|
105
|
+
if json_attribs_without_override_given?
|
106
|
+
ui.error(
|
107
|
+
'--json-attributes must be used with --override-runlist ' \
|
108
|
+
'to avoid updating local node object.'
|
109
|
+
)
|
110
|
+
exit 1
|
111
|
+
end
|
98
112
|
true
|
99
113
|
end
|
100
114
|
# True if policy_name and run_list are both given
|
@@ -103,13 +117,30 @@ class Chef
|
|
103
117
|
end
|
104
118
|
|
105
119
|
def override_runlist_given?
|
106
|
-
!config[:
|
120
|
+
!config[:override_runlist].nil? && !config[:override_runlist].empty?
|
107
121
|
end
|
108
122
|
|
109
123
|
def named_run_list_given?
|
110
|
-
!config[:
|
124
|
+
!config[:named_run_list].nil? && !config[:named_run_list].empty?
|
125
|
+
end
|
126
|
+
|
127
|
+
def json_attribs_without_override_given?
|
128
|
+
if json_attribs_given?
|
129
|
+
return true unless override_runlist_given?
|
130
|
+
else
|
131
|
+
false
|
132
|
+
end
|
133
|
+
false
|
111
134
|
end
|
112
135
|
|
136
|
+
def json_attribs_given?
|
137
|
+
!config[:json_attribs].nil? && !config[:json_attribs].empty?
|
138
|
+
end
|
139
|
+
|
140
|
+
def fetch_json_from_url
|
141
|
+
config_fetcher = Chef::ConfigFetcher.new(@config[:json_attribs])
|
142
|
+
config_fetcher.fetch_json
|
143
|
+
end
|
113
144
|
end
|
114
145
|
end
|
115
146
|
end
|
@@ -16,6 +16,11 @@ class Chef
|
|
16
16
|
super(%Q{/opt/chef/embedded/bin/ruby -ropen-uri -e 'puts open("https://chef.sh").read' | sudo sh -s -- -v #{config[:client_version]}})
|
17
17
|
end
|
18
18
|
|
19
|
+
if config[:json_attribs]
|
20
|
+
Chef::Log.info "Onetime Attributes: #{config[:chef_client_json]}"
|
21
|
+
super(build_client_json)
|
22
|
+
end
|
23
|
+
|
19
24
|
chef_zero_port = config[:chef_zero_port] ||
|
20
25
|
Chef::Config[:knife][:chef_zero_port] ||
|
21
26
|
URI.parse(Chef::Config.chef_server_url).port
|
@@ -33,6 +38,14 @@ class Chef
|
|
33
38
|
exit 1
|
34
39
|
end
|
35
40
|
end
|
41
|
+
|
42
|
+
def build_client_json
|
43
|
+
<<-EOH
|
44
|
+
sudo sh -c 'cat <<"EOP" > /etc/chef/chef_client_json.json
|
45
|
+
#{config[:chef_client_json].to_json}
|
46
|
+
'
|
47
|
+
EOH
|
48
|
+
end
|
36
49
|
end
|
37
50
|
end
|
38
51
|
end
|
data/lib/knife-zero/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: knife-zero
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.16.0.pre1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- sawanoboly
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-03
|
11
|
+
date: 2016-05-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -187,9 +187,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
187
187
|
version: '0'
|
188
188
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
189
189
|
requirements:
|
190
|
-
- - "
|
190
|
+
- - ">"
|
191
191
|
- !ruby/object:Gem::Version
|
192
|
-
version:
|
192
|
+
version: 1.3.1
|
193
193
|
requirements: []
|
194
194
|
rubyforge_project:
|
195
195
|
rubygems_version: 2.4.8
|