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 +4 -4
- data/Gemfile +3 -3
- data/cheffish.gemspec +1 -1
- data/lib/chef/resource/chef_acl.rb +4 -4
- data/lib/chef/resource/chef_client.rb +1 -1
- data/lib/chef/resource/chef_container.rb +2 -2
- data/lib/chef/resource/chef_data_bag.rb +1 -1
- data/lib/chef/resource/chef_data_bag_item.rb +2 -2
- data/lib/chef/resource/chef_environment.rb +1 -1
- data/lib/chef/resource/chef_group.rb +1 -1
- data/lib/chef/resource/chef_mirror.rb +1 -1
- data/lib/chef/resource/chef_node.rb +1 -1
- data/lib/chef/resource/chef_organization.rb +1 -1
- data/lib/chef/resource/chef_role.rb +1 -1
- data/lib/chef/resource/private_key.rb +1 -1
- data/lib/chef/resource/public_key.rb +1 -1
- data/lib/cheffish/basic_chef_client.rb +2 -3
- data/lib/cheffish/chef_actor_base.rb +1 -1
- data/lib/cheffish/chef_run.rb +1 -1
- data/lib/cheffish/key_formatter.rb +6 -6
- data/lib/cheffish/rspec/chef_run_support.rb +1 -1
- data/lib/cheffish/rspec/recipe_run_wrapper.rb +1 -1
- data/lib/cheffish/version.rb +1 -1
- data/spec/integration/chef_acl_spec.rb +1 -1
- data/spec/integration/chef_group_spec.rb +2 -2
- data/spec/integration/chef_node_spec.rb +2 -2
- data/spec/integration/chef_role_spec.rb +2 -2
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 726a0ded80830e71581d351ec749ff293d81949a19da0402da101bcc3544a826
|
4
|
+
data.tar.gz: 998aec1220e1a3c5a1d4b23d124d913f8bc1773657a77de5981965e04c59e4d1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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",
|
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", "~>
|
18
|
-
gem "ohai", "~>
|
17
|
+
gem "chef", "~> 16"
|
18
|
+
gem "ohai", "~> 16"
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
data/cheffish.gemspec
CHANGED
@@ -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
|
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::
|
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::
|
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
|
|
@@ -25,10 +25,10 @@ class Chef
|
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
|
-
action_class
|
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::
|
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::
|
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::
|
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 || {}).
|
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::
|
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::
|
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]
|
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::
|
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::
|
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::
|
126
|
+
rescue Net::HTTPClientException => e
|
127
127
|
if e.response.code == "404"
|
128
128
|
@current_resource = not_found_resource
|
129
129
|
else
|
@@ -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
|
-
|
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::
|
122
|
+
rescue Net::HTTPClientException => e
|
123
123
|
if e.response.code == "404"
|
124
124
|
@current_resource = not_found_resource
|
125
125
|
else
|
data/lib/cheffish/chef_run.rb
CHANGED
@@ -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
|
data/lib/cheffish/version.rb
CHANGED
@@ -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::
|
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::
|
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::
|
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::
|
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::
|
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::
|
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::
|
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:
|
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-
|
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: []
|