knife-cloud 2.0.5 → 4.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 14f7ee3017bfcd37e3575dec76011a14f9af8ae6fa7dd7201b069e565f8fd652
4
- data.tar.gz: d7d7aa34c539cc28f2590e934c53940a042677e715d203c9512fbffa44f9cb1f
3
+ metadata.gz: ab894f4c13f8b1a6d3c12528fdaab52966a1a7190a0ac2d513c03b8c868f9721
4
+ data.tar.gz: dedf79aebeee5a7d3c55d8363850891b1f0821a2d98569ec40f63abe5632673f
5
5
  SHA512:
6
- metadata.gz: e246f4727e8876ed415551368667e0fc7494f449ba4f28d59f257e1eba604a9f51225a3f6ef412370687f7b07a4f143232e14c449bfffe7d2317251f4b97960c
7
- data.tar.gz: 326f8e5aded5549cca4caf0500a1beca39946fa54860e85b26cce8131b61304e45189b7af05f4d44ed4d41742ad87afba497f0f0f68704562bd0eefdc1b11956
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) 2013-2016 Chef Software, Inc.
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 << locate_config_value(:bootstrap_ip_address)
50
- bootstrap.config[:chef_node_name] = locate_config_value(:chef_node_name)
51
- bootstrap.config[:run_list] = locate_config_value(:run_list)
52
- bootstrap.config[:prerelease] = locate_config_value(:prerelease)
53
- bootstrap.config[:bootstrap_version] = locate_config_value(:bootstrap_version)
54
- bootstrap.config[:bootstrap_proxy] = locate_config_value(:bootstrap_proxy)
55
- bootstrap.config[:environment] = locate_config_value(: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] = locate_config_value(:encrypted_data_bag_secret)
58
- bootstrap.config[:encrypted_data_bag_secret_file] = locate_config_value(:encrypted_data_bag_secret_file)
59
- bootstrap.config[:first_boot_attributes] = locate_config_value(:first_boot_attributes)
60
- bootstrap.config[:secret] = locate_config_value(:secret)
61
- bootstrap.config[:secret_file] = locate_config_value(:secret_file)
62
- bootstrap.config[:bootstrap_template] = locate_config_value(:bootstrap_template)
63
- bootstrap.config[:node_ssl_verify_mode] = locate_config_value(:node_ssl_verify_mode)
64
- bootstrap.config[:node_verify_api_cert] = locate_config_value(:node_verify_api_cert)
65
- bootstrap.config[:bootstrap_no_proxy] = locate_config_value(:bootstrap_no_proxy)
66
- bootstrap.config[:bootstrap_url] = locate_config_value(:bootstrap_url)
67
- bootstrap.config[:bootstrap_install_command] = locate_config_value(:bootstrap_install_command)
68
- bootstrap.config[:bootstrap_wget_options] = locate_config_value(:bootstrap_wget_options)
69
- bootstrap.config[:bootstrap_curl_options] = locate_config_value(:bootstrap_curl_options)
70
- bootstrap.config[:bootstrap_vault_file] = locate_config_value(:bootstrap_vault_file)
71
- bootstrap.config[:bootstrap_vault_json] = locate_config_value(:bootstrap_vault_json)
72
- bootstrap.config[:bootstrap_vault_item] = locate_config_value(:bootstrap_vault_item)
73
- bootstrap.config[:use_sudo_password] = locate_config_value(:use_sudo_password)
74
- bootstrap.config[:msi_url] = locate_config_value(:msi_url)
75
- bootstrap.config[:install_as_service] = locate_config_value(:install_as_service)
76
- bootstrap.config[:session_timeout] = locate_config_value(:session_timeout)
77
- bootstrap.config[:channel] = locate_config_value(: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) 2013-2016 Chef Software, Inc.
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] = @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"
41
- bootstrap.config[:ssh_gateway] = locate_config_value(:ssh_gateway)
42
- bootstrap.config[:forward_agent] = locate_config_value(:forward_agent)
43
- bootstrap.config[:use_sudo_password] = locate_config_value(: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 (#{@config[:bootstrap_ip_address]})", :magenta)}"
48
+ print "\n#{ui.color("Waiting for sshd to host (#{config[:bootstrap_ip_address]})", :magenta)}"
49
49
 
50
- ssh_gateway = get_ssh_gateway_for(@config[:bootstrap_ip_address])
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, @config[:bootstrap_ip_address]) do
55
- @initial_sleep_delay = !!locate_config_value(:subnet_id) ? 40 : 10
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(@config[:bootstrap_ip_address], locate_config_value(:connection_port) || Chef::Config[:knife][:ssh_port] ) do
61
- @initial_sleep_delay = !!locate_config_value(:subnet_id) ? 40 : 10
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 locate_config_value(:ssh_gateway)
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 #{locate_config_value(:ssh_gateway)} from knife config")
73
- locate_config_value(:ssh_gateway)
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
- # This happens on some mobile phone networks
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
- gateway.open(hostname, locate_config_value(:ssh_port)) do |local_tunnel_port|
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 locate_config_value(:ssh_gateway_identity)
161
- gateway_keys = Array(locate_config_value(:ssh_gateway_identity))
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?
@@ -29,7 +29,7 @@ class Chef
29
29
  attr_accessor :service, :custom_arguments
30
30
 
31
31
  def run
32
- # Set dafult config
32
+ # Set dafult config
33
33
  set_default_config
34
34
 
35
35
  # validate compulsory params
@@ -29,7 +29,7 @@ class Chef
29
29
  attr_accessor :service, :custom_arguments
30
30
 
31
31
  def run
32
- # Set dafult config
32
+ # Set dafult config
33
33
  set_default_config
34
34
 
35
35
  # validate compulsory params
@@ -1,6 +1,6 @@
1
1
  #
2
2
  # Author:: Kaustubh Deorukhkar (<kaustubh@clogeny.com>)
3
- # Copyright:: Copyright (c) 2013-2016 Chef Software, Inc.
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) 2013-2016 Chef Software, Inc.
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(options = {})
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
- # Load specific version of fog. Any other classes/modules using fog are loaded after this.
22
- gem "fog", Chef::Config[:knife][:cloud_fog_version]
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) 2013-2016 Chef Software, Inc.
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 locate_config_value(k).nil?
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) 2013-2016 Chef Software, Inc.
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(locate_config_value(:chef_node_name), locate_config_value(:chef_node_name_prefix))
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 locate_config_value(:connection_protocol) == "ssh"
41
- if locate_config_value(:ssh_identity_file).nil? && locate_config_value(:connection_password).nil?
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 locate_config_value(:connection_protocol) == "winrm"
45
- if locate_config_value(:connection_password).nil?
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
- # bootstrap the server
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) 2013-2016 Chef Software, Inc.
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) 2013-2016 Chef Software, Inc.
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) 2013-2016 Chef Software, Inc.
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| Chef::Config[:knife][:custom_attributes] = args.split(";").map { |keys| keys.split("=") }.map { |j| Hash[*j.map(&:strip)] } }
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) 2013-2016 Chef Software, Inc.
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 locate_config_value(:instance_id).nil?
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(locate_config_value(:instance_id))
43
+ server = service.get_server(config[:instance_id])
44
44
  if server.nil?
45
- error_message = "Server doesn't exists for this #{locate_config_value(:instance_id)} instance id."
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) 2013-2016 Chef Software, Inc.
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) 2013-2016 Chef Software, Inc.
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(options = {})
30
- @auth_params = options[:auth_params]
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
- Chef::Config[:knife][:custom_attributes].map { |args| args.map { |k, v| server_def.merge!(k.to_sym => v) } } unless Chef::Config[:knife][:custom_attributes].nil?
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
@@ -1,6 +1,6 @@
1
1
  module Knife
2
2
  module Cloud
3
- VERSION = "2.0.5".freeze
3
+ VERSION = "4.0.2".freeze
4
4
  MAJOR, MINOR, TINY = VERSION.split(".")
5
5
  end
6
6
  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: 2.0.5
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: 2019-12-21 00:00:00.000000000 Z
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.0'
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.0'
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.2.5
109
+ version: '2.6'
111
110
  required_rubygems_version: !ruby/object:Gem::Requirement
112
111
  requirements:
113
112
  - - ">="