cheffish 13.0.0 → 13.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/chef/resource/chef_acl.rb +10 -12
- data/lib/chef/resource/chef_container.rb +6 -8
- data/lib/chef/resource/chef_data_bag.rb +6 -8
- data/lib/chef/resource/chef_environment.rb +6 -8
- data/lib/chef/resource/chef_group.rb +6 -8
- data/lib/chef/resource/chef_node.rb +6 -8
- data/lib/chef/resource/chef_organization.rb +6 -8
- data/lib/chef/resource/chef_role.rb +6 -8
- data/lib/cheffish/chef_run.rb +5 -7
- data/lib/cheffish/merged_config.rb +3 -2
- data/lib/cheffish/version.rb +1 -1
- data/spec/functional/merged_config_spec.rb +11 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '009864416ce70d90ec113db22d788d8ed0eba2d5'
|
4
|
+
data.tar.gz: bb24eb7314fb2791dec51e44c6da5b4ec05cddcf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b7082e80979fc45e905a5cae7c0c97096ee9a28a72f187b46f9eb6377bfb18ba929c3112e51b7a4e7d4293790289d66bc634361cf6c317d524cabb5e9c262aae
|
7
|
+
data.tar.gz: 71527d52be685dda74fef2e4a5115a285360b9c2163c880725962fe9c276b97a9c2c0326fb0d972ae253ac6baee613c848d951619628c0f2b18521d8d02d509b
|
@@ -466,21 +466,19 @@ class Chef
|
|
466
466
|
end
|
467
467
|
|
468
468
|
def rest_list(path)
|
469
|
-
begin
|
470
469
|
# All our rest lists are hashes where the keys are the names
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
end
|
470
|
+
[ rest.get(rest_url(path)).keys, nil ]
|
471
|
+
rescue Net::HTTPServerException => e
|
472
|
+
if e.response.code == "405" || e.response.code == "404"
|
473
|
+
parts = path.split("/").select { |p| p != "" }.to_a
|
474
|
+
|
475
|
+
# We KNOW we expect these to exist. Other containers may or may not.
|
476
|
+
unless (parts.size == 1 || (parts.size == 3 && parts[0] == "organizations")) &&
|
477
|
+
%w{clients containers cookbooks data environments groups nodes roles}.include?(parts[-1])
|
478
|
+
return [ [], "Cannot get list of #{path}: HTTP response code #{e.response.code}" ]
|
481
479
|
end
|
482
|
-
raise
|
483
480
|
end
|
481
|
+
raise
|
484
482
|
end
|
485
483
|
end
|
486
484
|
|
@@ -27,14 +27,12 @@ class Chef
|
|
27
27
|
|
28
28
|
action_class.class_eval do
|
29
29
|
def load_current_resource
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
raise
|
37
|
-
end
|
30
|
+
@current_exists = rest.get("containers/#{new_resource.chef_container_name}")
|
31
|
+
rescue Net::HTTPServerException => e
|
32
|
+
if e.response.code == "404"
|
33
|
+
@current_exists = false
|
34
|
+
else
|
35
|
+
raise
|
38
36
|
end
|
39
37
|
end
|
40
38
|
|
@@ -26,14 +26,12 @@ class Chef
|
|
26
26
|
|
27
27
|
action_class.class_eval do
|
28
28
|
def load_current_resource
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
raise
|
36
|
-
end
|
29
|
+
@current_resource = json_to_resource(rest.get("data/#{new_resource.data_bag_name}"))
|
30
|
+
rescue Net::HTTPServerException => e
|
31
|
+
if e.response.code == "404"
|
32
|
+
@current_resource = not_found_resource
|
33
|
+
else
|
34
|
+
raise
|
37
35
|
end
|
38
36
|
end
|
39
37
|
|
@@ -83,14 +83,12 @@ class Chef
|
|
83
83
|
|
84
84
|
action_class.class_eval do
|
85
85
|
def load_current_resource
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
raise
|
93
|
-
end
|
86
|
+
@current_resource = json_to_resource(rest.get("environments/#{new_resource.environment_name}"))
|
87
|
+
rescue Net::HTTPServerException => e
|
88
|
+
if e.response.code == "404"
|
89
|
+
@current_resource = not_found_resource
|
90
|
+
else
|
91
|
+
raise
|
94
92
|
end
|
95
93
|
end
|
96
94
|
|
@@ -44,14 +44,12 @@ class Chef
|
|
44
44
|
|
45
45
|
action_class.class_eval do
|
46
46
|
def load_current_resource
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
raise
|
54
|
-
end
|
47
|
+
@current_resource = json_to_resource(rest.get("groups/#{new_resource.group_name}"))
|
48
|
+
rescue Net::HTTPServerException => e
|
49
|
+
if e.response.code == "404"
|
50
|
+
@current_resource = not_found_resource
|
51
|
+
else
|
52
|
+
raise
|
55
53
|
end
|
56
54
|
end
|
57
55
|
|
@@ -38,14 +38,12 @@ class Chef
|
|
38
38
|
|
39
39
|
action_class.class_eval do
|
40
40
|
def load_current_resource
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
raise
|
48
|
-
end
|
41
|
+
@current_resource = json_to_resource(rest.get("nodes/#{new_resource.name}"))
|
42
|
+
rescue Net::HTTPServerException => e
|
43
|
+
if e.response.code == "404"
|
44
|
+
@current_resource = not_found_resource
|
45
|
+
else
|
46
|
+
raise
|
49
47
|
end
|
50
48
|
end
|
51
49
|
|
@@ -129,14 +129,12 @@ class Chef
|
|
129
129
|
|
130
130
|
action_class.class_eval do
|
131
131
|
def load_current_resource
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
raise
|
139
|
-
end
|
132
|
+
@current_resource = json_to_resource(rest.get("#{rest.root_url}/organizations/#{new_resource.organization_name}"))
|
133
|
+
rescue Net::HTTPServerException => e
|
134
|
+
if e.response.code == "404"
|
135
|
+
@current_resource = not_found_resource
|
136
|
+
else
|
137
|
+
raise
|
140
138
|
end
|
141
139
|
end
|
142
140
|
|
@@ -118,14 +118,12 @@ class Chef
|
|
118
118
|
|
119
119
|
action_class.class_eval do
|
120
120
|
def load_current_resource
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
raise
|
128
|
-
end
|
121
|
+
@current_resource = json_to_resource(rest.get("roles/#{new_resource.role_name}"))
|
122
|
+
rescue Net::HTTPServerException => e
|
123
|
+
if e.response.code == "404"
|
124
|
+
@current_resource = not_found_resource
|
125
|
+
else
|
126
|
+
raise
|
129
127
|
end
|
130
128
|
end
|
131
129
|
|
data/lib/cheffish/chef_run.rb
CHANGED
@@ -86,13 +86,11 @@ module Cheffish
|
|
86
86
|
end
|
87
87
|
|
88
88
|
def converge
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
raise
|
95
|
-
end
|
89
|
+
client.converge
|
90
|
+
@converged = true
|
91
|
+
rescue RuntimeError => e
|
92
|
+
@raised_exception = e
|
93
|
+
raise
|
96
94
|
end
|
97
95
|
|
98
96
|
def reset
|
@@ -3,8 +3,8 @@ require "chef/mash"
|
|
3
3
|
module Cheffish
|
4
4
|
class MergedConfig
|
5
5
|
def initialize(*configs)
|
6
|
-
@configs = configs.map { |config|
|
7
|
-
@merge_arrays =
|
6
|
+
@configs = configs.map { |config| Mash.from_hash config.to_hash }
|
7
|
+
@merge_arrays = Mash.new
|
8
8
|
end
|
9
9
|
|
10
10
|
include Enumerable
|
@@ -48,6 +48,7 @@ module Cheffish
|
|
48
48
|
end
|
49
49
|
|
50
50
|
def method_missing(name, *args)
|
51
|
+
$stderr.puts "WARN: deprecated use of method_missing on a Cheffish::MergedConfig object at #{caller[0]}"
|
51
52
|
if args.count > 0
|
52
53
|
raise NoMethodError, "Unexpected method #{name} for MergedConfig with arguments #{args}"
|
53
54
|
else
|
data/lib/cheffish/version.rb
CHANGED
@@ -24,6 +24,13 @@ describe "merged_config" do
|
|
24
24
|
Cheffish::MergedConfig.new(c1, c2)
|
25
25
|
end
|
26
26
|
|
27
|
+
let(:nested_config) do
|
28
|
+
c1 = { :test => { :test => "val" } }
|
29
|
+
c2 = { :test => { :test2 => "val2" } }
|
30
|
+
mc = Cheffish::MergedConfig.new(c2)
|
31
|
+
Cheffish::MergedConfig.new(c1, mc)
|
32
|
+
end
|
33
|
+
|
27
34
|
it "returns value in config" do
|
28
35
|
expect(config.test).to eq("val")
|
29
36
|
end
|
@@ -57,4 +64,8 @@ describe "merged_config" do
|
|
57
64
|
it "merges values when they're hashes" do
|
58
65
|
expect(config_hashes[:test].keys).to eq(%w{test test2})
|
59
66
|
end
|
67
|
+
|
68
|
+
it "supports nested merged configs" do
|
69
|
+
expect(nested_config[:test].keys).to eq(%w{test test2})
|
70
|
+
end
|
60
71
|
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: 13.
|
4
|
+
version: 13.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Keiser
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-10-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: chef-zero
|
@@ -130,7 +130,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
130
130
|
version: '0'
|
131
131
|
requirements: []
|
132
132
|
rubyforge_project:
|
133
|
-
rubygems_version: 2.6.
|
133
|
+
rubygems_version: 2.6.13
|
134
134
|
signing_key:
|
135
135
|
specification_version: 4
|
136
136
|
summary: A library to manipulate Chef in Chef.
|