chef-config 15.1.36 → 15.2.20

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: 15cf8762e25cc78ca11a3fd7d1d1e379814f4e024677feabf462cc33148ed9aa
4
- data.tar.gz: cf678c279572b54359e996ed01efa545f7b8e0103cc7d2107cfaca5b39b97cfa
3
+ metadata.gz: cd822b0956f264dd0eea1108db04d7dbf7b0027a7611281d36c9bcb175f05b76
4
+ data.tar.gz: a301e799b27cf6f0e2d8a28baa65abf382cd72aab2b3c966a4cd8ff71dad5f5f
5
5
  SHA512:
6
- metadata.gz: 22d0fc9b59e9d100c12a6caa58bbee563efc8b2547aa91483b8f9dbc146d34230c2157645e717ca1cf726797bc8cf2a89be5cea03b0f967d2cf3fbc7bd8d1740
7
- data.tar.gz: 503712cb8b46d59660c223134b49116971c68a419ac09bb564fc9402a8732861f1fad0121076fa111760296ed04ddeb0ea5339e679edbe02d587b70381ed250c
6
+ metadata.gz: 44f600331b59e426dce352e7e82fd38025df87d980f81cacab529438aae564e2c588794fe4dc1b4d284c0550dea02334277e1b1eb6f6ac2aeef714a787f045c6
7
+ data.tar.gz: 01a2e003f89b9145669c53a2a5be365440be9567bb750293e737eb723ce4efdcb13e34e83eefa5e70f3e67805e52fb481a1232854675184d843538ef44c895f8
@@ -103,6 +103,7 @@ module ChefConfig
103
103
  if option.empty? || !option.include?("=")
104
104
  raise UnparsableConfigOption, "Unparsable config option #{option.inspect}"
105
105
  end
106
+
106
107
  # Split including whitespace if someone does truly odd like
107
108
  # --config-option "foo = bar"
108
109
  key, value = option.split(/\s*=\s*/, 2)
@@ -133,7 +134,7 @@ module ChefConfig
133
134
  # @return [Boolean] is the URL valid
134
135
  def self.is_valid_url?(uri)
135
136
  url = uri.to_s.strip
136
- /^http:\/\// =~ url || /^https:\/\// =~ url || /^chefzero:/ =~ url
137
+ %r{^http://} =~ url || %r{^https://} =~ url || /^chefzero:/ =~ url
137
138
  end
138
139
 
139
140
  # Override the config dispatch to set the value of multiple server options simultaneously
@@ -144,6 +145,7 @@ module ChefConfig
144
145
  unless is_valid_url? uri
145
146
  raise ConfigurationError, "#{uri} is an invalid chef_server_url. The URL must start with http://, https://, or chefzero://."
146
147
  end
148
+
147
149
  uri.to_s.strip
148
150
  end
149
151
 
@@ -160,7 +162,7 @@ module ChefConfig
160
162
  # etc.) work.
161
163
  default :chef_repo_path do
162
164
  if configuration[:cookbook_path]
163
- if configuration[:cookbook_path].kind_of?(String)
165
+ if configuration[:cookbook_path].is_a?(String)
164
166
  File.expand_path("..", configuration[:cookbook_path])
165
167
  else
166
168
  configuration[:cookbook_path].map do |path|
@@ -192,7 +194,7 @@ module ChefConfig
192
194
 
193
195
  # @param child_path [String]
194
196
  def self.derive_path_from_chef_repo_path(child_path)
195
- if chef_repo_path.kind_of?(String)
197
+ if chef_repo_path.is_a?(String)
196
198
  PathHelper.join(chef_repo_path, child_path)
197
199
  else
198
200
  chef_repo_path.uniq.map { |path| PathHelper.join(path, child_path) }
@@ -401,7 +403,7 @@ module ChefConfig
401
403
  default :repo_mode do
402
404
  if local_mode && !chef_zero.osc_compat
403
405
  "hosted_everything"
404
- elsif chef_server_url =~ /\/+organizations\/.+/
406
+ elsif chef_server_url =~ %r{/+organizations/.+}
405
407
  "hosted_everything"
406
408
  else
407
409
  "everything"
@@ -457,7 +459,7 @@ module ChefConfig
457
459
  default(:chef_server_root) do
458
460
  # if the chef_server_url is a path to an organization, aka
459
461
  # 'some_url.../organizations/*' then remove the '/organization/*' by default
460
- if configuration[:chef_server_url] =~ /\/organizations\/\S*$/
462
+ if configuration[:chef_server_url] =~ %r{/organizations/\S*$}
461
463
  configuration[:chef_server_url].split("/")[0..-3].join("/")
462
464
  elsif configuration[:chef_server_url] # default to whatever chef_server_url is
463
465
  configuration[:chef_server_url]
@@ -1071,8 +1073,8 @@ module ChefConfig
1071
1073
  # Check if the proxy string contains a scheme. If not, add the url's scheme to the
1072
1074
  # proxy before parsing. The regex /^.*:\/\// matches, for example, http://. Reusing proxy
1073
1075
  # here since we are really just trying to get the string built correctly.
1074
- proxy = if !proxy_env_var.empty?
1075
- if proxy_env_var =~ /^.*:\/\//
1076
+ proxy = unless proxy_env_var.empty?
1077
+ if proxy_env_var =~ %r{^.*://}
1076
1078
  URI.parse(proxy_env_var)
1077
1079
  else
1078
1080
  URI.parse("#{scheme}://#{proxy_env_var}")
@@ -21,32 +21,23 @@ module ChefConfig
21
21
  # logger for `ChefConfig.logger`
22
22
  class NullLogger
23
23
 
24
- def <<(_msg)
25
- end
24
+ def <<(_msg); end
26
25
 
27
- def add(_severity, _message = nil, _progname = nil)
28
- end
26
+ def add(_severity, _message = nil, _progname = nil); end
29
27
 
30
- def trace(_progname = nil, &block)
31
- end
28
+ def trace(_progname = nil, &block); end
32
29
 
33
- def debug(_progname = nil, &block)
34
- end
30
+ def debug(_progname = nil, &block); end
35
31
 
36
- def info(_progname = nil, &block)
37
- end
32
+ def info(_progname = nil, &block); end
38
33
 
39
- def warn(_progname = nil, &block)
40
- end
34
+ def warn(_progname = nil, &block); end
41
35
 
42
- def deprecation(_progname = nil, &block)
43
- end
36
+ def deprecation(_progname = nil, &block); end
44
37
 
45
- def error(_progname = nil, &block)
46
- end
38
+ def error(_progname = nil, &block); end
47
39
 
48
- def fatal(_progname = nil, &block)
49
- end
40
+ def fatal(_progname = nil, &block); end
50
41
 
51
42
  end
52
43
 
@@ -65,6 +65,7 @@ module ChefConfig
65
65
  def parse_credentials_file
66
66
  credentials_file = credentials_file_path
67
67
  return nil unless File.file?(credentials_file)
68
+
68
69
  begin
69
70
  Tomlrb.load_file(credentials_file)
70
71
  rescue => e
@@ -85,10 +86,12 @@ module ChefConfig
85
86
  profile = credentials_profile(profile)
86
87
  config = parse_credentials_file
87
88
  return if config.nil? # No credentials, nothing to do here.
89
+
88
90
  if config[profile].nil?
89
91
  # Unknown profile name. For "default" just silently ignore, otherwise
90
92
  # raise an error.
91
93
  return if profile == "default"
94
+
92
95
  raise ChefConfig::ConfigurationError, "Profile #{profile} doesn't exist. Please add it to #{credentials_file}."
93
96
  end
94
97
  apply_credentials(config[profile], profile)
@@ -32,7 +32,7 @@ module ChefConfig
32
32
 
33
33
  def fuzzy_hostname_match?(hostname, match)
34
34
  # Do greedy matching by adding wildcard if it is not specified
35
- match = "*" + match if !match.start_with?("*")
35
+ match = "*" + match unless match.start_with?("*")
36
36
  Fuzzyurl.matches?(Fuzzyurl.mask(hostname: match), hostname)
37
37
  end
38
38
 
@@ -63,7 +63,7 @@ module ChefConfig
63
63
  trailing_slashes = /[#{path_separator_regex}]+$/
64
64
  leading_slashes = /^[#{path_separator_regex}]+/
65
65
 
66
- args.flatten.inject() do |joined_path, component|
66
+ args.flatten.inject do |joined_path, component|
67
67
  joined_path = joined_path.sub(trailing_slashes, "")
68
68
  component = component.sub(leading_slashes, "")
69
69
  joined_path + "#{path_separator}#{component}"
@@ -21,7 +21,7 @@
21
21
 
22
22
  module ChefConfig
23
23
  CHEFCONFIG_ROOT = File.expand_path("../..", __FILE__)
24
- VERSION = "15.1.36".freeze
24
+ VERSION = "15.2.20".freeze
25
25
  end
26
26
 
27
27
  #
@@ -155,6 +155,7 @@ module ChefConfig
155
155
  if creds.key?("node_name") && creds.key?("client_name")
156
156
  raise ChefConfig::ConfigurationError, "Do not specify both node_name and client_name. You should prefer client_name."
157
157
  end
158
+
158
159
  # Load credentials data into the Chef configuration.
159
160
  creds.each do |key, value|
160
161
  case key.to_s
@@ -195,7 +195,7 @@ RSpec.describe ChefConfig::Config do
195
195
 
196
196
  [ false, true ].each do |is_windows|
197
197
 
198
- context "On #{is_windows ? 'Windows' : 'Unix'}" do
198
+ context "On #{is_windows ? "Windows" : "Unix"}" do
199
199
  def to_platform(*args)
200
200
  ChefConfig::Config.platform_specific_path(*args)
201
201
  end
@@ -618,7 +618,7 @@ RSpec.describe ChefConfig::Config do
618
618
  # On Windows, we'll detect an omnibus build and set this to the
619
619
  # cacert.pem included in the package, but it's nil if you're on Windows
620
620
  # w/o omnibus (e.g., doing development on Windows, custom build, etc.)
621
- if !is_windows
621
+ unless is_windows
622
622
  it "ChefConfig::Config[:ssl_ca_file] defaults to nil" do
623
623
  expect(ChefConfig::Config[:ssl_ca_file]).to be_nil
624
624
  end
@@ -375,7 +375,8 @@ RSpec.describe ChefConfig::WorkstationConfigLoader do
375
375
  before do
376
376
  ChefConfig::Config[:config_d_dir] = tempdir
377
377
  allow(config_loader).to receive(:path_exists?).with(
378
- an_instance_of(String)).and_return(false)
378
+ an_instance_of(String)
379
+ ).and_return(false)
379
380
  end
380
381
 
381
382
  after do
@@ -516,7 +517,7 @@ RSpec.describe ChefConfig::WorkstationConfigLoader do
516
517
  -----BEGIN RSA PRIVATE KEY-----
517
518
  foo
518
519
  EOH
519
- )
520
+ )
520
521
  end
521
522
  end
522
523
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chef-config
3
3
  version: !ruby/object:Gem::Version
4
- version: 15.1.36
4
+ version: 15.2.20
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Jacob
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-07-01 00:00:00.000000000 Z
11
+ date: 2019-08-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mixlib-shellout
@@ -158,9 +158,7 @@ files:
158
158
  - LICENSE
159
159
  - Rakefile
160
160
  - chef-config.gemspec
161
- - lib/.DS_Store
162
161
  - lib/chef-config.rb
163
- - lib/chef-config/.DS_Store
164
162
  - lib/chef-config/config.rb
165
163
  - lib/chef-config/exceptions.rb
166
164
  - lib/chef-config/fips.rb
Binary file
Binary file