chef-api 0.9.0 → 0.10.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-api/aclable.rb +35 -0
- data/lib/chef-api/connection.rb +2 -0
- data/lib/chef-api/resource.rb +2 -0
- data/lib/chef-api/resources/client.rb +1 -0
- data/lib/chef-api/resources/data_bag.rb +1 -1
- data/lib/chef-api/resources/group.rb +16 -0
- data/lib/chef-api/resources/node.rb +9 -6
- data/lib/chef-api/resources/role.rb +1 -0
- data/lib/chef-api/version.rb +1 -1
- data/templates/errors/abstract_method.erb +5 -0
- data/templates/errors/cannot_regenerate_key.erb +1 -0
- data/templates/errors/chef_api_error.erb +1 -0
- data/templates/errors/file_not_found.erb +1 -0
- data/templates/errors/http_bad_request.erb +3 -0
- data/templates/errors/http_forbidden_request.erb +3 -0
- data/templates/errors/http_gateway_timeout.erb +3 -0
- data/templates/errors/http_method_not_allowed.erb +3 -0
- data/templates/errors/http_not_acceptable.erb +3 -0
- data/templates/errors/http_not_found.erb +3 -0
- data/templates/errors/http_server_unavailable.erb +1 -0
- data/templates/errors/http_unauthorized_request.erb +3 -0
- data/templates/errors/insufficient_file_permissions.erb +1 -0
- data/templates/errors/invalid_resource.erb +1 -0
- data/templates/errors/invalid_validator.erb +1 -0
- data/templates/errors/missing_url_parameter.erb +1 -0
- data/templates/errors/not_a_directory.erb +1 -0
- data/templates/errors/resource_already_exists.erb +1 -0
- data/templates/errors/resource_not_found.erb +1 -0
- data/templates/errors/resource_not_mutable.erb +1 -0
- data/templates/errors/unknown_attribute.erb +1 -0
- metadata +32 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eb60acbcccaaf06781a238fb0698a48492bb89a9f953d19a6fa0ba5861d26e3f
|
4
|
+
data.tar.gz: d646e7a1a4d1fae8c62f8cd107df7d2ed7fd6f2c02516b1adef0ea9c07c7bbd0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9f5050adf73f8f580274b32718524e50b813bb4a70c3c4664b182f95b759cd8f20ccd3604aaad5bb32b10a6d545e3f108d3d4fad5b482c9a08a3209ead137a7c
|
7
|
+
data.tar.gz: 9c73fc775086eddb194614d1a0094e84311aeb9d027df08aff68061a9498f9a2af8977486e3664f58311f3d9efe02d09a9bb11c3b889e47062e2427337bb7ec8
|
@@ -0,0 +1,35 @@
|
|
1
|
+
module ChefAPI
|
2
|
+
module AclAble
|
3
|
+
def acl_path
|
4
|
+
self.resource_path + '/_acl'
|
5
|
+
end
|
6
|
+
|
7
|
+
def load_acl
|
8
|
+
data = self.class.connection.get(acl_path)
|
9
|
+
# make deep copy
|
10
|
+
@orig_acl_data = Marshal.load(Marshal.dump(data))
|
11
|
+
data.freeze
|
12
|
+
@acl = data
|
13
|
+
end
|
14
|
+
|
15
|
+
def acl
|
16
|
+
unless @acl
|
17
|
+
self.load_acl
|
18
|
+
end
|
19
|
+
@acl
|
20
|
+
end
|
21
|
+
|
22
|
+
def save!
|
23
|
+
super
|
24
|
+
if @acl != @orig_acl_data
|
25
|
+
%w(create update grant read delete).each{|action|
|
26
|
+
if @acl[action] != @orig_acl_data[action]
|
27
|
+
url = "#{self.acl_path}/#{action}"
|
28
|
+
self.class.connection.put(url, {action => @acl[action]}.to_json)
|
29
|
+
end
|
30
|
+
}
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
data/lib/chef-api/connection.rb
CHANGED
@@ -40,7 +40,9 @@ module ChefAPI
|
|
40
40
|
proxy :clients, 'Resource::Client'
|
41
41
|
proxy :cookbooks, 'Resource::Cookbook'
|
42
42
|
proxy :data_bags, 'Resource::DataBag'
|
43
|
+
proxy :data_bag_item, 'Resource::DataBagItem'
|
43
44
|
proxy :environments, 'Resource::Environment'
|
45
|
+
proxy :groups, 'Resource::Group'
|
44
46
|
proxy :nodes, 'Resource::Node'
|
45
47
|
proxy :partial_search, 'Resource::PartialSearch'
|
46
48
|
proxy :principals, 'Resource::Principal'
|
data/lib/chef-api/resource.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require "chef-api/aclable"
|
1
2
|
module ChefAPI
|
2
3
|
module Resource
|
3
4
|
autoload :Base, 'chef-api/resources/base'
|
@@ -8,6 +9,7 @@ module ChefAPI
|
|
8
9
|
autoload :DataBag, 'chef-api/resources/data_bag'
|
9
10
|
autoload :DataBagItem, 'chef-api/resources/data_bag_item'
|
10
11
|
autoload :Environment, 'chef-api/resources/environment'
|
12
|
+
autoload :Group, 'chef-api/resources/group'
|
11
13
|
autoload :Node, 'chef-api/resources/node'
|
12
14
|
autoload :Organization, 'chef-api/resources/organization'
|
13
15
|
autoload :PartialSearch, 'chef-api/resources/partial_search'
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module ChefAPI
|
2
|
+
class Resource::Group < Resource::Base
|
3
|
+
collection_path '/groups'
|
4
|
+
|
5
|
+
schema do
|
6
|
+
attribute :groupname, type: String, primary: true, required: true
|
7
|
+
attribute :name, type: String
|
8
|
+
attribute :orgname, type: String
|
9
|
+
attribute :actors, type: Array, default: []
|
10
|
+
attribute :users, type: Array, default: []
|
11
|
+
attribute :clients, type: Array, default: []
|
12
|
+
attribute :groups, type: Array, default: []
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
@@ -1,14 +1,17 @@
|
|
1
1
|
module ChefAPI
|
2
2
|
class Resource::Node < Resource::Base
|
3
|
+
include ChefAPI::AclAble
|
3
4
|
collection_path '/nodes'
|
4
5
|
|
5
6
|
schema do
|
6
|
-
attribute :name,
|
7
|
-
attribute :automatic,
|
8
|
-
attribute :default,
|
9
|
-
attribute :normal,
|
10
|
-
attribute :override,
|
11
|
-
attribute :run_list,
|
7
|
+
attribute :name, type: String, primary: true, required: true
|
8
|
+
attribute :automatic, type: Hash, default: {}
|
9
|
+
attribute :default, type: Hash, default: {}
|
10
|
+
attribute :normal, type: Hash, default: {}
|
11
|
+
attribute :override, type: Hash, default: {}
|
12
|
+
attribute :run_list, type: Array, default: []
|
13
|
+
attribute :policy_name, type: String
|
14
|
+
attribute :policy_group, type: String
|
12
15
|
|
13
16
|
# Enterprise Chef attributes
|
14
17
|
attribute :chef_environment, type: String, default: '_default'
|
data/lib/chef-api/version.rb
CHANGED
@@ -0,0 +1,5 @@
|
|
1
|
+
'<%= @method %>' is an abstract method. You must override this method in your subclass with the proper implementation and logic. For more information, please see the inline documentation for <%= @method %>. If you are not a developer, this is most likely a bug in the ChefAPI gem. Please file a bug report at:
|
2
|
+
|
3
|
+
https://github.com/sethvargo/chef-api/issues/new
|
4
|
+
|
5
|
+
and include the command(s) or code you ran to arrive at this error.
|
@@ -0,0 +1 @@
|
|
1
|
+
You attempted to regenerate the private key for a Client or User that does not yet exist on the remote Chef Server. You can only regenerate the key for an object that is persisted. Try saving this record this object before regenerating the key.
|
@@ -0,0 +1 @@
|
|
1
|
+
Oh no! Something really bad happened. I am not sure what actually happened because this is the catch-all error, but you should most definitely report an issue on GitHub at https://github.com/sethvargo/chef-api.
|
@@ -0,0 +1 @@
|
|
1
|
+
I could not find a file at '<%= @path %>'. Please make sure you have typed the path correctly and that the resource exists at the given path.
|
@@ -0,0 +1 @@
|
|
1
|
+
The Chef Server is currently unavailable or is not currently accepting client connections. Please ensure the server is accessible via ping or telnet on your local network. If this error persists, please contact your network administrator.
|
@@ -0,0 +1 @@
|
|
1
|
+
I cannot read the file at '<%= @path %>' because the permissions on the file do not permit it. Please ensure the file has the correct permissions and that this Ruby process is running as a user with access to that path.
|
@@ -0,0 +1 @@
|
|
1
|
+
There were errors saving your resource: <%= @errors %>
|
@@ -0,0 +1 @@
|
|
1
|
+
'<%= @key %>' is not a valid validator. Please make sure it is spelled correctly and that the constant is properly defined. If you are using a custom validator, please ensure the validator extends ChefAPI::Validator::Base and is a subclass of ChefAPI::Validator.
|
@@ -0,0 +1 @@
|
|
1
|
+
The required URL parameter '<%= @param %>' was not present. Please specify the parameter as an option, like Resource.new(id, <%= @param %>: 'value').
|
@@ -0,0 +1 @@
|
|
1
|
+
The given path '<%= @path %>' is not a directory. Please make sure you have passed the path to a directory on disk.
|
@@ -0,0 +1 @@
|
|
1
|
+
The <%= @type %> '<%= @id %>' already exists on the Chef Server. Each <%= @type %> must have a unique identifier and the Chef Server indicated this <%= @type %> already exists. If you are trying to update the <%= @type %>, consider using the 'update' method instead.
|
@@ -0,0 +1 @@
|
|
1
|
+
There is no <%= @type %> with an id of '<%= @id %>' on the Chef Server. If you are updating the <%= @type %>, please make sure the <%= @type %> exists and has the correct Chef identifier (primary key).
|
@@ -0,0 +1 @@
|
|
1
|
+
The <%= @type %> '<%= @id %>' is not mutable. It may be locked by the remote Chef Server, or the Chef Server may not permit modifying the resource.
|
@@ -0,0 +1 @@
|
|
1
|
+
'<%= @attribute %>' is not a valid attribute!
|
metadata
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chef-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Seth Vargo
|
8
|
+
- Tim Smith
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date:
|
12
|
+
date: 2019-10-18 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: logify
|
@@ -38,15 +39,17 @@ dependencies:
|
|
38
39
|
- - ">="
|
39
40
|
- !ruby/object:Gem::Version
|
40
41
|
version: '0'
|
41
|
-
description: A tiny Chef API client with minimal dependencies
|
42
|
+
description: A tiny Chef Infra API client with minimal dependencies
|
42
43
|
email:
|
43
44
|
- sethvargo@gmail.com
|
45
|
+
- tsmith84@gmail.com
|
44
46
|
executables: []
|
45
47
|
extensions: []
|
46
48
|
extra_rdoc_files: []
|
47
49
|
files:
|
48
50
|
- LICENSE
|
49
51
|
- lib/chef-api.rb
|
52
|
+
- lib/chef-api/aclable.rb
|
50
53
|
- lib/chef-api/authentication.rb
|
51
54
|
- lib/chef-api/boolean.rb
|
52
55
|
- lib/chef-api/configurable.rb
|
@@ -64,6 +67,7 @@ files:
|
|
64
67
|
- lib/chef-api/resources/data_bag.rb
|
65
68
|
- lib/chef-api/resources/data_bag_item.rb
|
66
69
|
- lib/chef-api/resources/environment.rb
|
70
|
+
- lib/chef-api/resources/group.rb
|
67
71
|
- lib/chef-api/resources/node.rb
|
68
72
|
- lib/chef-api/resources/organization.rb
|
69
73
|
- lib/chef-api/resources/partial_search.rb
|
@@ -78,7 +82,28 @@ files:
|
|
78
82
|
- lib/chef-api/validators/required.rb
|
79
83
|
- lib/chef-api/validators/type.rb
|
80
84
|
- lib/chef-api/version.rb
|
81
|
-
|
85
|
+
- templates/errors/abstract_method.erb
|
86
|
+
- templates/errors/cannot_regenerate_key.erb
|
87
|
+
- templates/errors/chef_api_error.erb
|
88
|
+
- templates/errors/file_not_found.erb
|
89
|
+
- templates/errors/http_bad_request.erb
|
90
|
+
- templates/errors/http_forbidden_request.erb
|
91
|
+
- templates/errors/http_gateway_timeout.erb
|
92
|
+
- templates/errors/http_method_not_allowed.erb
|
93
|
+
- templates/errors/http_not_acceptable.erb
|
94
|
+
- templates/errors/http_not_found.erb
|
95
|
+
- templates/errors/http_server_unavailable.erb
|
96
|
+
- templates/errors/http_unauthorized_request.erb
|
97
|
+
- templates/errors/insufficient_file_permissions.erb
|
98
|
+
- templates/errors/invalid_resource.erb
|
99
|
+
- templates/errors/invalid_validator.erb
|
100
|
+
- templates/errors/missing_url_parameter.erb
|
101
|
+
- templates/errors/not_a_directory.erb
|
102
|
+
- templates/errors/resource_already_exists.erb
|
103
|
+
- templates/errors/resource_not_found.erb
|
104
|
+
- templates/errors/resource_not_mutable.erb
|
105
|
+
- templates/errors/unknown_attribute.erb
|
106
|
+
homepage: https://github.com/chef/chef-api
|
82
107
|
licenses:
|
83
108
|
- Apache-2.0
|
84
109
|
metadata: {}
|
@@ -90,16 +115,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
90
115
|
requirements:
|
91
116
|
- - ">="
|
92
117
|
- !ruby/object:Gem::Version
|
93
|
-
version: '2.
|
118
|
+
version: '2.3'
|
94
119
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
95
120
|
requirements:
|
96
121
|
- - ">="
|
97
122
|
- !ruby/object:Gem::Version
|
98
123
|
version: '0'
|
99
124
|
requirements: []
|
100
|
-
|
101
|
-
rubygems_version: 2.7.8
|
125
|
+
rubygems_version: 3.0.3
|
102
126
|
signing_key:
|
103
127
|
specification_version: 4
|
104
|
-
summary: A Chef API client in Ruby
|
128
|
+
summary: A Chef Infra API client in Ruby
|
105
129
|
test_files: []
|