knife-cloud 3.0.4 → 4.0.0

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: 6da70c3aac46f79c197680b6b6f0b7996cf89fed2ff513ca651fce9f58494d75
4
- data.tar.gz: 13835e1419477fa3791d8fc9468da494f17bede94de19f781a4fddc3b56edc9e
3
+ metadata.gz: 14967b2a6c892d13a80954bb92d7e1b8b11483841f652dac47c15083ecb8fa9a
4
+ data.tar.gz: 77f8e21894cade4f427f36edc31eedfe356d191cdcf08e937103dbeb50195699
5
5
  SHA512:
6
- metadata.gz: 4e1d88d206d25a75d323c260d6dbd0c37578a874c75b3561347da00374945345f6e53c5cb5b4d65ef1838377cb12ea5d3d9953a1300a6fc7104b44da44a1832c
7
- data.tar.gz: da72735b5f74a3ad959b51aefdc86315ecc5b1d1f6923cd01fb45b4b7c96fe0dacb4ea54f8b4be78a57f1926d6ba38168fc9a0e1cbb4d82fa691865453fbb13d
6
+ metadata.gz: 93ff890440681e628563a8c38c326d9f5a1038109a4a0dc1d70af00bef148f5bbcb480767b525395e8037a1356db323606558c9359c85a5610cb4378b023138e
7
+ data.tar.gz: c6e0dafb2549647989171894755263651630808bd1dcb5b63c18da0ef434ad32cea99f2546861ba0f410dd49551a4f81f649d4b626422555dc63e669bcb30e90
@@ -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,36 +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)
78
- bootstrap.config[:bootstrap_product] = locate_config_value(:bootstrap_product)
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]
79
79
  end
80
80
 
81
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");
@@ -34,13 +34,13 @@ class Chef
34
34
  def init_bootstrap_options
35
35
  bootstrap.config[:connection_user] = @config[:connection_user]
36
36
  bootstrap.config[:connection_password] = @config[:connection_password]
37
- bootstrap.config[:connection_port] = locate_config_value(:connection_port)
37
+ bootstrap.config[:connection_port] = config[:connection_port]
38
38
  bootstrap.config[:ssh_identity_file] = @config[:ssh_identity_file]
39
39
  bootstrap.config[:ssh_verify_host_key] = @config[:ssh_verify_host_key]
40
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)
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
 
@@ -52,13 +52,13 @@ class Chef
52
52
  # The ssh_gateway & subnet_id are currently supported only in EC2.
53
53
  if ssh_gateway
54
54
  print(".") until tunnel_test_ssh(ssh_gateway, @config[:bootstrap_ip_address]) do
55
- @initial_sleep_delay = !!locate_config_value(:subnet_id) ? 40 : 10
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
@@ -130,7 +130,7 @@ 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
+ gateway.open(hostname, config[:ssh_port]) do |local_tunnel_port|
134
134
  status = tcp_test_ssh("localhost", local_tunnel_port, &block)
135
135
  end
136
136
  status
@@ -157,8 +157,8 @@ class Chef
157
157
  gateway_keys = ssh_gateway_config[:keys]
158
158
 
159
159
  # 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))
160
+ if config[:ssh_gateway_identity]
161
+ gateway_keys = Array(config[:ssh_gateway_identity])
162
162
  end
163
163
 
164
164
  unless gateway_keys.nil?
@@ -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
21
  # Load specific version of fog-core. Any other classes/modules using fog-core are loaded after this.
22
- gem "fog-core", Chef::Config[:knife][:cloud_fog_version]
22
+ gem "fog-core", config[:cloud_fog_version]
23
23
  require "fog/core"
24
24
  Chef::Log.debug("Using fog-core version: #{Gem.loaded_specs["fog-core"].version}")
25
- rescue Exception
26
- Chef::Log.error "Error loading fog-core gem."
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
@@ -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 = "3.0.4".freeze
3
+ VERSION = "4.0.0".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: 3.0.4
4
+ version: 4.0.0
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: 2020-05-22 00:00:00.000000000 Z
12
+ date: 2020-06-05 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
@@ -106,7 +106,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
106
106
  requirements:
107
107
  - - ">="
108
108
  - !ruby/object:Gem::Version
109
- version: 2.2.5
109
+ version: '2.6'
110
110
  required_rubygems_version: !ruby/object:Gem::Requirement
111
111
  requirements:
112
112
  - - ">="