knife-cloud 1.2.3 → 2.0.2
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/chef/knife/cloud/chefbootstrap/bootstrap_options.rb +1 -186
- data/lib/chef/knife/cloud/chefbootstrap/bootstrap_protocol.rb +1 -2
- data/lib/chef/knife/cloud/chefbootstrap/bootstrapper.rb +5 -8
- data/lib/chef/knife/cloud/chefbootstrap/ssh_bootstrap_protocol.rb +8 -9
- data/lib/chef/knife/cloud/chefbootstrap/winrm_bootstrap_protocol.rb +7 -8
- data/lib/chef/knife/cloud/command.rb +0 -37
- data/lib/chef/knife/cloud/command_bootstrap.rb +62 -0
- data/lib/chef/knife/cloud/fog/service.rb +16 -16
- data/lib/chef/knife/cloud/helpers.rb +32 -0
- data/lib/chef/knife/cloud/list_resource_command.rb +2 -1
- data/lib/chef/knife/cloud/list_resource_options.rb +4 -4
- data/lib/chef/knife/cloud/server/create_command.rb +17 -45
- data/lib/chef/knife/cloud/server/create_options.rb +3 -7
- data/lib/chef/knife/cloud/server/options.rb +1 -1
- data/lib/chef/knife/cloud/service.rb +3 -6
- data/lib/knife-cloud/version.rb +1 -1
- data/lib/test/fixtures/knife.rb +1 -1
- data/lib/test/knife-utils/knife_test_utils.rb +1 -1
- data/lib/test/knife-utils/matchers.rb +1 -1
- metadata +9 -10
- data/lib/chef/knife/cloud/chefbootstrap/unix_distribution.rb +0 -31
- data/lib/chef/knife/cloud/chefbootstrap/windows_distribution.rb +0 -32
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3c8e63c32be098a1c7237ffdc07292bf4abb084e3c56fa7e336788a650307976
|
4
|
+
data.tar.gz: 68f6841384ee72b01b5b990ceeac3cf1582a8ebae9f5d63c58f67ffeb5259aa5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 92aa2998725dc7641bf1961aae50c27416188f5b0970c297398aa3e16b9648bd7a6de8a4e111934594e779f4b6ec54cf777bda4e189665f6948e0bdc9a5eedc9
|
7
|
+
data.tar.gz: 5469dc5b52b492416c8c722ece09379df2b7634db7aac0a4b0c43a1a8a5c107e1b72813c5f624b50c28d46d5f0756ee6926f1d13e596172ef31b18bf19ea1d0b
|
@@ -15,7 +15,7 @@
|
|
15
15
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
16
16
|
# See the License for the specific language governing permissions and
|
17
17
|
# limitations under the License.
|
18
|
-
|
18
|
+
|
19
19
|
require "chef/knife/core/bootstrap_context"
|
20
20
|
require "net/ssh/multi"
|
21
21
|
|
@@ -36,191 +36,6 @@ class Chef
|
|
36
36
|
Chef::Knife::Ssh.load_deps
|
37
37
|
end
|
38
38
|
|
39
|
-
include Chef::Knife::WinrmBase
|
40
|
-
|
41
|
-
option :ssh_user,
|
42
|
-
short: "-x USERNAME",
|
43
|
-
long: "--ssh-user USERNAME",
|
44
|
-
description: "The ssh username",
|
45
|
-
default: "root"
|
46
|
-
|
47
|
-
option :ssh_password,
|
48
|
-
short: "-P PASSWORD",
|
49
|
-
long: "--ssh-password PASSWORD",
|
50
|
-
description: "The ssh password"
|
51
|
-
|
52
|
-
option :ssh_port,
|
53
|
-
short: "-p PORT",
|
54
|
-
long: "--ssh-port PORT",
|
55
|
-
description: "The ssh port",
|
56
|
-
proc: Proc.new { |key| Chef::Config[:knife][:ssh_port] = key },
|
57
|
-
default: "22"
|
58
|
-
|
59
|
-
option :ssh_gateway,
|
60
|
-
long: "--ssh-gateway GATEWAY",
|
61
|
-
description: "The ssh gateway server. Any proxies configured in your ssh config are automatically used by default.",
|
62
|
-
proc: Proc.new { |key| Chef::Config[:knife][:ssh_gateway] = key }
|
63
|
-
|
64
|
-
option :ssh_gateway_identity,
|
65
|
-
long: "--ssh-gateway-identity IDENTITY_FILE",
|
66
|
-
description: "The private key for ssh gateway server",
|
67
|
-
proc: Proc.new { |key| Chef::Config[:knife][:ssh_gateway_identity] = key }
|
68
|
-
|
69
|
-
option :forward_agent,
|
70
|
-
long: "--forward-agent",
|
71
|
-
description: "Enable SSH agent forwarding",
|
72
|
-
boolean: true
|
73
|
-
|
74
|
-
option :identity_file,
|
75
|
-
short: "-i IDENTITY_FILE",
|
76
|
-
long: "--identity-file IDENTITY_FILE",
|
77
|
-
description: "The SSH identity file used for authentication"
|
78
|
-
|
79
|
-
option :chef_node_name,
|
80
|
-
short: "-N NAME",
|
81
|
-
long: "--node-name NAME",
|
82
|
-
description: "The Chef node name for your new node"
|
83
|
-
|
84
|
-
option :prerelease,
|
85
|
-
long: "--prerelease",
|
86
|
-
description: "Install the pre-release chef gems"
|
87
|
-
|
88
|
-
option :bootstrap_version,
|
89
|
-
long: "--bootstrap-version VERSION",
|
90
|
-
description: "The version of Chef to install",
|
91
|
-
proc: lambda { |v| Chef::Config[:knife][:bootstrap_version] = v }
|
92
|
-
|
93
|
-
option :bootstrap_proxy,
|
94
|
-
long: "--bootstrap-proxy PROXY_URL",
|
95
|
-
description: "The proxy server for the node being bootstrapped",
|
96
|
-
proc: Proc.new { |p| Chef::Config[:knife][:bootstrap_proxy] = p }
|
97
|
-
|
98
|
-
option :bootstrap_no_proxy,
|
99
|
-
long: "--bootstrap-no-proxy [NO_PROXY_URL|NO_PROXY_IP]",
|
100
|
-
description: "Do not proxy locations for the node being bootstrapped; this option is used internally by Chef",
|
101
|
-
proc: Proc.new { |np| Chef::Config[:knife][:bootstrap_no_proxy] = np }
|
102
|
-
|
103
|
-
option :bootstrap_template,
|
104
|
-
short: "-t TEMPLATE",
|
105
|
-
long: "--bootstrap-template TEMPLATE",
|
106
|
-
description: "Bootstrap Chef using a built-in or custom template. Set to the full path of an erb template or use one of the built-in templates."
|
107
|
-
|
108
|
-
option :use_sudo,
|
109
|
-
long: "--sudo",
|
110
|
-
description: "Execute the bootstrap via sudo",
|
111
|
-
boolean: true
|
112
|
-
|
113
|
-
option :use_sudo_password,
|
114
|
-
long: "--use-sudo-password",
|
115
|
-
description: "Execute the bootstrap via sudo with password",
|
116
|
-
boolean: false
|
117
|
-
|
118
|
-
option :run_list,
|
119
|
-
short: "-r RUN_LIST",
|
120
|
-
long: "--run-list RUN_LIST",
|
121
|
-
description: "Comma separated list of roles/recipes to apply",
|
122
|
-
proc: lambda { |o| o.split(/[\s,]+/) },
|
123
|
-
default: []
|
124
|
-
|
125
|
-
option :first_boot_attributes,
|
126
|
-
short: "-j JSON_ATTRIBS",
|
127
|
-
long: "--json-attributes",
|
128
|
-
description: "A JSON string to be added to the first run of chef-client",
|
129
|
-
proc: lambda { |o| JSON.parse(o) },
|
130
|
-
default: {}
|
131
|
-
|
132
|
-
option :host_key_verify,
|
133
|
-
long: "--[no-]host-key-verify",
|
134
|
-
description: "Verify host key, enabled by default.",
|
135
|
-
boolean: true,
|
136
|
-
default: true
|
137
|
-
|
138
|
-
option :hint,
|
139
|
-
long: "--hint HINT_NAME[=HINT_FILE]",
|
140
|
-
description: "Specify Ohai Hint to be set on the bootstrap target. Use multiple --hint options to specify multiple hints.",
|
141
|
-
proc: Proc.new { |h|
|
142
|
-
Chef::Config[:knife][:hints] ||= Hash.new
|
143
|
-
name, path = h.split("=")
|
144
|
-
Chef::Config[:knife][:hints][name] = path ? JSON.parse(::File.read(path)) : Hash.new }
|
145
|
-
|
146
|
-
option :secret,
|
147
|
-
short: "-s SECRET",
|
148
|
-
long: "--secret ",
|
149
|
-
description: "The secret key to use to encrypt data bag item values"
|
150
|
-
|
151
|
-
option :secret_file,
|
152
|
-
long: "--secret-file SECRET_FILE",
|
153
|
-
description: "A file containing the secret key to use to encrypt data bag item values"
|
154
|
-
|
155
|
-
option :bootstrap_url,
|
156
|
-
long: "--bootstrap-url URL",
|
157
|
-
description: "URL to a custom installation script",
|
158
|
-
proc: Proc.new { |u| Chef::Config[:knife][:bootstrap_url] = u }
|
159
|
-
|
160
|
-
option :bootstrap_curl_options,
|
161
|
-
long: "--bootstrap-curl-options OPTIONS",
|
162
|
-
description: "Add options to curl when install chef-client",
|
163
|
-
proc: Proc.new { |co| Chef::Config[:knife][:bootstrap_curl_options] = co }
|
164
|
-
|
165
|
-
option :auth_timeout,
|
166
|
-
long: "--auth-timeout MINUTES",
|
167
|
-
description: "The maximum time in minutes to wait to for authentication over the transport to the node to succeed. The default value is 25 minutes.",
|
168
|
-
default: 25
|
169
|
-
|
170
|
-
option :node_ssl_verify_mode,
|
171
|
-
long: "--node-ssl-verify-mode [peer|none]",
|
172
|
-
description: "Whether or not to verify the SSL cert for all HTTPS requests.",
|
173
|
-
proc: Proc.new { |v|
|
174
|
-
valid_values = %w{none peer}
|
175
|
-
unless valid_values.include?(v)
|
176
|
-
raise "Invalid value '#{v}' for --node-ssl-verify-mode. Valid values are: #{valid_values.join(", ")}"
|
177
|
-
end
|
178
|
-
}
|
179
|
-
|
180
|
-
option :node_verify_api_cert,
|
181
|
-
long: "--[no-]node-verify-api-cert",
|
182
|
-
description: "Verify the SSL cert for HTTPS requests to the Chef server API.",
|
183
|
-
boolean: true
|
184
|
-
|
185
|
-
option :bootstrap_install_command,
|
186
|
-
long: "--bootstrap-install-command COMMANDS",
|
187
|
-
description: "Custom command to install chef-client",
|
188
|
-
proc: Proc.new { |ic| Chef::Config[:knife][:bootstrap_install_command] = ic }
|
189
|
-
|
190
|
-
option :bootstrap_wget_options,
|
191
|
-
long: "--bootstrap-wget-options OPTIONS",
|
192
|
-
description: "Add options to wget when installing chef-client",
|
193
|
-
proc: Proc.new { |wo| Chef::Config[:knife][:bootstrap_wget_options] = wo }
|
194
|
-
|
195
|
-
option :bootstrap_vault_file,
|
196
|
-
long: "--bootstrap-vault-file VAULT_FILE",
|
197
|
-
description: "A JSON file with a list of vault(s) and item(s) to be updated"
|
198
|
-
|
199
|
-
option :bootstrap_vault_json,
|
200
|
-
long: "--bootstrap-vault-json VAULT_JSON",
|
201
|
-
description: "A JSON string with the vault(s) and item(s) to be updated"
|
202
|
-
|
203
|
-
option :bootstrap_vault_item,
|
204
|
-
long: "--bootstrap-vault-item VAULT_ITEM",
|
205
|
-
description: 'A single vault and item to update as "vault:item"',
|
206
|
-
proc: Proc.new { |i|
|
207
|
-
(vault, item) = i.split(/:/)
|
208
|
-
Chef::Config[:knife][:bootstrap_vault_item] ||= {}
|
209
|
-
Chef::Config[:knife][:bootstrap_vault_item][vault] ||= []
|
210
|
-
Chef::Config[:knife][:bootstrap_vault_item][vault].push(item)
|
211
|
-
Chef::Config[:knife][:bootstrap_vault_item]
|
212
|
-
}
|
213
|
-
option :msi_url,
|
214
|
-
short: "-u URL",
|
215
|
-
long: "--msi-url URL",
|
216
|
-
description: "Location of the Chef Client MSI. The default templates will prefer to download from this location. The MSI will be downloaded from chef.io if not provided.",
|
217
|
-
default: ""
|
218
|
-
|
219
|
-
option :install_as_service,
|
220
|
-
long: "--install-as-service",
|
221
|
-
description: "Install chef-client as service in windows machine",
|
222
|
-
default: false
|
223
|
-
|
224
39
|
end
|
225
40
|
end
|
226
41
|
end # module ends
|
@@ -51,7 +51,6 @@ class Chef
|
|
51
51
|
bootstrap.config[:run_list] = locate_config_value(:run_list)
|
52
52
|
bootstrap.config[:prerelease] = locate_config_value(:prerelease)
|
53
53
|
bootstrap.config[:bootstrap_version] = locate_config_value(:bootstrap_version)
|
54
|
-
bootstrap.config[:distro] = locate_config_value(:distro)
|
55
54
|
bootstrap.config[:bootstrap_proxy] = locate_config_value(:bootstrap_proxy)
|
56
55
|
bootstrap.config[:environment] = locate_config_value(:environment)
|
57
56
|
# see chef/knife/bootstrap.rb #warn_chef_config_secret_key.
|
@@ -60,7 +59,6 @@ class Chef
|
|
60
59
|
bootstrap.config[:first_boot_attributes] = locate_config_value(:first_boot_attributes)
|
61
60
|
bootstrap.config[:secret] = locate_config_value(:secret)
|
62
61
|
bootstrap.config[:secret_file] = locate_config_value(:secret_file)
|
63
|
-
bootstrap.config[:template_file] = locate_config_value(:template_file)
|
64
62
|
bootstrap.config[:bootstrap_template] = locate_config_value(:bootstrap_template)
|
65
63
|
bootstrap.config[:node_ssl_verify_mode] = locate_config_value(:node_ssl_verify_mode)
|
66
64
|
bootstrap.config[:node_verify_api_cert] = locate_config_value(:node_verify_api_cert)
|
@@ -76,6 +74,7 @@ class Chef
|
|
76
74
|
bootstrap.config[:msi_url] = locate_config_value(:msi_url)
|
77
75
|
bootstrap.config[:install_as_service] = locate_config_value(:install_as_service)
|
78
76
|
bootstrap.config[:session_timeout] = locate_config_value(:session_timeout)
|
77
|
+
bootstrap.config[:channel] = locate_config_value(:channel)
|
79
78
|
end
|
80
79
|
|
81
80
|
end
|
@@ -20,8 +20,7 @@
|
|
20
20
|
require "chef/knife/core/ui"
|
21
21
|
require "chef/knife/cloud/chefbootstrap/ssh_bootstrap_protocol"
|
22
22
|
require "chef/knife/cloud/chefbootstrap/winrm_bootstrap_protocol"
|
23
|
-
require "chef/knife/cloud/chefbootstrap/
|
24
|
-
require "chef/knife/cloud/chefbootstrap/unix_distribution"
|
23
|
+
require "chef/knife/cloud/chefbootstrap/bootstrap_distribution"
|
25
24
|
require "chef/knife/cloud/exceptions"
|
26
25
|
|
27
26
|
class Chef
|
@@ -47,9 +46,9 @@ class Chef
|
|
47
46
|
end
|
48
47
|
|
49
48
|
def create_bootstrap_protocol
|
50
|
-
if @config[:
|
49
|
+
if @config[:connection_protocol].nil? || @config[:connection_protocol] == "ssh"
|
51
50
|
SshBootstrapProtocol.new(@config)
|
52
|
-
elsif @config[:
|
51
|
+
elsif @config[:connection_protocol] == "winrm"
|
53
52
|
WinrmBootstrapProtocol.new(@config)
|
54
53
|
else
|
55
54
|
# raise an exception, invalid bootstrap protocol.
|
@@ -60,10 +59,8 @@ class Chef
|
|
60
59
|
end
|
61
60
|
|
62
61
|
def create_bootstrap_distribution
|
63
|
-
if @config[:image_os_type] == "windows"
|
64
|
-
Chef::Knife::Cloud::
|
65
|
-
elsif @config[:image_os_type] == "linux"
|
66
|
-
Chef::Knife::Cloud::UnixDistribution.new(@config)
|
62
|
+
if @config[:image_os_type] == "windows" || @config[:image_os_type] == "linux"
|
63
|
+
Chef::Knife::Cloud::BootstrapDistribution.new(@config)
|
67
64
|
else
|
68
65
|
# raise an exception, invalid bootstrap distribution.
|
69
66
|
error_message = "Invalid bootstrap distribution. image_os_type should be either windows or linux."
|
@@ -27,18 +27,17 @@ class Chef
|
|
27
27
|
class SshBootstrapProtocol < BootstrapProtocol
|
28
28
|
|
29
29
|
def initialize(config)
|
30
|
-
@bootstrap =
|
30
|
+
@bootstrap = Chef::Knife::Bootstrap.new
|
31
31
|
super
|
32
32
|
end
|
33
33
|
|
34
34
|
def init_bootstrap_options
|
35
|
-
bootstrap.config[:
|
36
|
-
bootstrap.config[:
|
37
|
-
bootstrap.config[:
|
38
|
-
bootstrap.config[:
|
39
|
-
bootstrap.config[:
|
40
|
-
bootstrap.config[:use_sudo] = true unless @config[:
|
41
|
-
bootstrap.config[:template_file] = @config[:template_file]
|
35
|
+
bootstrap.config[:connection_user] = @config[:connection_user]
|
36
|
+
bootstrap.config[:connection_password] = @config[:connection_password]
|
37
|
+
bootstrap.config[:connection_port] = locate_config_value(:connection_port)
|
38
|
+
bootstrap.config[:ssh_identity_file] = @config[:ssh_identity_file]
|
39
|
+
bootstrap.config[:ssh_verify_host_key] = @config[:ssh_verify_host_key]
|
40
|
+
bootstrap.config[:use_sudo] = true unless @config[:connection_user] == "root"
|
42
41
|
bootstrap.config[:ssh_gateway] = locate_config_value(:ssh_gateway)
|
43
42
|
bootstrap.config[:forward_agent] = locate_config_value(:forward_agent)
|
44
43
|
bootstrap.config[:use_sudo_password] = locate_config_value(:use_sudo_password)
|
@@ -58,7 +57,7 @@ class Chef
|
|
58
57
|
puts("done")
|
59
58
|
end
|
60
59
|
else
|
61
|
-
print(".") until tcp_test_ssh(@config[:bootstrap_ip_address], locate_config_value(:ssh_port)
|
60
|
+
print(".") until tcp_test_ssh(@config[:bootstrap_ip_address], locate_config_value(:connection_port) || Chef::Config[:knife][:ssh_port] ) do
|
62
61
|
@initial_sleep_delay = !!locate_config_value(:subnet_id) ? 40 : 10
|
63
62
|
sleep @initial_sleep_delay
|
64
63
|
puts("done")
|
@@ -26,30 +26,29 @@ class Chef
|
|
26
26
|
|
27
27
|
def initialize(config)
|
28
28
|
load_winrm_deps
|
29
|
-
@bootstrap = Chef::Knife::
|
29
|
+
@bootstrap = Chef::Knife::Bootstrap.new
|
30
30
|
super
|
31
31
|
end
|
32
32
|
|
33
33
|
def load_winrm_deps
|
34
34
|
require "winrm"
|
35
|
-
require "chef/knife/bootstrap_windows_winrm"
|
36
35
|
require "chef/knife/core/windows_bootstrap_context"
|
37
|
-
require "chef/knife/winrm"
|
38
36
|
end
|
39
37
|
|
40
38
|
def init_bootstrap_options
|
41
|
-
bootstrap.config[:
|
42
|
-
bootstrap.config[:
|
43
|
-
bootstrap.config[:
|
44
|
-
bootstrap.config[:
|
39
|
+
bootstrap.config[:connection_user] = @config[:connection_user] || "Administrator"
|
40
|
+
bootstrap.config[:connection_password] = @config[:connection_password]
|
41
|
+
bootstrap.config[:winrm_ssl] = @config[:winrm_ssl]
|
42
|
+
bootstrap.config[:connection_port] = @config[:connection_port]
|
45
43
|
bootstrap.config[:auth_timeout] = @config[:auth_timeout]
|
46
44
|
bootstrap.config[:winrm_ssl_verify_mode] = @config[:winrm_ssl_verify_mode]
|
45
|
+
bootstrap.config[:connection_protocol] = @config[:connection_protocol]
|
47
46
|
super
|
48
47
|
end
|
49
48
|
|
50
49
|
def wait_for_server_ready
|
51
50
|
print "\n#{ui.color("Waiting for winrm to host (#{@config[:bootstrap_ip_address]})", :magenta)}"
|
52
|
-
print(".") until tcp_test_winrm(@config[:bootstrap_ip_address], @config[:
|
51
|
+
print(".") until tcp_test_winrm(@config[:bootstrap_ip_address], @config[:connection_port]) do
|
53
52
|
sleep @initial_sleep_delay ||= 10
|
54
53
|
puts("done")
|
55
54
|
end
|
@@ -55,43 +55,6 @@ class Chef
|
|
55
55
|
Chef::Log.debug(e.message)
|
56
56
|
exit 1
|
57
57
|
end
|
58
|
-
|
59
|
-
def create_service_instance
|
60
|
-
raise Chef::Exceptions::Override, "You must override create_service_instance in #{self} to create cloud specific service"
|
61
|
-
end
|
62
|
-
|
63
|
-
def execute_command
|
64
|
-
raise Chef::Exceptions::Override, "You must override execute_command in #{self}"
|
65
|
-
end
|
66
|
-
|
67
|
-
# Derived classes can override before_exec_command and after_exec_command
|
68
|
-
def before_exec_command
|
69
|
-
end
|
70
|
-
|
71
|
-
def after_exec_command
|
72
|
-
end
|
73
|
-
|
74
|
-
def set_default_config
|
75
|
-
end
|
76
|
-
|
77
|
-
def validate!(*keys)
|
78
|
-
# validates necessary options/params to carry out the command.
|
79
|
-
# subclasses to implement this.
|
80
|
-
errors = []
|
81
|
-
keys.each do |k|
|
82
|
-
errors << "You did not provide a valid '#{pretty_key(k)}' value." if locate_config_value(k).nil?
|
83
|
-
end
|
84
|
-
error_message = ""
|
85
|
-
raise CloudExceptions::ValidationError, error_message if errors.each { |e| ui.error(e); error_message = "#{error_message} #{e}." }.any?
|
86
|
-
end
|
87
|
-
|
88
|
-
def validate_params!
|
89
|
-
end
|
90
|
-
|
91
|
-
def pretty_key(key)
|
92
|
-
key.to_s.tr("_", " ").gsub(/\w+/) { |w| (w =~ /(ssh)|(aws)/i) ? w.upcase : w.capitalize }
|
93
|
-
end
|
94
|
-
|
95
58
|
end # class Command
|
96
59
|
end
|
97
60
|
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
#
|
2
|
+
# Author:: Ashwini Nehate (<ashwini.nehate@msystechnologies.com>)
|
3
|
+
# Copyright:: Copyright (c) 2013-2016 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 "chef/knife/bootstrap"
|
20
|
+
require "chef/knife/cloud/helpers"
|
21
|
+
require "chef/knife/cloud/exceptions"
|
22
|
+
|
23
|
+
class Chef
|
24
|
+
class Knife
|
25
|
+
|
26
|
+
class Cloud
|
27
|
+
class BootstrapCommand < Chef::Knife::Bootstrap
|
28
|
+
include Cloud::Helpers
|
29
|
+
attr_accessor :service, :custom_arguments
|
30
|
+
|
31
|
+
def run
|
32
|
+
# Set dafult config
|
33
|
+
set_default_config
|
34
|
+
|
35
|
+
# validate compulsory params
|
36
|
+
validate!
|
37
|
+
|
38
|
+
# validate command pre-requisites (cli options)
|
39
|
+
validate_params!
|
40
|
+
|
41
|
+
# setup the service
|
42
|
+
@service = create_service_instance
|
43
|
+
|
44
|
+
service.ui = ui # for interactive user prompts/messages
|
45
|
+
|
46
|
+
# Perform any steps before handling the command
|
47
|
+
before_exec_command
|
48
|
+
|
49
|
+
# exec the actual cmd
|
50
|
+
execute_command
|
51
|
+
|
52
|
+
# Perform any steps after handling the command
|
53
|
+
after_exec_command
|
54
|
+
rescue CloudExceptions::KnifeCloudError => e
|
55
|
+
Chef::Log.debug(e.message)
|
56
|
+
exit 1
|
57
|
+
end
|
58
|
+
|
59
|
+
end # class Command
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -45,18 +45,18 @@ class Chef
|
|
45
45
|
def network
|
46
46
|
@network ||= begin
|
47
47
|
Fog::Network.new(@auth_params)
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
48
|
+
rescue Excon::Error::Unauthorized => e
|
49
|
+
error_message = "Connection failure, please check your username and password."
|
50
|
+
ui.fatal(error_message)
|
51
|
+
raise CloudExceptions::ServiceConnectionError, "#{e.message}. #{error_message}"
|
52
|
+
rescue Excon::Error::Socket => e
|
53
|
+
error_message = "Connection failure, please check your authentication URL."
|
54
|
+
ui.fatal(error_message)
|
55
|
+
raise CloudExceptions::ServiceConnectionError, "#{e.message}. #{error_message}"
|
56
|
+
rescue Fog::Errors::NotFound => e
|
57
|
+
error_message = "No Network service found. This command is unavailable with current cloud."
|
58
|
+
ui.fatal(error_message)
|
59
|
+
raise CloudExceptions::NetworkNotFoundError, "#{e.message}. #{error_message}"
|
60
60
|
end
|
61
61
|
end
|
62
62
|
|
@@ -68,10 +68,10 @@ class Chef
|
|
68
68
|
rescue Excon::Error::BadRequest => e
|
69
69
|
response = Chef::JSONCompat.from_json(e.response.body)
|
70
70
|
if response["badRequest"]["code"] == 400
|
71
|
-
message = "Bad request (400): #{response[
|
71
|
+
message = "Bad request (400): #{response["badRequest"]["message"]}"
|
72
72
|
ui.fatal(message)
|
73
73
|
else
|
74
|
-
message = "Unknown server error (#{response[
|
74
|
+
message = "Unknown server error (#{response["badRequest"]["code"]}): #{response["badRequest"]["message"]}"
|
75
75
|
ui.fatal(message)
|
76
76
|
end
|
77
77
|
raise CloudExceptions::ServerCreateError, message
|
@@ -124,7 +124,7 @@ class Chef
|
|
124
124
|
def handle_excon_exception(exception_class, e)
|
125
125
|
error_message = if e.response
|
126
126
|
response = Chef::JSONCompat.from_json(e.response.body)
|
127
|
-
"Unknown server error (#{response[response.keys[0]][
|
127
|
+
"Unknown server error (#{response[response.keys[0]]["code"]}): #{response[response.keys[0]]["message"]}"
|
128
128
|
else
|
129
129
|
"Unknown server error : #{e.message}"
|
130
130
|
end
|
@@ -233,7 +233,7 @@ class Chef
|
|
233
233
|
else
|
234
234
|
col_info[:value]
|
235
235
|
end
|
236
|
-
|
236
|
+
unless value.nil? || value.empty?
|
237
237
|
list << ui.color(col_info[:label], :bold)
|
238
238
|
list << value
|
239
239
|
end
|
@@ -32,6 +32,38 @@ class Chef
|
|
32
32
|
config[key] || Chef::Config[:knife][key]
|
33
33
|
end
|
34
34
|
|
35
|
+
def create_service_instance
|
36
|
+
raise Chef::Exceptions::Override, "You must override create_service_instance in #{self} to create cloud specific service"
|
37
|
+
end
|
38
|
+
|
39
|
+
def execute_command
|
40
|
+
raise Chef::Exceptions::Override, "You must override execute_command in #{self}"
|
41
|
+
end
|
42
|
+
|
43
|
+
# Derived classes can override before_exec_command and after_exec_command
|
44
|
+
def before_exec_command; end
|
45
|
+
|
46
|
+
def after_exec_command; end
|
47
|
+
|
48
|
+
def set_default_config; end
|
49
|
+
|
50
|
+
def validate!(*keys)
|
51
|
+
# validates necessary options/params to carry out the command.
|
52
|
+
# subclasses to implement this.
|
53
|
+
errors = []
|
54
|
+
keys.each do |k|
|
55
|
+
errors << "You did not provide a valid '#{pretty_key(k)}' value." if locate_config_value(k).nil?
|
56
|
+
end
|
57
|
+
error_message = ""
|
58
|
+
raise CloudExceptions::ValidationError, error_message if errors.each { |e| ui.error(e); error_message = "#{error_message} #{e}." }.any?
|
59
|
+
end
|
60
|
+
|
61
|
+
def validate_params!; end
|
62
|
+
|
63
|
+
def pretty_key(key)
|
64
|
+
key.to_s.tr("_", " ").gsub(/\w+/) { |w| (w =~ /(ssh)|(aws)/i) ? w.upcase : w.capitalize }
|
65
|
+
end
|
66
|
+
|
35
67
|
end
|
36
68
|
end
|
37
69
|
end
|
@@ -46,6 +46,7 @@ class Chef
|
|
46
46
|
def is_resource_filtered?(attribute, value)
|
47
47
|
# resource_filters is array of filters in form {:attribute => attribute-name, :regex => 'filter regex value'}
|
48
48
|
return false if @resource_filters.nil?
|
49
|
+
|
49
50
|
@resource_filters.each do |filter|
|
50
51
|
if attribute == filter[:attribute] && value =~ filter[:regex]
|
51
52
|
return true
|
@@ -60,7 +61,7 @@ class Chef
|
|
60
61
|
list = []
|
61
62
|
@columns_with_info.each do |col_info|
|
62
63
|
value = (col_info[:value_callback].nil? ? resource.send(col_info[:key]).to_s : col_info[:value_callback].call(resource.send(col_info[:key])))
|
63
|
-
|
64
|
+
unless config[:disable_filter]
|
64
65
|
resource_filtered = true if is_resource_filtered?(col_info[:key], value)
|
65
66
|
end
|
66
67
|
list << value
|
@@ -8,10 +8,10 @@ class Chef
|
|
8
8
|
includer.class_eval do
|
9
9
|
|
10
10
|
option :disable_filter,
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
11
|
+
long: "--disable-filter",
|
12
|
+
description: "Disable filtering of the current resource listing.",
|
13
|
+
boolean: true,
|
14
|
+
default: false
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
@@ -14,15 +14,16 @@
|
|
14
14
|
# See the License for the specific language governing permissions and
|
15
15
|
# limitations under the License.
|
16
16
|
#
|
17
|
-
require "chef/knife/cloud/
|
17
|
+
require "chef/knife/cloud/command_bootstrap"
|
18
18
|
require "chef/knife/cloud/exceptions"
|
19
19
|
require "chef/knife/cloud/chefbootstrap/bootstrapper"
|
20
20
|
|
21
21
|
class Chef
|
22
22
|
class Knife
|
23
23
|
class Cloud
|
24
|
-
class ServerCreateCommand <
|
24
|
+
class ServerCreateCommand < BootstrapCommand
|
25
25
|
attr_accessor :server, :create_options
|
26
|
+
Chef::Knife::Bootstrap.load_deps
|
26
27
|
|
27
28
|
def initialize(argv = [])
|
28
29
|
super argv
|
@@ -34,19 +35,18 @@ class Chef
|
|
34
35
|
# set param vm_name to a random value if the name is not set by the user (plugin)
|
35
36
|
config[:chef_node_name] = get_node_name(locate_config_value(:chef_node_name), locate_config_value(:chef_node_name_prefix))
|
36
37
|
|
37
|
-
# validate
|
38
|
+
# validate ssh_identity_file for connection protocol and connection_user, connection_password for both ssh bootstrap protocol and winrm bootstrap protocol
|
38
39
|
errors = []
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
errors << "You must provide either Identity file or SSH Password."
|
40
|
+
if locate_config_value(:connection_protocol) == "ssh"
|
41
|
+
if locate_config_value(:ssh_identity_file).nil? && locate_config_value(:connection_password).nil?
|
42
|
+
errors << "You must provide either SSH Identity file or Connection Password."
|
43
43
|
end
|
44
|
-
elsif locate_config_value(:
|
45
|
-
if locate_config_value(:
|
46
|
-
errors << "You must provide
|
44
|
+
elsif locate_config_value(:connection_protocol) == "winrm"
|
45
|
+
if locate_config_value(:connection_password).nil?
|
46
|
+
errors << "You must provide Connection Password."
|
47
47
|
end
|
48
48
|
else
|
49
|
-
errors << "You must provide a valid
|
49
|
+
errors << "You must provide a valid connection protocol. options [ssh/winrm]. For linux type images, options [ssh]"
|
50
50
|
end
|
51
51
|
error_message = ""
|
52
52
|
raise CloudExceptions::ValidationError, error_message if errors.each { |e| ui.error(e); error_message = "#{error_message} #{e}." }.any?
|
@@ -82,7 +82,7 @@ class Chef
|
|
82
82
|
cleanup_on_failure
|
83
83
|
raise e
|
84
84
|
rescue => e
|
85
|
-
error_message = "Check if --
|
85
|
+
error_message = "Check if --connection-protocol and --image-os-type is correct. #{e.message}"
|
86
86
|
ui.fatal(error_message)
|
87
87
|
cleanup_on_failure
|
88
88
|
raise e, error_message
|
@@ -100,15 +100,13 @@ class Chef
|
|
100
100
|
before_bootstrap
|
101
101
|
@bootstrapper = Bootstrapper.new(config)
|
102
102
|
Chef::Log.debug("Bootstrapping the server...")
|
103
|
-
ui.info("Bootstrapping the server by using #{ui.color("
|
103
|
+
ui.info("Bootstrapping the server by using #{ui.color("connection_protocol", :cyan)}: #{config[:connection_protocol]} and #{ui.color("image_os_type", :cyan)}: #{config[:image_os_type]}")
|
104
104
|
@bootstrapper.bootstrap
|
105
105
|
after_bootstrap
|
106
106
|
end
|
107
107
|
|
108
108
|
# any cloud specific initializations/cleanup we want to do around bootstrap.
|
109
|
-
def before_bootstrap
|
110
|
-
ssh_override_winrm if locate_config_value(:bootstrap_protocol) == "ssh"
|
111
|
-
end
|
109
|
+
def before_bootstrap; end
|
112
110
|
|
113
111
|
def after_bootstrap
|
114
112
|
service.server_summary(@server, @columns_with_info)
|
@@ -116,44 +114,18 @@ class Chef
|
|
116
114
|
|
117
115
|
# knife-plugin can override set_default_config to set default config by using their own mechanism.
|
118
116
|
def set_default_config
|
119
|
-
config[:image_os_type] = "windows" if config[:
|
117
|
+
config[:image_os_type] = "windows" if config[:connection_protocol] == "winrm"
|
120
118
|
end
|
121
119
|
|
122
120
|
# generate a random name if chef_node_name is empty
|
123
121
|
def get_node_name(chef_node_name, prefix)
|
124
122
|
return chef_node_name unless chef_node_name.nil?
|
123
|
+
|
125
124
|
# lazy uuids, 15 chars cause windows has limits
|
126
125
|
("#{prefix}-" + rand.to_s.split(".")[1]).slice(0, 14)
|
127
126
|
end
|
128
127
|
|
129
|
-
def post_connection_validations
|
130
|
-
end
|
131
|
-
|
132
|
-
private
|
133
|
-
|
134
|
-
# Here, ssh config override winrm config
|
135
|
-
def ssh_override_winrm
|
136
|
-
# unchanged ssh_user and changed winrm_user, override ssh_user
|
137
|
-
if locate_config_value(:ssh_user).eql?(options[:ssh_user][:default]) &&
|
138
|
-
!locate_config_value(:winrm_user).eql?(options[:winrm_user][:default])
|
139
|
-
config[:ssh_user] = locate_config_value(:winrm_user)
|
140
|
-
end
|
141
|
-
# unchanged ssh_port and changed winrm_port, override ssh_port
|
142
|
-
if locate_config_value(:ssh_port).eql?(options[:ssh_port][:default]) &&
|
143
|
-
!locate_config_value(:winrm_port).eql?(options[:winrm_port][:default])
|
144
|
-
config[:ssh_port] = locate_config_value(:winrm_port)
|
145
|
-
end
|
146
|
-
# unset ssh_password and set winrm_password, override ssh_password
|
147
|
-
if locate_config_value(:ssh_password).nil? &&
|
148
|
-
!locate_config_value(:winrm_password).nil?
|
149
|
-
config[:ssh_password] = locate_config_value(:winrm_password)
|
150
|
-
end
|
151
|
-
# unset identity_file and set kerberos_keytab_file, override identity_file
|
152
|
-
if locate_config_value(:identity_file).nil? &&
|
153
|
-
!locate_config_value(:kerberos_keytab_file).nil?
|
154
|
-
config[:identity_file] = locate_config_value(:kerberos_keytab_file)
|
155
|
-
end
|
156
|
-
end
|
128
|
+
def post_connection_validations; end
|
157
129
|
end # class ServerCreateCommand
|
158
130
|
end
|
159
131
|
end
|
@@ -37,7 +37,6 @@ class Chef
|
|
37
37
|
short: "-T IMAGE_OS_TYPE",
|
38
38
|
long: "--image-os-type IMAGE_OS_TYPE",
|
39
39
|
description: "The image os type. options [windows/linux]. Only required when cloud does not provide a way to identify image os",
|
40
|
-
default: "linux",
|
41
40
|
proc: Proc.new { |i| Chef::Config[:knife][:image_os_type] = i }
|
42
41
|
|
43
42
|
option :flavor,
|
@@ -46,11 +45,9 @@ class Chef
|
|
46
45
|
description: "The flavor name or ID of server",
|
47
46
|
proc: Proc.new { |f| Chef::Config[:knife][:flavor] = f }
|
48
47
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
default: "ssh",
|
53
|
-
proc: Proc.new { |b| Chef::Config[:knife][:bootstrap_protocol] = b }
|
48
|
+
deprecated_option :bootstrap_protocol,
|
49
|
+
replacement: :connection_protocol,
|
50
|
+
long: "--bootstrap-protocol PROTOCOL"
|
54
51
|
|
55
52
|
option :server_create_timeout,
|
56
53
|
long: "--server-create-timeout timeout",
|
@@ -69,7 +66,6 @@ class Chef
|
|
69
66
|
description: "The prefix for chef node name",
|
70
67
|
default: includer.snake_case_name.split("_").first,
|
71
68
|
proc: Proc.new { |key| Chef::Config[:knife][:chef_node_name_prefix] = key }
|
72
|
-
|
73
69
|
end
|
74
70
|
end
|
75
71
|
|
@@ -30,7 +30,7 @@ class Chef
|
|
30
30
|
option :custom_attributes,
|
31
31
|
long: "--custom-attributes CUSTOM_ATTRIBUTES",
|
32
32
|
description: "Custom attributes to be passed to Fog.",
|
33
|
-
proc: Proc.new { |args| Chef::Config[:knife][:custom_attributes] = args.split(";").map { |keys| keys.split("=") }.map { |j| Hash[*j.map
|
33
|
+
proc: Proc.new { |args| Chef::Config[:knife][:custom_attributes] = args.split(";").map { |keys| keys.split("=") }.map { |j| Hash[*j.map(&:strip)] } }
|
34
34
|
end
|
35
35
|
end
|
36
36
|
end
|
@@ -36,16 +36,13 @@ class Chef
|
|
36
36
|
end
|
37
37
|
|
38
38
|
# override in cloud specific derived classes
|
39
|
-
def list_resource_allocations
|
40
|
-
end
|
39
|
+
def list_resource_allocations; end
|
41
40
|
|
42
41
|
# Do nothing or override in cloud specific derived classes for pre-vm-creation setup steps
|
43
|
-
def create_server_dependencies
|
44
|
-
end
|
42
|
+
def create_server_dependencies; end
|
45
43
|
|
46
44
|
# Do nothing or override in cloud specific derived classes for pre-vm-creation setup steps
|
47
|
-
def delete_server_dependencies
|
48
|
-
end
|
45
|
+
def delete_server_dependencies; end
|
49
46
|
|
50
47
|
def delete_server_on_failure(server = nil)
|
51
48
|
raise Chef::Exceptions::Override, "You must override delete_server_on_failure in #{self} to delete server"
|
data/lib/knife-cloud/version.rb
CHANGED
data/lib/test/fixtures/knife.rb
CHANGED
@@ -5,5 +5,5 @@ validation_client_name "validation"
|
|
5
5
|
validation_key "#{current_dir}/validation.pem"
|
6
6
|
chef_server_url "http://localhost:8889"
|
7
7
|
cache_type "BasicFile"
|
8
|
-
cache_options( path: "#{ENV[
|
8
|
+
cache_options( path: "#{ENV["HOME"]}/.chef/checksums" )
|
9
9
|
cookbook_path ["#{current_dir}/chef-repo/cookbooks"]
|
@@ -30,7 +30,7 @@ module RSpec
|
|
30
30
|
# Convenience function for grabbing a hash of several important
|
31
31
|
# Mixlib::Shellout command configuration parameters.
|
32
32
|
def self.command_setting(shellout_command)
|
33
|
-
keys =
|
33
|
+
keys = %i{cwd user group umask timeout valid_exit_codes environment}
|
34
34
|
keys.inject({}) do |hash, attr|
|
35
35
|
hash[attr] = shellout_command.send(attr)
|
36
36
|
hash
|
@@ -3,7 +3,7 @@ require File.expand_path(File.dirname(__FILE__) + "/knife_test_utils")
|
|
3
3
|
|
4
4
|
RSpec::Matchers.define :have_outcome do |outcome_spec|
|
5
5
|
match do |executed_shellout_command|
|
6
|
-
valid_keys =
|
6
|
+
valid_keys = %i{status stdout stderr}
|
7
7
|
if outcome_spec.keys & valid_keys == []
|
8
8
|
throw "You did not specify values for any of #{valid_keys}!"
|
9
9
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: knife-cloud
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kaustubh Deorukhkar
|
@@ -9,22 +9,22 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2019-08-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
|
-
name:
|
15
|
+
name: chef
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
18
|
- - ">="
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: '
|
20
|
+
version: '15.0'
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
25
|
- - ">="
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version: '
|
27
|
+
version: '15.0'
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: mixlib-shellout
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
@@ -66,10 +66,9 @@ files:
|
|
66
66
|
- lib/chef/knife/cloud/chefbootstrap/bootstrap_protocol.rb
|
67
67
|
- lib/chef/knife/cloud/chefbootstrap/bootstrapper.rb
|
68
68
|
- lib/chef/knife/cloud/chefbootstrap/ssh_bootstrap_protocol.rb
|
69
|
-
- lib/chef/knife/cloud/chefbootstrap/unix_distribution.rb
|
70
|
-
- lib/chef/knife/cloud/chefbootstrap/windows_distribution.rb
|
71
69
|
- lib/chef/knife/cloud/chefbootstrap/winrm_bootstrap_protocol.rb
|
72
70
|
- lib/chef/knife/cloud/command.rb
|
71
|
+
- lib/chef/knife/cloud/command_bootstrap.rb
|
73
72
|
- lib/chef/knife/cloud/exceptions.rb
|
74
73
|
- lib/chef/knife/cloud/fog/options.rb
|
75
74
|
- lib/chef/knife/cloud/fog/service.rb
|
@@ -103,19 +102,19 @@ post_install_message:
|
|
103
102
|
rdoc_options: []
|
104
103
|
require_paths:
|
105
104
|
- lib
|
105
|
+
- spec
|
106
106
|
required_ruby_version: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: 2.2.
|
110
|
+
version: 2.2.5
|
111
111
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
112
112
|
requirements:
|
113
113
|
- - ">="
|
114
114
|
- !ruby/object:Gem::Version
|
115
115
|
version: '0'
|
116
116
|
requirements: []
|
117
|
-
|
118
|
-
rubygems_version: 2.7.6
|
117
|
+
rubygems_version: 3.0.3
|
119
118
|
signing_key:
|
120
119
|
specification_version: 4
|
121
120
|
summary: knife-cloud plugin
|
@@ -1,31 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Author:: Prabhu Das (<prabhu.das@clogeny.com>)
|
3
|
-
# Copyright:: Copyright (c) 2013-2016 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
|
-
require "chef/knife/cloud/chefbootstrap/bootstrap_distribution"
|
18
|
-
|
19
|
-
class Chef
|
20
|
-
class Knife
|
21
|
-
class Cloud
|
22
|
-
class UnixDistribution < BootstrapDistribution
|
23
|
-
|
24
|
-
def initialize(config)
|
25
|
-
super
|
26
|
-
config[:distro] = config[:distro] || "chef-full"
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
@@ -1,32 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Author:: Prabhu Das (<prabhu.das@clogeny.com>)
|
3
|
-
# Copyright:: Copyright (c) 2013-2016 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
|
-
require "chef/knife/cloud/chefbootstrap/bootstrap_distribution"
|
19
|
-
require "chef/knife/bootstrap_windows_base"
|
20
|
-
|
21
|
-
class Chef
|
22
|
-
class Knife
|
23
|
-
class Cloud
|
24
|
-
class WindowsDistribution < BootstrapDistribution
|
25
|
-
def initialize(config)
|
26
|
-
super
|
27
|
-
config[:distro] ||= "windows-chef-client-msi"
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|