knife-cloud 2.0.5 → 4.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_protocol.rb +30 -29
- data/lib/chef/knife/cloud/chefbootstrap/ssh_bootstrap_protocol.rb +24 -23
- data/lib/chef/knife/cloud/command.rb +1 -1
- data/lib/chef/knife/cloud/command_bootstrap.rb +1 -1
- data/lib/chef/knife/cloud/fog/options.rb +3 -5
- data/lib/chef/knife/cloud/fog/service.rb +9 -9
- data/lib/chef/knife/cloud/helpers.rb +2 -7
- data/lib/chef/knife/cloud/server/create_command.rb +7 -7
- data/lib/chef/knife/cloud/server/create_options.rb +6 -11
- data/lib/chef/knife/cloud/server/list_options.rb +2 -3
- data/lib/chef/knife/cloud/server/options.rb +2 -2
- data/lib/chef/knife/cloud/server/show_command.rb +4 -4
- data/lib/chef/knife/cloud/server/show_options.rb +2 -3
- data/lib/chef/knife/cloud/service.rb +7 -4
- data/lib/knife-cloud/version.rb +1 -1
- metadata +5 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ab894f4c13f8b1a6d3c12528fdaab52966a1a7190a0ac2d513c03b8c868f9721
|
|
4
|
+
data.tar.gz: dedf79aebeee5a7d3c55d8363850891b1f0821a2d98569ec40f63abe5632673f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 12d02e53f211b9824c5dbb0e8bc0bec8630437cc9d6de8d88842fba4bb3e5f6c227e4bedd9894a8d6e959f85d03aa9281b480935f57e98e640df80b11545ccf9
|
|
7
|
+
data.tar.gz: 2363fdea3d79b36750aa598a79cdff9ee3b8f1e59899af2f0ff916aeedcae992ecb6d3d2982ca86ebd97b59f8dde2c23ece4af61c930305dfebf90f9360b9243
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Author:: Kaustubh Deorukhkar (<kaustubh@clogeny.com>)
|
|
2
2
|
# Author:: Prabhu Das (<prabhu.das@clogeny.com>)
|
|
3
3
|
#
|
|
4
|
-
# Copyright:: Copyright (c)
|
|
4
|
+
# Copyright:: Copyright (c) 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");
|
|
@@ -46,35 +46,36 @@ class Chef
|
|
|
46
46
|
|
|
47
47
|
def init_bootstrap_options
|
|
48
48
|
# set the command bootstrap options.
|
|
49
|
-
bootstrap.name_args <<
|
|
50
|
-
bootstrap.config[:chef_node_name] =
|
|
51
|
-
bootstrap.config[:run_list] =
|
|
52
|
-
bootstrap.config[:prerelease] =
|
|
53
|
-
bootstrap.config[:bootstrap_version] =
|
|
54
|
-
bootstrap.config[:bootstrap_proxy] =
|
|
55
|
-
bootstrap.config[:environment] =
|
|
49
|
+
bootstrap.name_args << config[:bootstrap_ip_address]
|
|
50
|
+
bootstrap.config[:chef_node_name] = config[:chef_node_name]
|
|
51
|
+
bootstrap.config[:run_list] = config[:run_list]
|
|
52
|
+
bootstrap.config[:prerelease] = config[:prerelease]
|
|
53
|
+
bootstrap.config[:bootstrap_version] = config[:bootstrap_version]
|
|
54
|
+
bootstrap.config[:bootstrap_proxy] = config[:bootstrap_proxy]
|
|
55
|
+
bootstrap.config[:environment] = config[:environment]
|
|
56
56
|
# see chef/knife/bootstrap.rb #warn_chef_config_secret_key.
|
|
57
|
-
bootstrap.config[:encrypted_data_bag_secret] =
|
|
58
|
-
bootstrap.config[:encrypted_data_bag_secret_file] =
|
|
59
|
-
bootstrap.config[:first_boot_attributes] =
|
|
60
|
-
bootstrap.config[:secret] =
|
|
61
|
-
bootstrap.config[:secret_file] =
|
|
62
|
-
bootstrap.config[:bootstrap_template] =
|
|
63
|
-
bootstrap.config[:node_ssl_verify_mode] =
|
|
64
|
-
bootstrap.config[:node_verify_api_cert] =
|
|
65
|
-
bootstrap.config[:bootstrap_no_proxy] =
|
|
66
|
-
bootstrap.config[:bootstrap_url] =
|
|
67
|
-
bootstrap.config[:bootstrap_install_command] =
|
|
68
|
-
bootstrap.config[:bootstrap_wget_options] =
|
|
69
|
-
bootstrap.config[:bootstrap_curl_options] =
|
|
70
|
-
bootstrap.config[:bootstrap_vault_file] =
|
|
71
|
-
bootstrap.config[:bootstrap_vault_json] =
|
|
72
|
-
bootstrap.config[:bootstrap_vault_item] =
|
|
73
|
-
bootstrap.config[:use_sudo_password] =
|
|
74
|
-
bootstrap.config[:msi_url] =
|
|
75
|
-
bootstrap.config[:install_as_service] =
|
|
76
|
-
bootstrap.config[:session_timeout] =
|
|
77
|
-
bootstrap.config[:channel] =
|
|
57
|
+
bootstrap.config[:encrypted_data_bag_secret] = config[:encrypted_data_bag_secret]
|
|
58
|
+
bootstrap.config[:encrypted_data_bag_secret_file] = config[:encrypted_data_bag_secret_file]
|
|
59
|
+
bootstrap.config[:first_boot_attributes] = config[:first_boot_attributes]
|
|
60
|
+
bootstrap.config[:secret] = config[:secret]
|
|
61
|
+
bootstrap.config[:secret_file] = config[:secret_file]
|
|
62
|
+
bootstrap.config[:bootstrap_template] = config[:bootstrap_template]
|
|
63
|
+
bootstrap.config[:node_ssl_verify_mode] = config[:node_ssl_verify_mode]
|
|
64
|
+
bootstrap.config[:node_verify_api_cert] = config[:node_verify_api_cert]
|
|
65
|
+
bootstrap.config[:bootstrap_no_proxy] = config[:bootstrap_no_proxy]
|
|
66
|
+
bootstrap.config[:bootstrap_url] = config[:bootstrap_url]
|
|
67
|
+
bootstrap.config[:bootstrap_install_command] = config[:bootstrap_install_command]
|
|
68
|
+
bootstrap.config[:bootstrap_wget_options] = config[:bootstrap_wget_options]
|
|
69
|
+
bootstrap.config[:bootstrap_curl_options] = config[:bootstrap_curl_options]
|
|
70
|
+
bootstrap.config[:bootstrap_vault_file] = config[:bootstrap_vault_file]
|
|
71
|
+
bootstrap.config[:bootstrap_vault_json] = config[:bootstrap_vault_json]
|
|
72
|
+
bootstrap.config[:bootstrap_vault_item] = config[:bootstrap_vault_item]
|
|
73
|
+
bootstrap.config[:use_sudo_password] = config[:use_sudo_password]
|
|
74
|
+
bootstrap.config[:msi_url] = config[:msi_url]
|
|
75
|
+
bootstrap.config[:install_as_service] = config[:install_as_service]
|
|
76
|
+
bootstrap.config[:session_timeout] = config[:session_timeout]
|
|
77
|
+
bootstrap.config[:channel] = config[:channel]
|
|
78
|
+
bootstrap.config[:bootstrap_product] = config[:bootstrap_product]
|
|
78
79
|
end
|
|
79
80
|
|
|
80
81
|
end
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Author:: Kaustubh Deorukhkar (<kaustubh@clogeny.com>)
|
|
2
2
|
# Author:: Prabhu Das (<prabhu.das@clogeny.com>)
|
|
3
3
|
#
|
|
4
|
-
# Copyright:: Copyright (c)
|
|
4
|
+
# Copyright:: Copyright (c) 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");
|
|
@@ -32,33 +32,33 @@ class Chef
|
|
|
32
32
|
end
|
|
33
33
|
|
|
34
34
|
def init_bootstrap_options
|
|
35
|
-
bootstrap.config[:connection_user] =
|
|
36
|
-
bootstrap.config[:connection_password] =
|
|
37
|
-
bootstrap.config[:connection_port] =
|
|
38
|
-
bootstrap.config[:ssh_identity_file] =
|
|
39
|
-
bootstrap.config[:ssh_verify_host_key] =
|
|
40
|
-
bootstrap.config[:use_sudo] = true unless
|
|
41
|
-
bootstrap.config[:ssh_gateway] =
|
|
42
|
-
bootstrap.config[:forward_agent] =
|
|
43
|
-
bootstrap.config[:use_sudo_password] =
|
|
35
|
+
bootstrap.config[:connection_user] = config[:connection_user]
|
|
36
|
+
bootstrap.config[:connection_password] = config[:connection_password]
|
|
37
|
+
bootstrap.config[:connection_port] = config[: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"
|
|
41
|
+
bootstrap.config[:ssh_gateway] = config[:ssh_gateway]
|
|
42
|
+
bootstrap.config[:forward_agent] = config[:forward_agent]
|
|
43
|
+
bootstrap.config[:use_sudo_password] = config[:use_sudo_password]
|
|
44
44
|
super
|
|
45
45
|
end
|
|
46
46
|
|
|
47
47
|
def wait_for_server_ready
|
|
48
|
-
print "\n#{ui.color("Waiting for sshd to host (#{
|
|
48
|
+
print "\n#{ui.color("Waiting for sshd to host (#{config[:bootstrap_ip_address]})", :magenta)}"
|
|
49
49
|
|
|
50
|
-
ssh_gateway = get_ssh_gateway_for(
|
|
50
|
+
ssh_gateway = get_ssh_gateway_for(config[:bootstrap_ip_address])
|
|
51
51
|
|
|
52
52
|
# The ssh_gateway & subnet_id are currently supported only in EC2.
|
|
53
53
|
if ssh_gateway
|
|
54
|
-
print(".") until tunnel_test_ssh(ssh_gateway,
|
|
55
|
-
@initial_sleep_delay = !!
|
|
54
|
+
print(".") until tunnel_test_ssh(ssh_gateway, config[:bootstrap_ip_address]) do
|
|
55
|
+
@initial_sleep_delay = !!config[:subnet_id] ? 40 : 10
|
|
56
56
|
sleep @initial_sleep_delay
|
|
57
57
|
puts("done")
|
|
58
58
|
end
|
|
59
59
|
else
|
|
60
|
-
print(".") until tcp_test_ssh(
|
|
61
|
-
@initial_sleep_delay = !!
|
|
60
|
+
print(".") until tcp_test_ssh(config[:bootstrap_ip_address], config[:connection_port] || config[:ssh_port] ) do
|
|
61
|
+
@initial_sleep_delay = !!config[:subnet_id] ? 40 : 10
|
|
62
62
|
sleep @initial_sleep_delay
|
|
63
63
|
puts("done")
|
|
64
64
|
end
|
|
@@ -66,11 +66,11 @@ class Chef
|
|
|
66
66
|
end
|
|
67
67
|
|
|
68
68
|
def get_ssh_gateway_for(hostname)
|
|
69
|
-
if
|
|
69
|
+
if config[:ssh_gateway]
|
|
70
70
|
# The ssh_gateway specified in the knife config (if any) takes
|
|
71
71
|
# precedence over anything in the SSH configuration
|
|
72
|
-
Chef::Log.debug("Using ssh gateway #{
|
|
73
|
-
|
|
72
|
+
Chef::Log.debug("Using ssh gateway #{config[:ssh_gateway]} from knife config")
|
|
73
|
+
config[:ssh_gateway]
|
|
74
74
|
else
|
|
75
75
|
# Next, check if the SSH configuration has a ProxyCommand
|
|
76
76
|
# directive for this host. If there is one, parse out the
|
|
@@ -118,7 +118,7 @@ class Chef
|
|
|
118
118
|
Chef::Log.debug("ssh failed to connect: #{hostname}")
|
|
119
119
|
sleep 2
|
|
120
120
|
false
|
|
121
|
-
|
|
121
|
+
# This happens on some mobile phone networks
|
|
122
122
|
rescue Errno::ECONNRESET
|
|
123
123
|
Chef::Log.debug("ssh reset its connection: #{hostname}")
|
|
124
124
|
sleep 2
|
|
@@ -130,7 +130,8 @@ class Chef
|
|
|
130
130
|
def tunnel_test_ssh(ssh_gateway, hostname, &block)
|
|
131
131
|
status = false
|
|
132
132
|
gateway = configure_ssh_gateway(ssh_gateway)
|
|
133
|
-
|
|
133
|
+
remote_ssh_port = config[:connection_port] || config[:ssh_port] || 22
|
|
134
|
+
gateway.open(hostname, remote_ssh_port) do |local_tunnel_port|
|
|
134
135
|
status = tcp_test_ssh("localhost", local_tunnel_port, &block)
|
|
135
136
|
end
|
|
136
137
|
status
|
|
@@ -157,8 +158,8 @@ class Chef
|
|
|
157
158
|
gateway_keys = ssh_gateway_config[:keys]
|
|
158
159
|
|
|
159
160
|
# Use the keys specificed on the command line if available (overrides SSH Config)
|
|
160
|
-
if
|
|
161
|
-
gateway_keys = Array(
|
|
161
|
+
if config[:ssh_gateway_identity]
|
|
162
|
+
gateway_keys = Array(config[:ssh_gateway_identity])
|
|
162
163
|
end
|
|
163
164
|
|
|
164
165
|
unless gateway_keys.nil?
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#
|
|
2
2
|
# Author:: Kaustubh Deorukhkar (<kaustubh@clogeny.com>)
|
|
3
|
-
# Copyright:: Copyright (c)
|
|
3
|
+
# Copyright:: Copyright (c) Chef Software Inc.
|
|
4
4
|
#
|
|
5
5
|
|
|
6
6
|
class Chef
|
|
@@ -13,13 +13,11 @@ class Chef
|
|
|
13
13
|
option :fog_version,
|
|
14
14
|
long: "--fog-version version",
|
|
15
15
|
description: "Fog gem version to use. Use the ruby gem version strings",
|
|
16
|
-
default: ""
|
|
17
|
-
proc: Proc.new { |v| Chef::Config[:knife][:cloud_fog_version] = v }
|
|
16
|
+
default: ""
|
|
18
17
|
|
|
19
18
|
option :api_endpoint,
|
|
20
19
|
long: "--api-endpoint ENDPOINT",
|
|
21
|
-
description: "Your API endpoint. Eg, for Eucalyptus it can be 'http://ecc.eucalyptus.com:8773/services/Eucalyptus'"
|
|
22
|
-
proc: Proc.new { |endpoint| Chef::Config[:knife][:api_endpoint] = endpoint }
|
|
20
|
+
description: "Your API endpoint. Eg, for Eucalyptus it can be 'http://ecc.eucalyptus.com:8773/services/Eucalyptus'"
|
|
23
21
|
|
|
24
22
|
end
|
|
25
23
|
end
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#
|
|
2
2
|
# Author:: Kaustubh Deorukhkar (<kaustubh@clogeny.com>)
|
|
3
3
|
# Author:: Prabhu Das (<prabhu.das@clogeny.com>)
|
|
4
|
-
# Copyright:: Copyright (c)
|
|
4
|
+
# Copyright:: Copyright (c) Chef Software Inc.
|
|
5
5
|
#
|
|
6
6
|
|
|
7
7
|
require_relative "../service"
|
|
@@ -12,18 +12,18 @@ class Chef
|
|
|
12
12
|
class Cloud
|
|
13
13
|
class FogService < Service
|
|
14
14
|
|
|
15
|
-
def initialize(
|
|
16
|
-
load_fog_gem
|
|
15
|
+
def initialize(**kwargs)
|
|
17
16
|
super
|
|
17
|
+
load_fog_gem
|
|
18
18
|
end
|
|
19
19
|
|
|
20
20
|
def load_fog_gem
|
|
21
|
-
|
|
22
|
-
gem "fog",
|
|
23
|
-
require "fog"
|
|
24
|
-
Chef::Log.debug("Using fog version: #{Gem.loaded_specs["fog"].version}")
|
|
25
|
-
rescue Exception
|
|
26
|
-
Chef::Log.error "Error loading fog gem
|
|
21
|
+
# Load specific version of fog-core. Any other classes/modules using fog-core are loaded after this.
|
|
22
|
+
gem "fog-core", config[:cloud_fog_version]
|
|
23
|
+
require "fog/core"
|
|
24
|
+
Chef::Log.debug("Using fog-core version: #{Gem.loaded_specs["fog-core"].version}")
|
|
25
|
+
rescue Exception => ex
|
|
26
|
+
Chef::Log.error "Error loading fog-core gem: #{ex}"
|
|
27
27
|
exit 1
|
|
28
28
|
end
|
|
29
29
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#
|
|
2
|
-
# Copyright:: Copyright (c)
|
|
2
|
+
# Copyright:: Copyright (c) Chef Software Inc.
|
|
3
3
|
# License:: Apache License, Version 2.0
|
|
4
4
|
#
|
|
5
5
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -27,11 +27,6 @@ class Chef
|
|
|
27
27
|
end
|
|
28
28
|
end
|
|
29
29
|
|
|
30
|
-
def locate_config_value(key)
|
|
31
|
-
key = key.to_sym
|
|
32
|
-
config[key] || Chef::Config[:knife][key]
|
|
33
|
-
end
|
|
34
|
-
|
|
35
30
|
def create_service_instance
|
|
36
31
|
raise Chef::Exceptions::Override, "You must override create_service_instance in #{self} to create cloud specific service"
|
|
37
32
|
end
|
|
@@ -52,7 +47,7 @@ class Chef
|
|
|
52
47
|
# subclasses to implement this.
|
|
53
48
|
errors = []
|
|
54
49
|
keys.each do |k|
|
|
55
|
-
errors << "You did not provide a valid '#{pretty_key(k)}' value." if
|
|
50
|
+
errors << "You did not provide a valid '#{pretty_key(k)}' value." if config[k].nil?
|
|
56
51
|
end
|
|
57
52
|
error_message = ""
|
|
58
53
|
raise CloudExceptions::ValidationError, error_message if errors.each { |e| ui.error(e); error_message = "#{error_message} #{e}." }.any?
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#
|
|
2
|
-
# Copyright:: Copyright (c)
|
|
2
|
+
# Copyright:: Copyright (c) Chef Software Inc.
|
|
3
3
|
# License:: Apache License, Version 2.0
|
|
4
4
|
#
|
|
5
5
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -33,16 +33,16 @@ class Chef
|
|
|
33
33
|
|
|
34
34
|
def validate_params!
|
|
35
35
|
# set param vm_name to a random value if the name is not set by the user (plugin)
|
|
36
|
-
config[:chef_node_name] = get_node_name(
|
|
36
|
+
config[:chef_node_name] = get_node_name(config[:chef_node_name], config[:chef_node_name_prefix])
|
|
37
37
|
|
|
38
38
|
# validate ssh_identity_file for connection protocol and connection_user, connection_password for both ssh bootstrap protocol and winrm bootstrap protocol
|
|
39
39
|
errors = []
|
|
40
|
-
if
|
|
41
|
-
if
|
|
40
|
+
if config[:connection_protocol] == "ssh"
|
|
41
|
+
if config[:ssh_identity_file].nil? && config[:connection_password].nil?
|
|
42
42
|
errors << "You must provide either SSH Identity file or Connection Password."
|
|
43
43
|
end
|
|
44
|
-
elsif
|
|
45
|
-
if
|
|
44
|
+
elsif config[:connection_protocol] == "winrm"
|
|
45
|
+
if config[:connection_password].nil?
|
|
46
46
|
errors << "You must provide Connection Password."
|
|
47
47
|
end
|
|
48
48
|
else
|
|
@@ -75,7 +75,7 @@ class Chef
|
|
|
75
75
|
|
|
76
76
|
# Derived classes can override after_exec_command and also call cleanup_on_failure if any exception occured.
|
|
77
77
|
def after_exec_command
|
|
78
|
-
|
|
78
|
+
# bootstrap the server
|
|
79
79
|
bootstrap
|
|
80
80
|
rescue CloudExceptions::BootstrapError => e
|
|
81
81
|
ui.fatal(e.message)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#
|
|
2
|
-
# Copyright:: Copyright (c)
|
|
2
|
+
# Copyright:: Copyright (c) Chef Software Inc.
|
|
3
3
|
# License:: Apache License, Version 2.0
|
|
4
4
|
#
|
|
5
5
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -30,20 +30,17 @@ class Chef
|
|
|
30
30
|
option :image,
|
|
31
31
|
short: "-I IMAGE",
|
|
32
32
|
long: "--image IMAGE",
|
|
33
|
-
description: "A regexp matching an image name or an image ID for the server"
|
|
34
|
-
proc: Proc.new { |i| Chef::Config[:knife][:image] = i }
|
|
33
|
+
description: "A regexp matching an image name or an image ID for the server"
|
|
35
34
|
|
|
36
35
|
option :image_os_type,
|
|
37
36
|
short: "-T IMAGE_OS_TYPE",
|
|
38
37
|
long: "--image-os-type IMAGE_OS_TYPE",
|
|
39
|
-
description: "The image os type. options [windows/linux]. Only required when cloud does not provide a way to identify image os"
|
|
40
|
-
proc: Proc.new { |i| Chef::Config[:knife][:image_os_type] = i }
|
|
38
|
+
description: "The image os type. options [windows/linux]. Only required when cloud does not provide a way to identify image os"
|
|
41
39
|
|
|
42
40
|
option :flavor,
|
|
43
41
|
short: "-f FLAVOR_ID",
|
|
44
42
|
long: "--flavor FLAVOR_ID",
|
|
45
|
-
description: "The flavor name or ID of server"
|
|
46
|
-
proc: Proc.new { |f| Chef::Config[:knife][:flavor] = f }
|
|
43
|
+
description: "The flavor name or ID of server"
|
|
47
44
|
|
|
48
45
|
deprecated_option :bootstrap_protocol,
|
|
49
46
|
replacement: :connection_protocol,
|
|
@@ -52,8 +49,7 @@ class Chef
|
|
|
52
49
|
option :server_create_timeout,
|
|
53
50
|
long: "--server-create-timeout timeout",
|
|
54
51
|
description: "How long to wait until the server is ready; default is 600 seconds",
|
|
55
|
-
default: 600
|
|
56
|
-
proc: Proc.new { |v| Chef::Config[:knife][:server_create_timeout] = v }
|
|
52
|
+
default: 600
|
|
57
53
|
|
|
58
54
|
option :delete_server_on_failure,
|
|
59
55
|
long: "--delete-server-on-failure",
|
|
@@ -64,8 +60,7 @@ class Chef
|
|
|
64
60
|
option :chef_node_name_prefix,
|
|
65
61
|
long: "--chef-node-name-prefix PREFIX_FOR_NODE_NAME",
|
|
66
62
|
description: "The prefix for chef node name",
|
|
67
|
-
default: includer.snake_case_name.split("_").first
|
|
68
|
-
proc: Proc.new { |key| Chef::Config[:knife][:chef_node_name_prefix] = key }
|
|
63
|
+
default: includer.snake_case_name.split("_").first
|
|
69
64
|
end
|
|
70
65
|
end
|
|
71
66
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#
|
|
2
2
|
# Author:: Siddheshwar More (<siddheshwar.more@clogeny.com>)
|
|
3
|
-
# Copyright:: Copyright (c)
|
|
3
|
+
# Copyright:: Copyright (c) Chef Software Inc.
|
|
4
4
|
# License:: Apache License, Version 2.0
|
|
5
5
|
#
|
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -31,8 +31,7 @@ class Chef
|
|
|
31
31
|
|
|
32
32
|
option :chef_node_attribute,
|
|
33
33
|
long: "--chef-node-attribute CHEF_NODE_ATTRIBUTE_NAME",
|
|
34
|
-
description: "Used with --chef-data option. It display node attributes details by adding new column in server list display."
|
|
35
|
-
proc: Proc.new { |i| Chef::Config[:knife][:chef_node_attribute] = i }
|
|
34
|
+
description: "Used with --chef-data option. It display node attributes details by adding new column in server list display."
|
|
36
35
|
|
|
37
36
|
end
|
|
38
37
|
end
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#
|
|
2
2
|
# Author:: Kaustubh Deorukhkar (<kaustubh@clogeny.com>)
|
|
3
|
-
# Copyright:: Copyright (c)
|
|
3
|
+
# Copyright:: Copyright (c) Chef Software Inc.
|
|
4
4
|
# License:: Apache License, Version 2.0
|
|
5
5
|
#
|
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -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|
|
|
33
|
+
proc: Proc.new { |args| args.split(";").map { |keys| keys.split("=") }.map { |j| Hash[*j.map(&:strip)] } }
|
|
34
34
|
end
|
|
35
35
|
end
|
|
36
36
|
end
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#
|
|
2
|
-
# Copyright:: Copyright (c)
|
|
2
|
+
# Copyright:: Copyright (c) Chef Software Inc.
|
|
3
3
|
# License:: Apache License, Version 2.0
|
|
4
4
|
#
|
|
5
5
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -32,7 +32,7 @@ class Chef
|
|
|
32
32
|
def validate_params!
|
|
33
33
|
errors = []
|
|
34
34
|
config[:instance_id] = @name_args.first
|
|
35
|
-
if
|
|
35
|
+
if config[:instance_id].nil?
|
|
36
36
|
errors << "You must provide a valid Instance Id"
|
|
37
37
|
end
|
|
38
38
|
error_message = ""
|
|
@@ -40,9 +40,9 @@ class Chef
|
|
|
40
40
|
end
|
|
41
41
|
|
|
42
42
|
def execute_command
|
|
43
|
-
server = service.get_server(
|
|
43
|
+
server = service.get_server(config[:instance_id])
|
|
44
44
|
if server.nil?
|
|
45
|
-
error_message = "Server doesn't exists for this #{
|
|
45
|
+
error_message = "Server doesn't exists for this #{config[:instance_id]} instance id."
|
|
46
46
|
ui.error(error_message)
|
|
47
47
|
raise CloudExceptions::ServerShowError, error_message
|
|
48
48
|
else
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#
|
|
2
|
-
# Copyright:: Copyright (c)
|
|
2
|
+
# Copyright:: Copyright (c) Chef Software Inc.
|
|
3
3
|
# License:: Apache License, Version 2.0
|
|
4
4
|
#
|
|
5
5
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -24,8 +24,7 @@ class Chef
|
|
|
24
24
|
|
|
25
25
|
option :instance_id,
|
|
26
26
|
long: "--instance-id INSTANCE_ID",
|
|
27
|
-
description: "Required. Instance Id of Server"
|
|
28
|
-
proc: Proc.new { |i| Chef::Config[:knife][:instance_id] = i }
|
|
27
|
+
description: "Required. Instance Id of Server"
|
|
29
28
|
|
|
30
29
|
end
|
|
31
30
|
end
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#
|
|
2
2
|
# Author:: Kaustubh Deorukhkar (<kaustubh@clogeny.com>)
|
|
3
|
-
# Copyright:: Copyright (c)
|
|
3
|
+
# Copyright:: Copyright (c) Chef Software Inc.
|
|
4
4
|
# License:: Apache License, Version 2.0
|
|
5
5
|
#
|
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -25,9 +25,12 @@ class Chef
|
|
|
25
25
|
class Service
|
|
26
26
|
include Cloud::Helpers
|
|
27
27
|
attr_accessor :ui
|
|
28
|
+
attr_accessor :config
|
|
29
|
+
attr_reader :auth_params
|
|
28
30
|
|
|
29
|
-
def initialize(
|
|
30
|
-
@
|
|
31
|
+
def initialize(config:, auth_params: nil)
|
|
32
|
+
@config = config
|
|
33
|
+
@auth_params = auth_params
|
|
31
34
|
end
|
|
32
35
|
|
|
33
36
|
def connection
|
|
@@ -78,7 +81,7 @@ class Chef
|
|
|
78
81
|
end
|
|
79
82
|
|
|
80
83
|
def add_custom_attributes(server_def)
|
|
81
|
-
|
|
84
|
+
config[:custom_attributes].map { |args| args.map { |k, v| server_def.merge!(k.to_sym => v) } } unless config[:custom_attributes].nil?
|
|
82
85
|
end
|
|
83
86
|
|
|
84
87
|
end # class service
|
data/lib/knife-cloud/version.rb
CHANGED
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: 4.0.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Kaustubh Deorukhkar
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date:
|
|
12
|
+
date: 2020-07-15 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: chef
|
|
@@ -17,14 +17,14 @@ dependencies:
|
|
|
17
17
|
requirements:
|
|
18
18
|
- - ">="
|
|
19
19
|
- !ruby/object:Gem::Version
|
|
20
|
-
version: '15.
|
|
20
|
+
version: '15.11'
|
|
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: '15.
|
|
27
|
+
version: '15.11'
|
|
28
28
|
- !ruby/object:Gem::Dependency
|
|
29
29
|
name: mixlib-shellout
|
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -102,12 +102,11 @@ post_install_message:
|
|
|
102
102
|
rdoc_options: []
|
|
103
103
|
require_paths:
|
|
104
104
|
- lib
|
|
105
|
-
- spec
|
|
106
105
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
107
106
|
requirements:
|
|
108
107
|
- - ">="
|
|
109
108
|
- !ruby/object:Gem::Version
|
|
110
|
-
version: 2.
|
|
109
|
+
version: '2.6'
|
|
111
110
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
112
111
|
requirements:
|
|
113
112
|
- - ">="
|