clc-cheffish 0.8.clc
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/LICENSE +201 -0
- data/README.md +4 -0
- data/Rakefile +23 -0
- data/lib/chef/provider/chef_acl.rb +434 -0
- data/lib/chef/provider/chef_client.rb +48 -0
- data/lib/chef/provider/chef_container.rb +50 -0
- data/lib/chef/provider/chef_data_bag.rb +50 -0
- data/lib/chef/provider/chef_data_bag_item.rb +273 -0
- data/lib/chef/provider/chef_environment.rb +78 -0
- data/lib/chef/provider/chef_group.rb +78 -0
- data/lib/chef/provider/chef_mirror.rb +138 -0
- data/lib/chef/provider/chef_node.rb +82 -0
- data/lib/chef/provider/chef_organization.rb +150 -0
- data/lib/chef/provider/chef_resolved_cookbooks.rb +41 -0
- data/lib/chef/provider/chef_role.rb +79 -0
- data/lib/chef/provider/chef_user.rb +53 -0
- data/lib/chef/provider/private_key.rb +219 -0
- data/lib/chef/provider/public_key.rb +82 -0
- data/lib/chef/resource/chef_acl.rb +65 -0
- data/lib/chef/resource/chef_client.rb +44 -0
- data/lib/chef/resource/chef_container.rb +18 -0
- data/lib/chef/resource/chef_data_bag.rb +18 -0
- data/lib/chef/resource/chef_data_bag_item.rb +114 -0
- data/lib/chef/resource/chef_environment.rb +71 -0
- data/lib/chef/resource/chef_group.rb +49 -0
- data/lib/chef/resource/chef_mirror.rb +47 -0
- data/lib/chef/resource/chef_node.rb +18 -0
- data/lib/chef/resource/chef_organization.rb +64 -0
- data/lib/chef/resource/chef_resolved_cookbooks.rb +31 -0
- data/lib/chef/resource/chef_role.rb +104 -0
- data/lib/chef/resource/chef_user.rb +51 -0
- data/lib/chef/resource/private_key.rb +44 -0
- data/lib/chef/resource/public_key.rb +21 -0
- data/lib/cheffish.rb +222 -0
- data/lib/cheffish/actor_provider_base.rb +131 -0
- data/lib/cheffish/basic_chef_client.rb +115 -0
- data/lib/cheffish/chef_provider_base.rb +231 -0
- data/lib/cheffish/chef_run_data.rb +19 -0
- data/lib/cheffish/chef_run_listener.rb +28 -0
- data/lib/cheffish/key_formatter.rb +109 -0
- data/lib/cheffish/merged_config.rb +94 -0
- data/lib/cheffish/recipe_dsl.rb +147 -0
- data/lib/cheffish/server_api.rb +52 -0
- data/lib/cheffish/version.rb +3 -0
- data/lib/cheffish/with_pattern.rb +21 -0
- data/spec/functional/fingerprint_spec.rb +64 -0
- data/spec/functional/merged_config_spec.rb +20 -0
- data/spec/integration/chef_acl_spec.rb +914 -0
- data/spec/integration/chef_client_spec.rb +110 -0
- data/spec/integration/chef_container_spec.rb +34 -0
- data/spec/integration/chef_group_spec.rb +324 -0
- data/spec/integration/chef_mirror_spec.rb +244 -0
- data/spec/integration/chef_node_spec.rb +211 -0
- data/spec/integration/chef_organization_spec.rb +244 -0
- data/spec/integration/chef_user_spec.rb +90 -0
- data/spec/integration/private_key_spec.rb +446 -0
- data/spec/integration/recipe_dsl_spec.rb +29 -0
- data/spec/support/key_support.rb +29 -0
- data/spec/support/repository_support.rb +103 -0
- data/spec/support/spec_support.rb +176 -0
- data/spec/unit/get_private_key_spec.rb +93 -0
- metadata +162 -0
@@ -0,0 +1,65 @@
|
|
1
|
+
require 'cheffish'
|
2
|
+
require 'chef/resource/lwrp_base'
|
3
|
+
|
4
|
+
class Chef::Resource::ChefAcl < Chef::Resource::LWRPBase
|
5
|
+
self.resource_name = 'chef_acl'
|
6
|
+
|
7
|
+
actions :create, :nothing
|
8
|
+
default_action :create
|
9
|
+
|
10
|
+
def initialize(*args)
|
11
|
+
super
|
12
|
+
chef_server run_context.cheffish.current_chef_server
|
13
|
+
end
|
14
|
+
|
15
|
+
# Path of the thing being secured, e.g. nodes, nodes/*, nodes/mynode,
|
16
|
+
# */*, **, roles/base, data/secrets, cookbooks/apache2, /users/*,
|
17
|
+
# /organizations/foo/nodes/x
|
18
|
+
attribute :path, :kind_of => String, :name_attribute => true
|
19
|
+
|
20
|
+
# Whether to change things recursively. true means it will descend all children
|
21
|
+
# and make the same modifications to them. :on_change will only descend if
|
22
|
+
# the parent has changed. :on_change is the default.
|
23
|
+
attribute :recursive, :equal_to => [ true, false, :on_change ], :default => :on_change
|
24
|
+
|
25
|
+
# Specifies that this is a complete specification for the acl (i.e. rights
|
26
|
+
# you don't specify will be reset to their defaults)
|
27
|
+
attribute :complete, :kind_of => [TrueClass, FalseClass]
|
28
|
+
|
29
|
+
attribute :raw_json, :kind_of => Hash
|
30
|
+
attribute :chef_server, :kind_of => Hash
|
31
|
+
|
32
|
+
# rights :read, :users => 'jkeiser', :groups => [ 'admins', 'users' ]
|
33
|
+
# rights [ :create, :read ], :users => [ 'jkeiser', 'adam' ]
|
34
|
+
# rights :all, :users => 'jkeiser'
|
35
|
+
def rights(*values)
|
36
|
+
if values.size == 0
|
37
|
+
@rights
|
38
|
+
else
|
39
|
+
args = values.pop
|
40
|
+
args[:permissions] ||= []
|
41
|
+
values.each do |value|
|
42
|
+
args[:permissions] |= Array(value)
|
43
|
+
end
|
44
|
+
@rights ||= []
|
45
|
+
@rights << args
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
# remove_rights :read, :users => 'jkeiser', :groups => [ 'admins', 'users' ]
|
50
|
+
# remove_rights [ :create, :read ], :users => [ 'jkeiser', 'adam' ]
|
51
|
+
# remove_rights :all, :users => [ 'jkeiser', 'adam' ]
|
52
|
+
def remove_rights(*values)
|
53
|
+
if values.size == 0
|
54
|
+
@remove_rights
|
55
|
+
else
|
56
|
+
args = values.pop
|
57
|
+
args[:permissions] ||= []
|
58
|
+
values.each do |value|
|
59
|
+
args[:permissions] |= Array(value)
|
60
|
+
end
|
61
|
+
@remove_rights ||= []
|
62
|
+
@remove_rights << args
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'cheffish'
|
2
|
+
require 'chef/resource/lwrp_base'
|
3
|
+
|
4
|
+
class Chef::Resource::ChefClient < Chef::Resource::LWRPBase
|
5
|
+
self.resource_name = 'chef_client'
|
6
|
+
|
7
|
+
actions :create, :delete, :regenerate_keys, :nothing
|
8
|
+
default_action :create
|
9
|
+
|
10
|
+
def initialize(*args)
|
11
|
+
super
|
12
|
+
chef_server run_context.cheffish.current_chef_server
|
13
|
+
end
|
14
|
+
|
15
|
+
# Client attributes
|
16
|
+
attribute :name, :kind_of => String, :regex => Cheffish::NAME_REGEX, :name_attribute => true
|
17
|
+
attribute :admin, :kind_of => [TrueClass, FalseClass]
|
18
|
+
attribute :validator, :kind_of => [TrueClass, FalseClass]
|
19
|
+
|
20
|
+
# Input key
|
21
|
+
attribute :source_key # String or OpenSSL::PKey::*
|
22
|
+
attribute :source_key_path, :kind_of => String
|
23
|
+
attribute :source_key_pass_phrase
|
24
|
+
|
25
|
+
# Output public key (if so desired)
|
26
|
+
attribute :output_key_path, :kind_of => String
|
27
|
+
attribute :output_key_format, :kind_of => Symbol, :default => :openssh, :equal_to => [ :pem, :der, :openssh ]
|
28
|
+
|
29
|
+
# If this is set, client is not patchy
|
30
|
+
attribute :complete, :kind_of => [TrueClass, FalseClass]
|
31
|
+
|
32
|
+
attribute :raw_json, :kind_of => Hash
|
33
|
+
attribute :chef_server, :kind_of => Hash
|
34
|
+
|
35
|
+
# Proc that runs just before the resource executes. Called with (resource)
|
36
|
+
def before(&block)
|
37
|
+
block ? @before = block : @before
|
38
|
+
end
|
39
|
+
|
40
|
+
# Proc that runs after the resource completes. Called with (resource, json, private_key, public_key)
|
41
|
+
def after(&block)
|
42
|
+
block ? @after = block : @after
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'cheffish'
|
2
|
+
require 'chef/resource/lwrp_base'
|
3
|
+
|
4
|
+
class Chef::Resource::ChefContainer < Chef::Resource::LWRPBase
|
5
|
+
self.resource_name = 'chef_container'
|
6
|
+
|
7
|
+
actions :create, :delete, :nothing
|
8
|
+
default_action :create
|
9
|
+
|
10
|
+
# Grab environment from with_environment
|
11
|
+
def initialize(*args)
|
12
|
+
super
|
13
|
+
chef_server run_context.cheffish.current_chef_server
|
14
|
+
end
|
15
|
+
|
16
|
+
attribute :name, :kind_of => String, :regex => Cheffish::NAME_REGEX, :name_attribute => true
|
17
|
+
attribute :chef_server, :kind_of => Hash
|
18
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'cheffish'
|
2
|
+
require 'chef/resource/lwrp_base'
|
3
|
+
|
4
|
+
class Chef::Resource::ChefDataBag < Chef::Resource::LWRPBase
|
5
|
+
self.resource_name = 'chef_data_bag'
|
6
|
+
|
7
|
+
actions :create, :delete, :nothing
|
8
|
+
default_action :create
|
9
|
+
|
10
|
+
def initialize(*args)
|
11
|
+
super
|
12
|
+
chef_server run_context.cheffish.current_chef_server
|
13
|
+
end
|
14
|
+
|
15
|
+
attribute :name, :kind_of => String, :regex => Cheffish::NAME_REGEX, :name_attribute => true
|
16
|
+
|
17
|
+
attribute :chef_server, :kind_of => Hash
|
18
|
+
end
|
@@ -0,0 +1,114 @@
|
|
1
|
+
require 'cheffish'
|
2
|
+
require 'chef/config'
|
3
|
+
require 'chef/resource/lwrp_base'
|
4
|
+
|
5
|
+
class Chef::Resource::ChefDataBagItem < Chef::Resource::LWRPBase
|
6
|
+
self.resource_name = 'chef_data_bag_item'
|
7
|
+
|
8
|
+
actions :create, :delete, :nothing
|
9
|
+
default_action :create
|
10
|
+
|
11
|
+
def initialize(*args)
|
12
|
+
super
|
13
|
+
name @name
|
14
|
+
if !data_bag
|
15
|
+
data_bag run_context.cheffish.current_data_bag
|
16
|
+
end
|
17
|
+
if run_context.cheffish.current_data_bag_item_encryption
|
18
|
+
@encrypt = true if run_context.cheffish.current_data_bag_item_encryption[:encrypt_all]
|
19
|
+
@secret = run_context.cheffish.current_data_bag_item_encryption[:secret]
|
20
|
+
@secret_path = run_context.cheffish.current_data_bag_item_encryption[:secret_path] || run_context.config[:encrypted_data_bag_secret]
|
21
|
+
@encryption_cipher = run_context.cheffish.current_data_bag_item_encryption[:encryption_cipher]
|
22
|
+
@encryption_version = run_context.cheffish.current_data_bag_item_encryption[:encryption_version] || run_context.config[:data_bag_encrypt_version]
|
23
|
+
@old_secret = run_context.cheffish.current_data_bag_item_encryption[:old_secret]
|
24
|
+
@old_secret_path = run_context.cheffish.current_data_bag_item_encryption[:old_secret_path]
|
25
|
+
end
|
26
|
+
chef_server run_context.cheffish.current_chef_server
|
27
|
+
end
|
28
|
+
|
29
|
+
def name(*args)
|
30
|
+
result = super(*args)
|
31
|
+
if args.size == 1
|
32
|
+
parts = name.split('/')
|
33
|
+
if parts.size == 1
|
34
|
+
@id = parts[0]
|
35
|
+
elsif parts.size == 2
|
36
|
+
@data_bag = parts[0]
|
37
|
+
@id = parts[1]
|
38
|
+
else
|
39
|
+
raise "Name #{args[0].inspect} must be a string with 1 or 2 parts, either 'id' or 'data_bag/id"
|
40
|
+
end
|
41
|
+
end
|
42
|
+
result
|
43
|
+
end
|
44
|
+
|
45
|
+
NOT_PASSED = Object.new
|
46
|
+
def id(value = NOT_PASSED)
|
47
|
+
if value == NOT_PASSED
|
48
|
+
@id
|
49
|
+
else
|
50
|
+
@id = value
|
51
|
+
name data_bag ? "#{data_bag}/#{id}" : id
|
52
|
+
end
|
53
|
+
end
|
54
|
+
def data_bag(value = NOT_PASSED)
|
55
|
+
if value == NOT_PASSED
|
56
|
+
@data_bag
|
57
|
+
else
|
58
|
+
@data_bag = value
|
59
|
+
name data_bag ? "#{data_bag}/#{id}" : id
|
60
|
+
end
|
61
|
+
end
|
62
|
+
attribute :raw_data, :kind_of => Hash
|
63
|
+
|
64
|
+
# If secret or secret_path are set, encrypt is assumed true. encrypt exists mainly for with_secret and with_secret_path
|
65
|
+
attribute :encrypt, :kind_of => [TrueClass, FalseClass]
|
66
|
+
#attribute :secret, :kind_of => String
|
67
|
+
def secret(new_secret = nil)
|
68
|
+
if !new_secret
|
69
|
+
@secret
|
70
|
+
else
|
71
|
+
@secret = new_secret
|
72
|
+
@encrypt = true if @encrypt.nil?
|
73
|
+
end
|
74
|
+
end
|
75
|
+
#attribute :secret_path, :kind_of => String
|
76
|
+
def secret_path(new_secret_path = nil)
|
77
|
+
if !new_secret_path
|
78
|
+
@secret_path
|
79
|
+
else
|
80
|
+
@secret_path = new_secret_path
|
81
|
+
@encrypt = true if @encrypt.nil?
|
82
|
+
end
|
83
|
+
end
|
84
|
+
attribute :encryption_version, :kind_of => Integer
|
85
|
+
|
86
|
+
# Old secret (or secrets) to read the old data bag when we are changing keys and re-encrypting data
|
87
|
+
attribute :old_secret, :kind_of => [String, Array]
|
88
|
+
attribute :old_secret_path, :kind_of => [String, Array]
|
89
|
+
|
90
|
+
# Specifies that this is a complete specification for the environment (i.e. attributes you don't specify will be
|
91
|
+
# reset to their defaults)
|
92
|
+
attribute :complete, :kind_of => [TrueClass, FalseClass]
|
93
|
+
|
94
|
+
attribute :raw_json, :kind_of => Hash
|
95
|
+
attribute :chef_server, :kind_of => Hash
|
96
|
+
|
97
|
+
# value 'ip_address', '127.0.0.1'
|
98
|
+
# value [ 'pushy', 'port' ], '9000'
|
99
|
+
# value 'ip_addresses' do |existing_value|
|
100
|
+
# (existing_value || []) + [ '127.0.0.1' ]
|
101
|
+
# end
|
102
|
+
# value 'ip_address', :delete
|
103
|
+
attr_reader :raw_data_modifiers
|
104
|
+
def value(raw_data_path, value=NOT_PASSED, &block)
|
105
|
+
@raw_data_modifiers ||= []
|
106
|
+
if value != NOT_PASSED
|
107
|
+
@raw_data_modifiers << [ raw_data_path, value ]
|
108
|
+
elsif block
|
109
|
+
@raw_data_modifiers << [ raw_data_path, block ]
|
110
|
+
else
|
111
|
+
raise "value requires either a value or a block"
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
require 'cheffish'
|
2
|
+
require 'chef/resource/lwrp_base'
|
3
|
+
require 'chef/environment'
|
4
|
+
|
5
|
+
class Chef::Resource::ChefEnvironment < Chef::Resource::LWRPBase
|
6
|
+
self.resource_name = 'chef_environment'
|
7
|
+
|
8
|
+
actions :create, :delete, :nothing
|
9
|
+
default_action :create
|
10
|
+
|
11
|
+
def initialize(*args)
|
12
|
+
super
|
13
|
+
chef_server run_context.cheffish.current_chef_server
|
14
|
+
end
|
15
|
+
|
16
|
+
attribute :name, :kind_of => String, :regex => Cheffish::NAME_REGEX, :name_attribute => true
|
17
|
+
attribute :description, :kind_of => String
|
18
|
+
attribute :cookbook_versions, :kind_of => Hash, :callbacks => {
|
19
|
+
"should have valid cookbook versions" => lambda { |value| Chef::Environment.validate_cookbook_versions(value) }
|
20
|
+
}
|
21
|
+
attribute :default_attributes, :kind_of => Hash
|
22
|
+
attribute :override_attributes, :kind_of => Hash
|
23
|
+
|
24
|
+
# Specifies that this is a complete specification for the environment (i.e. attributes you don't specify will be
|
25
|
+
# reset to their defaults)
|
26
|
+
attribute :complete, :kind_of => [TrueClass, FalseClass]
|
27
|
+
|
28
|
+
attribute :raw_json, :kind_of => Hash
|
29
|
+
attribute :chef_server, :kind_of => Hash
|
30
|
+
|
31
|
+
NOT_PASSED=Object.new
|
32
|
+
|
33
|
+
# default 'ip_address', '127.0.0.1'
|
34
|
+
# default [ 'pushy', 'port' ], '9000'
|
35
|
+
# default 'ip_addresses' do |existing_value|
|
36
|
+
# (existing_value || []) + [ '127.0.0.1' ]
|
37
|
+
# end
|
38
|
+
# default 'ip_address', :delete
|
39
|
+
attr_reader :default_attribute_modifiers
|
40
|
+
def default(attribute_path, value=NOT_PASSED, &block)
|
41
|
+
@default_attribute_modifiers ||= []
|
42
|
+
if value != NOT_PASSED
|
43
|
+
@default_attribute_modifiers << [ attribute_path, value ]
|
44
|
+
elsif block
|
45
|
+
@default_attribute_modifiers << [ attribute_path, block ]
|
46
|
+
else
|
47
|
+
raise "default requires either a value or a block"
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
# override 'ip_address', '127.0.0.1'
|
52
|
+
# override [ 'pushy', 'port' ], '9000'
|
53
|
+
# override 'ip_addresses' do |existing_value|
|
54
|
+
# (existing_value || []) + [ '127.0.0.1' ]
|
55
|
+
# end
|
56
|
+
# override 'ip_address', :delete
|
57
|
+
attr_reader :override_attribute_modifiers
|
58
|
+
def override(attribute_path, value=NOT_PASSED, &block)
|
59
|
+
@override_attribute_modifiers ||= []
|
60
|
+
if value != NOT_PASSED
|
61
|
+
@override_attribute_modifiers << [ attribute_path, value ]
|
62
|
+
elsif block
|
63
|
+
@override_attribute_modifiers << [ attribute_path, block ]
|
64
|
+
else
|
65
|
+
raise "override requires either a value or a block"
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
alias :attributes :default_attributes
|
70
|
+
alias :attribute :default
|
71
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
require 'cheffish'
|
2
|
+
require 'chef/resource/lwrp_base'
|
3
|
+
require 'chef/run_list/run_list_item'
|
4
|
+
|
5
|
+
class Chef::Resource::ChefGroup < Chef::Resource::LWRPBase
|
6
|
+
self.resource_name = 'chef_group'
|
7
|
+
|
8
|
+
actions :create, :delete, :nothing
|
9
|
+
default_action :create
|
10
|
+
|
11
|
+
# Grab environment from with_environment
|
12
|
+
def initialize(*args)
|
13
|
+
super
|
14
|
+
chef_server run_context.cheffish.current_chef_server
|
15
|
+
@users = []
|
16
|
+
@clients = []
|
17
|
+
@groups = []
|
18
|
+
@remove_users = []
|
19
|
+
@remove_clients = []
|
20
|
+
@remove_groups = []
|
21
|
+
end
|
22
|
+
|
23
|
+
attribute :name, :kind_of => String, :regex => Cheffish::NAME_REGEX, :name_attribute => true
|
24
|
+
def users(*users)
|
25
|
+
users.size == 0 ? @users : (@users |= users.flatten)
|
26
|
+
end
|
27
|
+
def clients(*clients)
|
28
|
+
clients.size == 0 ? @clients : (@clients |= clients.flatten)
|
29
|
+
end
|
30
|
+
def groups(*groups)
|
31
|
+
groups.size == 0 ? @groups : (@groups |= groups.flatten)
|
32
|
+
end
|
33
|
+
def remove_users(*remove_users)
|
34
|
+
remove_users.size == 0 ? @remove_users : (@remove_users |= remove_users.flatten)
|
35
|
+
end
|
36
|
+
def remove_clients(*remove_clients)
|
37
|
+
remove_clients.size == 0 ? @remove_clients : (@remove_clients |= remove_clients.flatten)
|
38
|
+
end
|
39
|
+
def remove_groups(*remove_groups)
|
40
|
+
remove_groups.size == 0 ? @remove_groups : (@remove_groups |= remove_groups.flatten)
|
41
|
+
end
|
42
|
+
|
43
|
+
# Specifies that this is a complete specification for the environment (i.e. attributes you don't specify will be
|
44
|
+
# reset to their defaults)
|
45
|
+
attribute :complete, :kind_of => [TrueClass, FalseClass]
|
46
|
+
|
47
|
+
attribute :raw_json, :kind_of => Hash
|
48
|
+
attribute :chef_server, :kind_of => Hash
|
49
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require 'cheffish'
|
2
|
+
require 'chef/resource/lwrp_base'
|
3
|
+
|
4
|
+
class Chef::Resource::ChefMirror < Chef::Resource::LWRPBase
|
5
|
+
self.resource_name = 'chef_mirror'
|
6
|
+
|
7
|
+
actions :upload, :download, :nothing
|
8
|
+
default_action :nothing
|
9
|
+
|
10
|
+
def initialize(*args)
|
11
|
+
super
|
12
|
+
chef_server run_context.cheffish.current_chef_server
|
13
|
+
end
|
14
|
+
|
15
|
+
# Path of the data to mirror, e.g. nodes, nodes/*, nodes/mynode,
|
16
|
+
# */*, **, roles/base, data/secrets, cookbooks/apache2, etc.
|
17
|
+
attribute :path, :kind_of => String, :name_attribute => true
|
18
|
+
|
19
|
+
# Local path. Can be a string (top level of repository) or hash
|
20
|
+
# (:chef_repo_path, :node_path, etc.)
|
21
|
+
# If neither chef_repo_path nor versioned_cookbooks are set, they default to their
|
22
|
+
# Chef::Config values. If chef_repo_path is set but versioned_cookbooks is not,
|
23
|
+
# versioned_cookbooks defaults to true.
|
24
|
+
attribute :chef_repo_path, :kind_of => [ String, Hash ]
|
25
|
+
|
26
|
+
# Whether the repo path contains / should contain cookbooks with versioned names,
|
27
|
+
# i.e. cookbooks/mysql-1.0.0, cookbooks/mysql-1.2.0, etc.
|
28
|
+
attribute :versioned_cookbooks, :kind_of => [ TrueClass, FalseClass ]
|
29
|
+
|
30
|
+
# Chef server
|
31
|
+
attribute :chef_server, :kind_of => Hash
|
32
|
+
|
33
|
+
# Whether to purge deleted things: if we do not have cookbooks/x locally and we
|
34
|
+
# *do* have cookbooks/x remotely, then :upload with purge will delete it.
|
35
|
+
# Defaults to false.
|
36
|
+
attribute :purge, :kind_of => [ TrueClass, FalseClass ]
|
37
|
+
|
38
|
+
# Whether to freeze cookbooks on upload
|
39
|
+
attribute :freeze, :kind_of => [ TrueClass, FalseClass ]
|
40
|
+
|
41
|
+
# If this is true, only new files will be copied. File contents will not be
|
42
|
+
# diffed, so changed files will never be uploaded.
|
43
|
+
attribute :no_diff, :kind_of => [ TrueClass, FalseClass ]
|
44
|
+
|
45
|
+
# Number of parallel threads to list/upload/download with. Defaults to 10.
|
46
|
+
attribute :concurrency, :kind_of => Integer
|
47
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'cheffish'
|
2
|
+
require 'chef/resource/lwrp_base'
|
3
|
+
|
4
|
+
class Chef::Resource::ChefNode < Chef::Resource::LWRPBase
|
5
|
+
self.resource_name = 'chef_node'
|
6
|
+
|
7
|
+
actions :create, :delete, :nothing
|
8
|
+
default_action :create
|
9
|
+
|
10
|
+
# Grab environment from with_environment
|
11
|
+
def initialize(*args)
|
12
|
+
super
|
13
|
+
chef_environment run_context.cheffish.current_environment
|
14
|
+
chef_server run_context.cheffish.current_chef_server
|
15
|
+
end
|
16
|
+
|
17
|
+
Cheffish.node_attributes(self)
|
18
|
+
end
|