knife-azure 1.8.7 → 1.9.0
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 +4 -4
- data/lib/azure/azure_interface.rb +79 -81
- data/lib/azure/custom_errors.rb +34 -35
- data/lib/azure/helpers.rb +43 -44
- data/lib/azure/resource_management/ARM_deployment_template.rb +679 -678
- data/lib/azure/resource_management/ARM_interface.rb +513 -515
- data/lib/azure/resource_management/vnet_config.rb +43 -43
- data/lib/azure/resource_management/windows_credentials.rb +181 -184
- data/lib/azure/service_management/ASM_interface.rb +309 -317
- data/lib/azure/service_management/ag.rb +16 -16
- data/lib/azure/service_management/certificate.rb +30 -31
- data/lib/azure/service_management/connection.rb +31 -31
- data/lib/azure/service_management/deploy.rb +40 -38
- data/lib/azure/service_management/disk.rb +14 -10
- data/lib/azure/service_management/host.rb +28 -24
- data/lib/azure/service_management/image.rb +23 -22
- data/lib/azure/service_management/loadbalancer.rb +12 -12
- data/lib/azure/service_management/rest.rb +20 -19
- data/lib/azure/service_management/role.rb +274 -273
- data/lib/azure/service_management/storageaccount.rb +29 -25
- data/lib/azure/service_management/utility.rb +6 -7
- data/lib/azure/service_management/vnet.rb +44 -44
- data/lib/chef/knife/azure_ag_create.rb +18 -18
- data/lib/chef/knife/azure_ag_list.rb +3 -3
- data/lib/chef/knife/azure_base.rb +56 -56
- data/lib/chef/knife/azure_image_list.rb +8 -10
- data/lib/chef/knife/azure_internal-lb_create.rb +15 -15
- data/lib/chef/knife/azure_internal-lb_list.rb +3 -3
- data/lib/chef/knife/azure_server_create.rb +49 -50
- data/lib/chef/knife/azure_server_delete.rb +22 -24
- data/lib/chef/knife/azure_server_list.rb +4 -4
- data/lib/chef/knife/azure_server_show.rb +5 -5
- data/lib/chef/knife/azure_vnet_create.rb +17 -17
- data/lib/chef/knife/azure_vnet_list.rb +3 -3
- data/lib/chef/knife/azurerm_base.rb +58 -60
- data/lib/chef/knife/azurerm_server_create.rb +23 -22
- data/lib/chef/knife/azurerm_server_delete.rb +30 -34
- data/lib/chef/knife/azurerm_server_list.rb +42 -42
- data/lib/chef/knife/azurerm_server_show.rb +1 -1
- data/lib/chef/knife/bootstrap/bootstrap_options.rb +7 -8
- data/lib/chef/knife/bootstrap/bootstrapper.rb +65 -65
- data/lib/chef/knife/bootstrap/common_bootstrap_options.rb +3 -4
- data/lib/chef/knife/bootstrap_azure.rb +13 -13
- data/lib/chef/knife/bootstrap_azurerm.rb +106 -106
- data/lib/knife-azure/version.rb +2 -2
- metadata +43 -76
- data/lib/azure/resource_management/ARM_base.rb +0 -29
@@ -1,7 +1,7 @@
|
|
1
1
|
#
|
2
2
|
# Author:: Barry Davis (barryd@jetstreamsoftware.com)
|
3
|
-
# Author:: Adam Jacob (<adam@
|
4
|
-
# Author:: Seth Chisamore (<schisamo@
|
3
|
+
# Author:: Adam Jacob (<adam@chef.io>)
|
4
|
+
# Author:: Seth Chisamore (<schisamo@chef.io>)
|
5
5
|
# Copyright:: Copyright 2009-2018, Chef Software Inc.
|
6
6
|
# License:: Apache License, Version 2.0
|
7
7
|
#
|
@@ -18,11 +18,11 @@
|
|
18
18
|
# limitations under the License.
|
19
19
|
#
|
20
20
|
|
21
|
-
require File.expand_path(
|
21
|
+
require File.expand_path("../azurerm_base", __FILE__)
|
22
22
|
|
23
23
|
# These two are needed for the '--purge' deletion case
|
24
|
-
require
|
25
|
-
require
|
24
|
+
require "chef/node"
|
25
|
+
require "chef/api_client"
|
26
26
|
|
27
27
|
class Chef
|
28
28
|
class Knife
|
@@ -57,51 +57,47 @@ class Chef
|
|
57
57
|
# necessary to make them confirm two more times.
|
58
58
|
|
59
59
|
def destroy_item(klass, name, type_name)
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
ui.warn("Could not find a #{type_name} named #{name} to delete!")
|
66
|
-
end
|
60
|
+
object = klass.load(name)
|
61
|
+
object.destroy
|
62
|
+
ui.warn("Deleted #{type_name} #{name}")
|
63
|
+
rescue Net::HTTPServerException
|
64
|
+
ui.warn("Could not find a #{type_name} named #{name} to delete!")
|
67
65
|
end
|
68
66
|
|
69
67
|
def run
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
@vm_name = @name_args[0]
|
68
|
+
$stdout.sync = true
|
69
|
+
# check azure cli version due to azure changed `azure` to `az` in azure-cli2.0
|
70
|
+
get_azure_cli_version
|
71
|
+
validate_arm_keys!(:azure_resource_group_name)
|
72
|
+
@vm_name = @name_args[0]
|
76
73
|
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
74
|
+
if locate_config_value(:delete_resource_group)
|
75
|
+
delete_resource_group
|
76
|
+
else
|
77
|
+
service.delete_server(locate_config_value(:azure_resource_group_name), @vm_name)
|
78
|
+
end
|
82
79
|
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
end
|
88
|
-
rescue => error
|
89
|
-
service.common_arm_rescue_block(error)
|
80
|
+
if config[:purge]
|
81
|
+
purge_node
|
82
|
+
else
|
83
|
+
ui.warn("Corresponding node and client for the #{@vm_name} server were not deleted and remain registered with the Chef Server")
|
90
84
|
end
|
85
|
+
rescue => error
|
86
|
+
service.common_arm_rescue_block(error)
|
91
87
|
end
|
92
88
|
|
93
89
|
def delete_resource_group
|
94
90
|
resource_group_name = locate_config_value(:azure_resource_group_name)
|
95
91
|
ui.warn "Deleting resource group will delete all the virtual_machines inside it."
|
96
92
|
begin
|
97
|
-
ui.confirm(
|
93
|
+
ui.confirm("Do you really want to delete resource group")
|
98
94
|
rescue SystemExit # Need to handle this as confirming with N/n raises SystemExit exception
|
99
95
|
server = nil # Cleanup is implicitly performed in other cloud plugins
|
100
96
|
ui.warn "Resource group not deleted. Proceeding for server delete ..."
|
101
97
|
service.delete_server(locate_config_value(:azure_resource_group_name), @vm_name)
|
102
98
|
exit
|
103
99
|
end
|
104
|
-
ui.info
|
100
|
+
ui.info "Deleting Resource Group " + resource_group_name + " and Virtual Machine " + @vm_name + " .."
|
105
101
|
service.delete_resource_group(locate_config_value(:azure_resource_group_name))
|
106
102
|
ui.warn "Deleted resource_group_name #{resource_group_name} and #{@vm_name}"
|
107
103
|
end
|
@@ -109,8 +105,8 @@ class Chef
|
|
109
105
|
def purge_node
|
110
106
|
node_to_delete = config[:chef_node_name] || @vm_name
|
111
107
|
if node_to_delete
|
112
|
-
destroy_item(Chef::Node, node_to_delete,
|
113
|
-
destroy_item(Chef::ApiClient, node_to_delete,
|
108
|
+
destroy_item(Chef::Node, node_to_delete, "node")
|
109
|
+
destroy_item(Chef::ApiClient, node_to_delete, "client")
|
114
110
|
else
|
115
111
|
ui.warn("Node name to purge not provided. Corresponding client node will remain on Chef Server.")
|
116
112
|
end
|
@@ -1,42 +1,42 @@
|
|
1
|
-
#
|
2
|
-
# Author:: Adam Jacob (<adam@chef.io>)
|
3
|
-
# Copyright:: Copyright 2009-2018, Chef Software Inc.
|
4
|
-
# License:: Apache License, Version 2.0
|
5
|
-
#
|
6
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
-
# you may not use this file except in compliance with the License.
|
8
|
-
# You may obtain a copy of the License at
|
9
|
-
#
|
10
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
-
#
|
12
|
-
# Unless required by applicable law or agreed to in writing, software
|
13
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
-
# See the License for the specific language governing permissions and
|
16
|
-
# limitations under the License.
|
17
|
-
#
|
18
|
-
|
19
|
-
require File.expand_path(
|
20
|
-
|
21
|
-
class Chef
|
22
|
-
class Knife
|
23
|
-
class AzurermServerList < Knife
|
24
|
-
|
25
|
-
include Knife::AzurermBase
|
26
|
-
|
27
|
-
banner "knife azurerm server list (options)"
|
28
|
-
|
29
|
-
def run
|
30
|
-
$stdout.sync = true
|
31
|
-
# check azure cli version due to azure changed `azure` to `az` in azure-cli2.0
|
32
|
-
get_azure_cli_version
|
33
|
-
validate_arm_keys!
|
34
|
-
begin
|
35
|
-
service.list_servers(locate_config_value(:azure_resource_group_name))
|
36
|
-
rescue => error
|
37
|
-
service.common_arm_rescue_block(error)
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
1
|
+
#
|
2
|
+
# Author:: Adam Jacob (<adam@chef.io>)
|
3
|
+
# Copyright:: Copyright 2009-2018, Chef Software Inc.
|
4
|
+
# License:: Apache License, Version 2.0
|
5
|
+
#
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
+
# you may not use this file except in compliance with the License.
|
8
|
+
# You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
# See the License for the specific language governing permissions and
|
16
|
+
# limitations under the License.
|
17
|
+
#
|
18
|
+
|
19
|
+
require File.expand_path("../azurerm_base", __FILE__)
|
20
|
+
|
21
|
+
class Chef
|
22
|
+
class Knife
|
23
|
+
class AzurermServerList < Knife
|
24
|
+
|
25
|
+
include Knife::AzurermBase
|
26
|
+
|
27
|
+
banner "knife azurerm server list (options)"
|
28
|
+
|
29
|
+
def run
|
30
|
+
$stdout.sync = true
|
31
|
+
# check azure cli version due to azure changed `azure` to `az` in azure-cli2.0
|
32
|
+
get_azure_cli_version
|
33
|
+
validate_arm_keys!
|
34
|
+
begin
|
35
|
+
service.list_servers(locate_config_value(:azure_resource_group_name))
|
36
|
+
rescue => error
|
37
|
+
service.common_arm_rescue_block(error)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
#
|
2
2
|
# Author:: Aliasgar Batterywala (aliasgar.batterywala@clogeny.com)
|
3
3
|
#
|
4
|
-
# Copyright:: Copyright
|
4
|
+
# Copyright:: Copyright 2016-2018 Chef Software, Inc.
|
5
5
|
# License:: Apache License, Version 2.0
|
6
6
|
#
|
7
7
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -23,8 +23,8 @@
|
|
23
23
|
# choice to bootstrap the target system through cloud-api protocol.
|
24
24
|
#
|
25
25
|
|
26
|
-
require
|
27
|
-
require
|
26
|
+
require "chef/knife/winrm_base"
|
27
|
+
require "chef/knife/bootstrap_windows_base"
|
28
28
|
class Chef
|
29
29
|
class Knife
|
30
30
|
class Bootstrap
|
@@ -36,7 +36,7 @@ class Chef
|
|
36
36
|
include Knife::WinrmBase
|
37
37
|
include Knife::BootstrapWindowsBase
|
38
38
|
deps do
|
39
|
-
require
|
39
|
+
require "chef/knife/bootstrap"
|
40
40
|
Chef::Knife::Bootstrap.load_deps
|
41
41
|
end
|
42
42
|
|
@@ -97,10 +97,9 @@ class Chef
|
|
97
97
|
none - Currently prevents the chef-client service from being configured as a service.
|
98
98
|
service - Configures the chef-client to run automatically in the background as a service.
|
99
99
|
task - Configures the chef-client to run automatically in the background as a scheduled task."
|
100
|
-
|
100
|
+
end
|
101
101
|
end
|
102
|
-
|
103
|
-
|
102
|
+
end
|
103
|
+
end
|
104
104
|
end
|
105
105
|
end
|
106
|
-
|
@@ -1,7 +1,7 @@
|
|
1
1
|
#
|
2
2
|
# Author:: Aliasgar Batterywala (aliasgar.batterywala@clogeny.com)
|
3
3
|
#
|
4
|
-
# Copyright:: Copyright
|
4
|
+
# Copyright:: Copyright 2016-2018 Chef Software, Inc.
|
5
5
|
# License:: Apache License, Version 2.0
|
6
6
|
#
|
7
7
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -23,13 +23,13 @@ class Chef
|
|
23
23
|
module Bootstrapper
|
24
24
|
|
25
25
|
def load_winrm_deps
|
26
|
-
require
|
27
|
-
require
|
28
|
-
require
|
26
|
+
require "winrm"
|
27
|
+
require "chef/knife/winrm"
|
28
|
+
require "chef/knife/bootstrap_windows_winrm"
|
29
29
|
end
|
30
30
|
|
31
31
|
def default_bootstrap_template
|
32
|
-
is_image_windows? ?
|
32
|
+
is_image_windows? ? "windows-chef-client-msi" : "chef-full"
|
33
33
|
end
|
34
34
|
|
35
35
|
def tcp_test_ssh(fqdn, sshport)
|
@@ -42,67 +42,67 @@ class Chef
|
|
42
42
|
else
|
43
43
|
false
|
44
44
|
end
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
45
|
+
rescue SocketError
|
46
|
+
sleep 2
|
47
|
+
false
|
48
|
+
rescue Errno::ETIMEDOUT
|
49
|
+
false
|
50
|
+
rescue Errno::EPERM
|
51
|
+
false
|
52
|
+
rescue Errno::ECONNREFUSED
|
53
|
+
sleep 2
|
54
|
+
false
|
55
|
+
rescue Errno::EHOSTUNREACH
|
56
|
+
sleep 2
|
57
|
+
false
|
58
|
+
ensure
|
59
|
+
tcp_socket && tcp_socket.close
|
60
60
|
end
|
61
61
|
|
62
62
|
def tcp_test_winrm(ip_addr, port)
|
63
63
|
hostname = ip_addr
|
64
64
|
socket = TCPSocket.new(hostname, port)
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
65
|
+
true
|
66
|
+
rescue SocketError
|
67
|
+
sleep 2
|
68
|
+
false
|
69
|
+
rescue Errno::ETIMEDOUT
|
70
|
+
false
|
71
|
+
rescue Errno::EPERM
|
72
|
+
false
|
73
|
+
rescue Errno::ECONNREFUSED
|
74
|
+
sleep 2
|
75
|
+
false
|
76
|
+
rescue Errno::EHOSTUNREACH
|
77
|
+
sleep 2
|
78
|
+
false
|
79
|
+
rescue Errno::ENETUNREACH
|
80
|
+
sleep 2
|
81
|
+
false
|
82
82
|
end
|
83
83
|
|
84
84
|
def bootstrap_exec(server)
|
85
85
|
fqdn = server.publicipaddress
|
86
86
|
|
87
87
|
if is_image_windows?
|
88
|
-
if locate_config_value(:bootstrap_protocol) ==
|
88
|
+
if locate_config_value(:bootstrap_protocol) == "ssh"
|
89
89
|
port = server.sshport
|
90
90
|
print "#{ui.color("Waiting for sshd on #{fqdn}:#{port}", :magenta)}"
|
91
91
|
|
92
|
-
print(".") until tcp_test_ssh(fqdn,port)
|
92
|
+
print(".") until tcp_test_ssh(fqdn, port) do
|
93
93
|
sleep @initial_sleep_delay ||= 10
|
94
94
|
puts("done")
|
95
|
-
|
95
|
+
end
|
96
96
|
|
97
|
-
elsif locate_config_value(:bootstrap_protocol) ==
|
97
|
+
elsif locate_config_value(:bootstrap_protocol) == "winrm"
|
98
98
|
port = server.winrmport
|
99
99
|
|
100
100
|
print "#{ui.color("Waiting for winrm on #{fqdn}:#{port}", :magenta)}"
|
101
101
|
|
102
|
-
print(".") until tcp_test_winrm(fqdn,port)
|
102
|
+
print(".") until tcp_test_winrm(fqdn, port) do
|
103
103
|
sleep @initial_sleep_delay ||= 10
|
104
104
|
puts("done")
|
105
|
-
|
105
|
+
end
|
106
106
|
end
|
107
107
|
|
108
108
|
puts("\n")
|
@@ -117,10 +117,10 @@ class Chef
|
|
117
117
|
|
118
118
|
print ui.color("Waiting for sshd on #{fqdn}:#{port}", :magenta)
|
119
119
|
|
120
|
-
print(".") until tcp_test_ssh(fqdn,port)
|
120
|
+
print(".") until tcp_test_ssh(fqdn, port) do
|
121
121
|
sleep @initial_sleep_delay ||= 10
|
122
122
|
puts("done")
|
123
|
-
|
123
|
+
end
|
124
124
|
|
125
125
|
puts("\n")
|
126
126
|
bootstrap_for_node(server, fqdn, port).run
|
@@ -164,16 +164,16 @@ class Chef
|
|
164
164
|
end
|
165
165
|
|
166
166
|
def bootstrap_for_windows_node(server, fqdn, port)
|
167
|
-
if locate_config_value(:bootstrap_protocol) ==
|
167
|
+
if locate_config_value(:bootstrap_protocol) == "winrm"
|
168
168
|
|
169
169
|
load_winrm_deps
|
170
170
|
if not Chef::Platform.windows?
|
171
|
-
require
|
171
|
+
require "gssapi"
|
172
172
|
end
|
173
173
|
|
174
174
|
bootstrap = Chef::Knife::BootstrapWindowsWinrm.new
|
175
175
|
|
176
|
-
bootstrap.config[:winrm_user] = locate_config_value(:winrm_user) ||
|
176
|
+
bootstrap.config[:winrm_user] = locate_config_value(:winrm_user) || "Administrator"
|
177
177
|
bootstrap.config[:winrm_password] = locate_config_value(:winrm_password)
|
178
178
|
bootstrap.config[:winrm_transport] = locate_config_value(:winrm_transport)
|
179
179
|
bootstrap.config[:winrm_authentication_protocol] = locate_config_value(:winrm_authentication_protocol)
|
@@ -181,7 +181,7 @@ class Chef
|
|
181
181
|
bootstrap.config[:auth_timeout] = locate_config_value(:auth_timeout)
|
182
182
|
# Todo: we should skip cert generate in case when winrm_ssl_verify_mode=verify_none
|
183
183
|
bootstrap.config[:winrm_ssl_verify_mode] = locate_config_value(:winrm_ssl_verify_mode)
|
184
|
-
elsif locate_config_value(:bootstrap_protocol) ==
|
184
|
+
elsif locate_config_value(:bootstrap_protocol) == "ssh"
|
185
185
|
bootstrap = Chef::Knife::BootstrapWindowsSsh.new
|
186
186
|
bootstrap.config[:ssh_user] = locate_config_value(:ssh_user)
|
187
187
|
bootstrap.config[:ssh_password] = locate_config_value(:ssh_password)
|
@@ -210,7 +210,7 @@ class Chef
|
|
210
210
|
bootstrap.config[:ssh_port] = port
|
211
211
|
bootstrap.config[:identity_file] = locate_config_value(:identity_file)
|
212
212
|
bootstrap.config[:chef_node_name] = locate_config_value(:chef_node_name) || server.name
|
213
|
-
bootstrap.config[:use_sudo] = true unless locate_config_value(:ssh_user) ==
|
213
|
+
bootstrap.config[:use_sudo] = true unless locate_config_value(:ssh_user) == "root"
|
214
214
|
bootstrap.config[:use_sudo_password] = true if bootstrap.config[:use_sudo]
|
215
215
|
bootstrap.config[:environment] = locate_config_value(:environment)
|
216
216
|
# may be needed for vpc_mode
|
@@ -253,20 +253,20 @@ class Chef
|
|
253
253
|
end
|
254
254
|
|
255
255
|
def default_hint_options
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
256
|
+
%w{
|
257
|
+
vm_name
|
258
|
+
public_fqdn
|
259
|
+
platform
|
260
|
+
}
|
261
261
|
end
|
262
262
|
|
263
263
|
def ohai_hints
|
264
264
|
hint_values = locate_config_value(:ohai_hints)
|
265
265
|
|
266
|
-
if hint_values.casecmp(
|
266
|
+
if hint_values.casecmp("default").zero?
|
267
267
|
hints = default_hint_options
|
268
268
|
else
|
269
|
-
hints = hint_values.split(
|
269
|
+
hints = hint_values.split(",")
|
270
270
|
end
|
271
271
|
|
272
272
|
hints
|
@@ -274,7 +274,7 @@ class Chef
|
|
274
274
|
|
275
275
|
def get_chef_extension_public_params
|
276
276
|
pub_config = Hash.new
|
277
|
-
if
|
277
|
+
if locate_config_value(:azure_extension_client_config)
|
278
278
|
pub_config[:client_rb] = File.read(File.expand_path(locate_config_value(:azure_extension_client_config)))
|
279
279
|
else
|
280
280
|
pub_config[:client_rb] = "chef_server_url \t #{Chef::Config[:chef_server_url].to_json}\nvalidation_client_name\t#{Chef::Config[:validation_client_name].to_json}"
|
@@ -311,8 +311,8 @@ class Chef
|
|
311
311
|
cli_secret_file = nil if cli_secret_file == knife_secret_file
|
312
312
|
cli_secret = nil if cli_secret == knife_secret
|
313
313
|
|
314
|
-
cli_secret_file = Chef::EncryptedDataBagItem.load_secret(cli_secret_file) if cli_secret_file
|
315
|
-
knife_secret_file = Chef::EncryptedDataBagItem.load_secret(knife_secret_file) if knife_secret_file
|
314
|
+
cli_secret_file = Chef::EncryptedDataBagItem.load_secret(cli_secret_file) if !cli_secret_file.nil?
|
315
|
+
knife_secret_file = Chef::EncryptedDataBagItem.load_secret(knife_secret_file) if !knife_secret_file.nil?
|
316
316
|
|
317
317
|
cli_secret_file || cli_secret || knife_secret_file || knife_secret
|
318
318
|
end
|
@@ -321,7 +321,7 @@ class Chef
|
|
321
321
|
client_builder = Chef::Knife::Bootstrap::ClientBuilder.new(
|
322
322
|
chef_config: Chef::Config,
|
323
323
|
knife_config: config,
|
324
|
-
ui: ui
|
324
|
+
ui: ui
|
325
325
|
)
|
326
326
|
client_builder.run
|
327
327
|
client_builder.client_path
|
@@ -334,13 +334,13 @@ class Chef
|
|
334
334
|
if Chef::Config[:validation_key] && File.exist?(File.expand_path(Chef::Config[:validation_key]))
|
335
335
|
pri_config[:validation_key] = File.read(File.expand_path(Chef::Config[:validation_key]))
|
336
336
|
else
|
337
|
-
if Chef::VERSION.split(
|
338
|
-
ui.error(
|
337
|
+
if Chef::VERSION.split(".").first.to_i == 11
|
338
|
+
ui.error("Unable to find validation key. Please verify your configuration file for validation_key config value.")
|
339
339
|
exit 1
|
340
340
|
end
|
341
341
|
if config[:server_count].to_i > 1
|
342
342
|
node_name = config[:chef_node_name]
|
343
|
-
0.upto (config[:server_count].to_i-1) do |count|
|
343
|
+
0.upto (config[:server_count].to_i - 1) do |count|
|
344
344
|
config[:chef_node_name] = node_name + count.to_s
|
345
345
|
key_path = create_node_and_client_pem
|
346
346
|
pri_config[("client_pem" + count.to_s).to_sym] = File.read(key_path)
|
@@ -362,7 +362,7 @@ class Chef
|
|
362
362
|
if File.exist?(File.expand_path(locate_config_value(:cert_path)))
|
363
363
|
pri_config[:chef_server_crt] = File.read(File.expand_path(locate_config_value(:cert_path)))
|
364
364
|
else
|
365
|
-
ui.error(
|
365
|
+
ui.error("Specified SSL certificate does not exist.")
|
366
366
|
exit 1
|
367
367
|
end
|
368
368
|
end
|