cheffish 15.0.3 → 16.0.12

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: 547830e01071a34cc583bbf5217ae5f55270c014c393e9a69301023a88717279
4
- data.tar.gz: a29005438abb411a4b59bc7b1cf1782e36219e2bd951ec49c64273f9a7de6144
3
+ metadata.gz: 726a0ded80830e71581d351ec749ff293d81949a19da0402da101bcc3544a826
4
+ data.tar.gz: 998aec1220e1a3c5a1d4b23d124d913f8bc1773657a77de5981965e04c59e4d1
5
5
  SHA512:
6
- metadata.gz: 6db5d7117bb249b37d894d3b3e776f7d3b5e8c87cb2895e156fbe4393031dbfdfdcff8a9133b4bb7e578f85440905a5acbd30426e7a8d81171ac3fd44f583936
7
- data.tar.gz: 2216df827dc0635fdf0e3a340a80dbf267c8c51f58d7bde7c2a7deb28f0b3eeb24975bc88e3c44809c12189c05751a8624285d90a7472ace2bbb6b69dd99542d
6
+ metadata.gz: debed5adc595ef207988ad3d63249803ea2dfca46848f1e93e62fc80b5abd22efaa299077e0594a9c93555ba385da8fd5a2dda9c8688f6ff4b6ba96c725924b6
7
+ data.tar.gz: 7ba6a0b11beccce010665ef0239634b4549b2d19b2d6569d179ed2cbcf894bacfae3e5a45f44a70865971bd2bf183ade6a9b54e0dc3cc470e76c96bf6abd43b5
data/Gemfile CHANGED
@@ -3,7 +3,7 @@ source "https://rubygems.org"
3
3
  gemspec
4
4
 
5
5
  group :development do
6
- gem "chefstyle", git: "https://github.com/chef/chefstyle.git", branch: "master"
6
+ gem "chefstyle", "1.4.3"
7
7
  gem "rake"
8
8
  gem "rspec", "~> 3.0"
9
9
  end
@@ -14,8 +14,8 @@ if ENV["GEMFILE_MOD"]
14
14
  instance_eval(ENV["GEMFILE_MOD"])
15
15
  else
16
16
  group :development do
17
- gem "chef", "~> 15"
18
- gem "ohai", "~> 15"
17
+ gem "chef", "~> 16"
18
+ gem "ohai", "~> 16"
19
19
  end
20
20
  end
21
21
 
@@ -6,7 +6,7 @@ Gem::Specification.new do |s|
6
6
  s.version = Cheffish::VERSION
7
7
  s.platform = Gem::Platform::RUBY
8
8
  s.license = "Apache-2.0"
9
- s.summary = "A set of Chef resources for configuring Chef."
9
+ s.summary = "A set of Chef resources for configuring Chef Infra."
10
10
  s.description = s.summary
11
11
  s.author = "Chef Software Inc."
12
12
  s.email = "oss@chef.io"
@@ -2,7 +2,7 @@ require_relative "../../cheffish"
2
2
  require_relative "../../cheffish/base_resource"
3
3
  require "chef/chef_fs/data_handler/acl_data_handler"
4
4
  require "chef/chef_fs/parallelizer"
5
- require "uri"
5
+ require "uri" unless defined?(URI)
6
6
 
7
7
  class Chef
8
8
  class Resource
@@ -75,7 +75,7 @@ class Chef
75
75
  end
76
76
  end
77
77
 
78
- action_class.class_eval do
78
+ action_class do
79
79
  # Update the ACL if necessary.
80
80
  def create_acl(path)
81
81
  changed = false
@@ -147,7 +147,7 @@ class Chef
147
147
  unless @current_acls.key?(acl_path)
148
148
  @current_acls[acl_path] = begin
149
149
  rest.get(rest_url(acl_path))
150
- rescue Net::HTTPServerException => e
150
+ rescue Net::HTTPClientException => e
151
151
  unless e.response.code == "404" && new_resource.path.split("/").any? { |p| p == "*" }
152
152
  raise
153
153
  end
@@ -471,7 +471,7 @@ class Chef
471
471
  def rest_list(path)
472
472
  # All our rest lists are hashes where the keys are the names
473
473
  [ rest.get(rest_url(path)).keys, nil ]
474
- rescue Net::HTTPServerException => e
474
+ rescue Net::HTTPClientException => e
475
475
  if e.response.code == "405" || e.response.code == "404"
476
476
  parts = path.split("/").select { |p| p != "" }.to_a
477
477
 
@@ -38,7 +38,7 @@ class Chef
38
38
  delete_actor
39
39
  end
40
40
 
41
- action_class.class_eval do
41
+ action_class do
42
42
  def actor_type
43
43
  "client"
44
44
  end
@@ -25,10 +25,10 @@ class Chef
25
25
  end
26
26
  end
27
27
 
28
- action_class.class_eval do
28
+ action_class do
29
29
  def load_current_resource
30
30
  @current_exists = rest.get("containers/#{new_resource.chef_container_name}")
31
- rescue Net::HTTPServerException => e
31
+ rescue Net::HTTPClientException => e
32
32
  if e.response.code == "404"
33
33
  @current_exists = false
34
34
  else
@@ -27,7 +27,7 @@ class Chef
27
27
  action_class.class_eval do
28
28
  def load_current_resource
29
29
  @current_resource = json_to_resource(rest.get("data/#{new_resource.data_bag_name}"))
30
- rescue Net::HTTPServerException => e
30
+ rescue Net::HTTPClientException => e
31
31
  if e.response.code == "404"
32
32
  @current_resource = not_found_resource
33
33
  else
@@ -103,7 +103,7 @@ class Chef
103
103
  resource = Chef::Resource::ChefDataBagItem.new(new_resource.name, run_context)
104
104
  resource.raw_data json
105
105
  @current_resource = resource
106
- rescue Net::HTTPServerException => e
106
+ rescue Net::HTTPClientException => e
107
107
  if e.response.code == "404"
108
108
  @current_resource = not_found_resource
109
109
  else
@@ -112,7 +112,7 @@ class Chef
112
112
  end
113
113
 
114
114
  # Determine if data bag is encrypted and if so, what its version is
115
- _first_real_key, first_real_value = (current_resource.raw_data || {}).select { |key, value| key != "id" && !value.nil? }.first
115
+ _first_real_key, first_real_value = (current_resource.raw_data || {}).find { |key, value| key != "id" && !value.nil? }
116
116
  if first_real_value
117
117
  if first_real_value.is_a?(Hash) &&
118
118
  first_real_value["version"].is_a?(Integer) &&
@@ -84,7 +84,7 @@ class Chef
84
84
  action_class.class_eval do
85
85
  def load_current_resource
86
86
  @current_resource = json_to_resource(rest.get("environments/#{new_resource.environment_name}"))
87
- rescue Net::HTTPServerException => e
87
+ rescue Net::HTTPClientException => e
88
88
  if e.response.code == "404"
89
89
  @current_resource = not_found_resource
90
90
  else
@@ -45,7 +45,7 @@ class Chef
45
45
  action_class.class_eval do
46
46
  def load_current_resource
47
47
  @current_resource = json_to_resource(rest.get("groups/#{new_resource.group_name}"))
48
- rescue Net::HTTPServerException => e
48
+ rescue Net::HTTPClientException => e
49
49
  if e.response.code == "404"
50
50
  @current_resource = not_found_resource
51
51
  else
@@ -165,7 +165,7 @@ class Chef
165
165
  end
166
166
 
167
167
  def repo_mode
168
- new_resource.chef_server[:chef_server_url] =~ %r{/organizations/} ? "hosted_everything" : "everything"
168
+ %r{/organizations/}.match?(new_resource.chef_server[:chef_server_url]) ? "hosted_everything" : "everything"
169
169
  end
170
170
 
171
171
  def options
@@ -39,7 +39,7 @@ class Chef
39
39
  action_class.class_eval do
40
40
  def load_current_resource
41
41
  @current_resource = json_to_resource(rest.get("nodes/#{new_resource.name}"))
42
- rescue Net::HTTPServerException => e
42
+ rescue Net::HTTPClientException => e
43
43
  if e.response.code == "404"
44
44
  @current_resource = not_found_resource
45
45
  else
@@ -130,7 +130,7 @@ class Chef
130
130
  action_class.class_eval do
131
131
  def load_current_resource
132
132
  @current_resource = json_to_resource(rest.get("#{rest.root_url}/organizations/#{new_resource.organization_name}"))
133
- rescue Net::HTTPServerException => e
133
+ rescue Net::HTTPClientException => e
134
134
  if e.response.code == "404"
135
135
  @current_resource = not_found_resource
136
136
  else
@@ -123,7 +123,7 @@ class Chef
123
123
  action_class.class_eval do
124
124
  def load_current_resource
125
125
  @current_resource = json_to_resource(rest.get("roles/#{new_resource.role_name}"))
126
- rescue Net::HTTPServerException => e
126
+ rescue Net::HTTPClientException => e
127
127
  if e.response.code == "404"
128
128
  @current_resource = not_found_resource
129
129
  else
@@ -1,6 +1,6 @@
1
1
  require "openssl/cipher"
2
2
  require_relative "../../cheffish/base_resource"
3
- require "openssl"
3
+ require "openssl" unless defined?(OpenSSL)
4
4
  require_relative "../../cheffish/key_formatter"
5
5
 
6
6
  class Chef
@@ -1,6 +1,6 @@
1
1
  require "openssl/cipher"
2
2
  require_relative "../../cheffish/base_resource"
3
- require "openssl"
3
+ require "openssl" unless defined?(OpenSSL)
4
4
  require_relative "../../cheffish/key_formatter"
5
5
 
6
6
  class Chef
@@ -5,7 +5,7 @@ require "chef/event_dispatch/dispatcher"
5
5
  require "chef/node"
6
6
  require "chef/run_context"
7
7
  require "chef/runner"
8
- require "forwardable"
8
+ require "forwardable" unless defined?(Forwardable)
9
9
  require "chef/providers"
10
10
  require "chef/resources"
11
11
 
@@ -80,12 +80,11 @@ module Cheffish
80
80
  # add_resource() method.
81
81
  def self.build_resource(type, name, created_at = nil, &resource_attrs_block)
82
82
  created_at ||= caller[0]
83
- result = BasicChefClient.new.tap do |client|
83
+ BasicChefClient.new.tap do |client|
84
84
  client.with_chef_config do
85
85
  client.build_resource(type, name, created_at, &resource_attrs_block)
86
86
  end
87
87
  end
88
- result
89
88
  end
90
89
 
91
90
  def self.inline_resource(provider, provider_action, *resources, &block)
@@ -119,7 +119,7 @@ module Cheffish
119
119
  begin
120
120
  json = rest.get("#{actor_path}/#{new_resource.name}")
121
121
  @current_resource = json_to_resource(json)
122
- rescue Net::HTTPServerException => e
122
+ rescue Net::HTTPClientException => e
123
123
  if e.response.code == "404"
124
124
  @current_resource = not_found_resource
125
125
  else
@@ -41,7 +41,7 @@ module Cheffish
41
41
  chef_config[:log_location] = StringIOTee.new(chef_config[:log_location])
42
42
  @client = ::Cheffish::BasicChefClient.new(nil,
43
43
  [ event_sink, Chef::Formatters.new(:doc, chef_config[:stdout], chef_config[:stderr]) ],
44
- chef_config)
44
+ **chef_config)
45
45
  end
46
46
  end
47
47
 
@@ -1,9 +1,9 @@
1
- require "openssl"
2
- require "net/ssh"
3
- require "etc"
4
- require "socket"
5
- require "digest/md5"
6
- require "base64"
1
+ require "openssl" unless defined?(OpenSSL)
2
+ require "net/ssh" unless defined?(Net::SSH)
3
+ require "etc" unless defined?(Etc)
4
+ require "socket" unless defined?(Socket)
5
+ require "digest/md5" unless defined?(Digest::MD5)
6
+ require "base64" unless defined?(Base64)
7
7
 
8
8
  module Cheffish
9
9
  class KeyFormatter
@@ -1,7 +1,7 @@
1
1
  require "chef_zero/rspec"
2
2
  require "chef/server_api"
3
3
  require_relative "repository_support"
4
- require "uri"
4
+ require "uri" unless defined?(URI)
5
5
  require_relative "../chef_run"
6
6
  require_relative "recipe_run_wrapper"
7
7
  require_relative "matchers"
@@ -1,5 +1,5 @@
1
1
  require_relative "../chef_run"
2
- require "forwardable"
2
+ require "forwardable" unless defined?(Forwardable)
3
3
 
4
4
  module Cheffish
5
5
  module RSpec
@@ -1,3 +1,3 @@
1
1
  module Cheffish
2
- VERSION = "15.0.3".freeze
2
+ VERSION = "16.0.12".freeze
3
3
  end
@@ -191,7 +191,7 @@ if Gem::Version.new(ChefZero::VERSION) >= Gem::Version.new("3.1")
191
191
  it 'Converging chef_acl "nodes/y" throws a 404' do
192
192
  expect_converge do
193
193
  chef_acl "nodes/y"
194
- end.to raise_error(Net::HTTPServerException)
194
+ end.to raise_error(Net::HTTPClientException)
195
195
  end
196
196
  end
197
197
 
@@ -37,7 +37,7 @@ describe Chef::Resource::ChefGroup do
37
37
  action :delete
38
38
  end
39
39
  end.to not_have_updated("chef_group[x]", :delete).and not_have_updated("chef_group[x]", :create)
40
- expect { get("groups/x") }.to raise_error(Net::HTTPServerException)
40
+ expect { get("groups/x") }.to raise_error(Net::HTTPClientException)
41
41
  end
42
42
 
43
43
  it 'Converging chef_group "x" creates the group with the given members' do
@@ -101,7 +101,7 @@ describe Chef::Resource::ChefGroup do
101
101
  action :delete
102
102
  end
103
103
  end.to have_updated("chef_group[x]", :delete)
104
- expect { get("groups/x") }.to raise_error(Net::HTTPServerException)
104
+ expect { get("groups/x") }.to raise_error(Net::HTTPClientException)
105
105
  end
106
106
 
107
107
  it 'Converging chef_group "x" with existing users changes nothing' do
@@ -40,7 +40,7 @@ describe Chef::Resource::ChefNode do
40
40
  with_chef_server "http://127.0.0.1:8899"
41
41
  chef_node "blah"
42
42
  end.to have_updated "chef_node[blah]", :create
43
- expect { get("nodes/blah") }.to raise_error(Net::HTTPServerException)
43
+ expect { get("nodes/blah") }.to raise_error(Net::HTTPClientException)
44
44
  expect(get("http://127.0.0.1:8899/nodes/blah")["name"]).to eq("blah")
45
45
  end
46
46
  end
@@ -53,7 +53,7 @@ describe Chef::Resource::ChefNode do
53
53
  chef_server({ chef_server_url: "http://127.0.0.1:8899" })
54
54
  end
55
55
  end.to have_updated "chef_node[blah]", :create
56
- expect { get("nodes/blah") }.to raise_error(Net::HTTPServerException)
56
+ expect { get("nodes/blah") }.to raise_error(Net::HTTPClientException)
57
57
  expect(get("http://127.0.0.1:8899/nodes/blah")["name"]).to eq("blah")
58
58
  end
59
59
  end
@@ -40,7 +40,7 @@ describe Chef::Resource::ChefRole do
40
40
  with_chef_server "http://127.0.0.1:8899"
41
41
  chef_role "blah"
42
42
  end.to have_updated "chef_role[blah]", :create
43
- expect { get("roles/blah") }.to raise_error(Net::HTTPServerException)
43
+ expect { get("roles/blah") }.to raise_error(Net::HTTPClientException)
44
44
  expect(get("http://127.0.0.1:8899/roles/blah")["name"]).to eq("blah")
45
45
  end
46
46
  end
@@ -53,7 +53,7 @@ describe Chef::Resource::ChefRole do
53
53
  chef_server({ chef_server_url: "http://127.0.0.1:8899" })
54
54
  end
55
55
  end.to have_updated "chef_role[blah]", :create
56
- expect { get("roles/blah") }.to raise_error(Net::HTTPServerException)
56
+ expect { get("roles/blah") }.to raise_error(Net::HTTPClientException)
57
57
  expect(get("http://127.0.0.1:8899/roles/blah")["name"]).to eq("blah")
58
58
  end
59
59
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cheffish
3
3
  version: !ruby/object:Gem::Version
4
- version: 15.0.3
4
+ version: 16.0.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chef Software Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-05-13 00:00:00.000000000 Z
11
+ date: 2020-09-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chef-zero
@@ -38,7 +38,7 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
- description: A set of Chef resources for configuring Chef.
41
+ description: A set of Chef resources for configuring Chef Infra.
42
42
  email: oss@chef.io
43
43
  executables: []
44
44
  extensions: []
@@ -130,5 +130,5 @@ requirements: []
130
130
  rubygems_version: 3.0.3
131
131
  signing_key:
132
132
  specification_version: 4
133
- summary: A set of Chef resources for configuring Chef.
133
+ summary: A set of Chef resources for configuring Chef Infra.
134
134
  test_files: []