cheffish 1.4.1 → 1.4.2

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.
Files changed (76) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +201 -201
  3. data/README.md +120 -120
  4. data/Rakefile +23 -23
  5. data/lib/chef/provider/chef_acl.rb +439 -439
  6. data/lib/chef/provider/chef_client.rb +53 -53
  7. data/lib/chef/provider/chef_container.rb +55 -55
  8. data/lib/chef/provider/chef_data_bag.rb +55 -55
  9. data/lib/chef/provider/chef_data_bag_item.rb +278 -278
  10. data/lib/chef/provider/chef_environment.rb +83 -83
  11. data/lib/chef/provider/chef_group.rb +83 -83
  12. data/lib/chef/provider/chef_mirror.rb +169 -169
  13. data/lib/chef/provider/chef_node.rb +87 -87
  14. data/lib/chef/provider/chef_organization.rb +155 -155
  15. data/lib/chef/provider/chef_resolved_cookbooks.rb +46 -46
  16. data/lib/chef/provider/chef_role.rb +84 -84
  17. data/lib/chef/provider/chef_user.rb +59 -59
  18. data/lib/chef/provider/private_key.rb +225 -225
  19. data/lib/chef/provider/public_key.rb +88 -88
  20. data/lib/chef/resource/chef_acl.rb +69 -69
  21. data/lib/chef/resource/chef_client.rb +48 -48
  22. data/lib/chef/resource/chef_container.rb +22 -22
  23. data/lib/chef/resource/chef_data_bag.rb +22 -22
  24. data/lib/chef/resource/chef_data_bag_item.rb +121 -121
  25. data/lib/chef/resource/chef_environment.rb +77 -77
  26. data/lib/chef/resource/chef_group.rb +53 -53
  27. data/lib/chef/resource/chef_mirror.rb +52 -52
  28. data/lib/chef/resource/chef_node.rb +22 -22
  29. data/lib/chef/resource/chef_organization.rb +69 -69
  30. data/lib/chef/resource/chef_resolved_cookbooks.rb +35 -35
  31. data/lib/chef/resource/chef_role.rb +110 -110
  32. data/lib/chef/resource/chef_user.rb +56 -56
  33. data/lib/chef/resource/private_key.rb +48 -48
  34. data/lib/chef/resource/public_key.rb +25 -25
  35. data/lib/cheffish/actor_provider_base.rb +131 -131
  36. data/lib/cheffish/basic_chef_client.rb +184 -184
  37. data/lib/cheffish/chef_provider_base.rb +246 -246
  38. data/lib/cheffish/chef_run.rb +162 -162
  39. data/lib/cheffish/chef_run_data.rb +19 -19
  40. data/lib/cheffish/chef_run_listener.rb +30 -30
  41. data/lib/cheffish/key_formatter.rb +113 -113
  42. data/lib/cheffish/merged_config.rb +94 -94
  43. data/lib/cheffish/recipe_dsl.rb +157 -157
  44. data/lib/cheffish/rspec/chef_run_support.rb +83 -83
  45. data/lib/cheffish/rspec/matchers/be_idempotent.rb +16 -16
  46. data/lib/cheffish/rspec/matchers/emit_no_warnings_or_errors.rb +15 -15
  47. data/lib/cheffish/rspec/matchers/have_updated.rb +37 -37
  48. data/lib/cheffish/rspec/matchers/partially_match.rb +63 -63
  49. data/lib/cheffish/rspec/matchers.rb +4 -4
  50. data/lib/cheffish/rspec/recipe_run_wrapper.rb +78 -59
  51. data/lib/cheffish/rspec/repository_support.rb +108 -108
  52. data/lib/cheffish/rspec.rb +8 -8
  53. data/lib/cheffish/server_api.rb +52 -52
  54. data/lib/cheffish/version.rb +3 -3
  55. data/lib/cheffish/with_pattern.rb +21 -21
  56. data/lib/cheffish.rb +235 -235
  57. data/spec/functional/fingerprint_spec.rb +64 -64
  58. data/spec/functional/merged_config_spec.rb +19 -19
  59. data/spec/functional/server_api_spec.rb +13 -13
  60. data/spec/integration/chef_acl_spec.rb +879 -879
  61. data/spec/integration/chef_client_spec.rb +105 -105
  62. data/spec/integration/chef_container_spec.rb +33 -33
  63. data/spec/integration/chef_group_spec.rb +309 -309
  64. data/spec/integration/chef_mirror_spec.rb +491 -491
  65. data/spec/integration/chef_node_spec.rb +786 -786
  66. data/spec/integration/chef_organization_spec.rb +226 -226
  67. data/spec/integration/chef_role_spec.rb +78 -78
  68. data/spec/integration/chef_user_spec.rb +85 -85
  69. data/spec/integration/private_key_spec.rb +399 -399
  70. data/spec/integration/recipe_dsl_spec.rb +28 -28
  71. data/spec/integration/rspec/converge_spec.rb +183 -183
  72. data/spec/support/key_support.rb +29 -29
  73. data/spec/support/spec_support.rb +15 -15
  74. data/spec/unit/get_private_key_spec.rb +131 -131
  75. data/spec/unit/recipe_run_wrapper_spec.rb +37 -37
  76. metadata +3 -2
@@ -1,77 +1,77 @@
1
- require 'cheffish'
2
- require 'chef/resource/lwrp_base'
3
- require 'chef/environment'
4
-
5
- class Chef
6
- class Resource
7
- class ChefEnvironment < Chef::Resource::LWRPBase
8
- self.resource_name = 'chef_environment'
9
-
10
- actions :create, :delete, :nothing
11
- default_action :create
12
-
13
- def initialize(*args)
14
- super
15
- chef_server run_context.cheffish.current_chef_server
16
- end
17
-
18
- attribute :name, :kind_of => String, :regex => Cheffish::NAME_REGEX, :name_attribute => true
19
- attribute :description, :kind_of => String
20
- attribute :cookbook_versions, :kind_of => Hash, :callbacks => {
21
- "should have valid cookbook versions" => lambda { |value| Chef::Environment.validate_cookbook_versions(value) }
22
- }
23
- attribute :default_attributes, :kind_of => Hash
24
- attribute :override_attributes, :kind_of => Hash
25
-
26
- # Specifies that this is a complete specification for the environment (i.e. attributes you don't specify will be
27
- # reset to their defaults)
28
- attribute :complete, :kind_of => [TrueClass, FalseClass]
29
-
30
- attribute :raw_json, :kind_of => Hash
31
- attribute :chef_server, :kind_of => Hash
32
-
33
- # `NOT_PASSED` is defined in chef-12.5.0, this guard will ensure we
34
- # don't redefine it if it's already there
35
- NOT_PASSED=Object.new unless defined?(NOT_PASSED)
36
-
37
- # default 'ip_address', '127.0.0.1'
38
- # default [ 'pushy', 'port' ], '9000'
39
- # default 'ip_addresses' do |existing_value|
40
- # (existing_value || []) + [ '127.0.0.1' ]
41
- # end
42
- # default 'ip_address', :delete
43
- attr_reader :default_attribute_modifiers
44
- def default(attribute_path, value=NOT_PASSED, &block)
45
- @default_attribute_modifiers ||= []
46
- if value != NOT_PASSED
47
- @default_attribute_modifiers << [ attribute_path, value ]
48
- elsif block
49
- @default_attribute_modifiers << [ attribute_path, block ]
50
- else
51
- raise "default requires either a value or a block"
52
- end
53
- end
54
-
55
- # override 'ip_address', '127.0.0.1'
56
- # override [ 'pushy', 'port' ], '9000'
57
- # override 'ip_addresses' do |existing_value|
58
- # (existing_value || []) + [ '127.0.0.1' ]
59
- # end
60
- # override 'ip_address', :delete
61
- attr_reader :override_attribute_modifiers
62
- def override(attribute_path, value=NOT_PASSED, &block)
63
- @override_attribute_modifiers ||= []
64
- if value != NOT_PASSED
65
- @override_attribute_modifiers << [ attribute_path, value ]
66
- elsif block
67
- @override_attribute_modifiers << [ attribute_path, block ]
68
- else
69
- raise "override requires either a value or a block"
70
- end
71
- end
72
-
73
- alias :attributes :default_attributes
74
- alias :attribute :default
75
- end
76
- end
77
- end
1
+ require 'cheffish'
2
+ require 'chef/resource/lwrp_base'
3
+ require 'chef/environment'
4
+
5
+ class Chef
6
+ class Resource
7
+ class ChefEnvironment < Chef::Resource::LWRPBase
8
+ self.resource_name = 'chef_environment'
9
+
10
+ actions :create, :delete, :nothing
11
+ default_action :create
12
+
13
+ def initialize(*args)
14
+ super
15
+ chef_server run_context.cheffish.current_chef_server
16
+ end
17
+
18
+ attribute :name, :kind_of => String, :regex => Cheffish::NAME_REGEX, :name_attribute => true
19
+ attribute :description, :kind_of => String
20
+ attribute :cookbook_versions, :kind_of => Hash, :callbacks => {
21
+ "should have valid cookbook versions" => lambda { |value| Chef::Environment.validate_cookbook_versions(value) }
22
+ }
23
+ attribute :default_attributes, :kind_of => Hash
24
+ attribute :override_attributes, :kind_of => Hash
25
+
26
+ # Specifies that this is a complete specification for the environment (i.e. attributes you don't specify will be
27
+ # reset to their defaults)
28
+ attribute :complete, :kind_of => [TrueClass, FalseClass]
29
+
30
+ attribute :raw_json, :kind_of => Hash
31
+ attribute :chef_server, :kind_of => Hash
32
+
33
+ # `NOT_PASSED` is defined in chef-12.5.0, this guard will ensure we
34
+ # don't redefine it if it's already there
35
+ NOT_PASSED=Object.new unless defined?(NOT_PASSED)
36
+
37
+ # default 'ip_address', '127.0.0.1'
38
+ # default [ 'pushy', 'port' ], '9000'
39
+ # default 'ip_addresses' do |existing_value|
40
+ # (existing_value || []) + [ '127.0.0.1' ]
41
+ # end
42
+ # default 'ip_address', :delete
43
+ attr_reader :default_attribute_modifiers
44
+ def default(attribute_path, value=NOT_PASSED, &block)
45
+ @default_attribute_modifiers ||= []
46
+ if value != NOT_PASSED
47
+ @default_attribute_modifiers << [ attribute_path, value ]
48
+ elsif block
49
+ @default_attribute_modifiers << [ attribute_path, block ]
50
+ else
51
+ raise "default requires either a value or a block"
52
+ end
53
+ end
54
+
55
+ # override 'ip_address', '127.0.0.1'
56
+ # override [ 'pushy', 'port' ], '9000'
57
+ # override 'ip_addresses' do |existing_value|
58
+ # (existing_value || []) + [ '127.0.0.1' ]
59
+ # end
60
+ # override 'ip_address', :delete
61
+ attr_reader :override_attribute_modifiers
62
+ def override(attribute_path, value=NOT_PASSED, &block)
63
+ @override_attribute_modifiers ||= []
64
+ if value != NOT_PASSED
65
+ @override_attribute_modifiers << [ attribute_path, value ]
66
+ elsif block
67
+ @override_attribute_modifiers << [ attribute_path, block ]
68
+ else
69
+ raise "override requires either a value or a block"
70
+ end
71
+ end
72
+
73
+ alias :attributes :default_attributes
74
+ alias :attribute :default
75
+ end
76
+ end
77
+ end
@@ -1,53 +1,53 @@
1
- require 'cheffish'
2
- require 'chef/resource/lwrp_base'
3
- require 'chef/run_list/run_list_item'
4
-
5
- class Chef
6
- class Resource
7
- class ChefGroup < Chef::Resource::LWRPBase
8
- self.resource_name = 'chef_group'
9
-
10
- actions :create, :delete, :nothing
11
- default_action :create
12
-
13
- # Grab environment from with_environment
14
- def initialize(*args)
15
- super
16
- chef_server run_context.cheffish.current_chef_server
17
- @users = []
18
- @clients = []
19
- @groups = []
20
- @remove_users = []
21
- @remove_clients = []
22
- @remove_groups = []
23
- end
24
-
25
- attribute :name, :kind_of => String, :regex => Cheffish::NAME_REGEX, :name_attribute => true
26
- def users(*users)
27
- users.size == 0 ? @users : (@users |= users.flatten)
28
- end
29
- def clients(*clients)
30
- clients.size == 0 ? @clients : (@clients |= clients.flatten)
31
- end
32
- def groups(*groups)
33
- groups.size == 0 ? @groups : (@groups |= groups.flatten)
34
- end
35
- def remove_users(*remove_users)
36
- remove_users.size == 0 ? @remove_users : (@remove_users |= remove_users.flatten)
37
- end
38
- def remove_clients(*remove_clients)
39
- remove_clients.size == 0 ? @remove_clients : (@remove_clients |= remove_clients.flatten)
40
- end
41
- def remove_groups(*remove_groups)
42
- remove_groups.size == 0 ? @remove_groups : (@remove_groups |= remove_groups.flatten)
43
- end
44
-
45
- # Specifies that this is a complete specification for the environment (i.e. attributes you don't specify will be
46
- # reset to their defaults)
47
- attribute :complete, :kind_of => [TrueClass, FalseClass]
48
-
49
- attribute :raw_json, :kind_of => Hash
50
- attribute :chef_server, :kind_of => Hash
51
- end
52
- end
53
- end
1
+ require 'cheffish'
2
+ require 'chef/resource/lwrp_base'
3
+ require 'chef/run_list/run_list_item'
4
+
5
+ class Chef
6
+ class Resource
7
+ class ChefGroup < Chef::Resource::LWRPBase
8
+ self.resource_name = 'chef_group'
9
+
10
+ actions :create, :delete, :nothing
11
+ default_action :create
12
+
13
+ # Grab environment from with_environment
14
+ def initialize(*args)
15
+ super
16
+ chef_server run_context.cheffish.current_chef_server
17
+ @users = []
18
+ @clients = []
19
+ @groups = []
20
+ @remove_users = []
21
+ @remove_clients = []
22
+ @remove_groups = []
23
+ end
24
+
25
+ attribute :name, :kind_of => String, :regex => Cheffish::NAME_REGEX, :name_attribute => true
26
+ def users(*users)
27
+ users.size == 0 ? @users : (@users |= users.flatten)
28
+ end
29
+ def clients(*clients)
30
+ clients.size == 0 ? @clients : (@clients |= clients.flatten)
31
+ end
32
+ def groups(*groups)
33
+ groups.size == 0 ? @groups : (@groups |= groups.flatten)
34
+ end
35
+ def remove_users(*remove_users)
36
+ remove_users.size == 0 ? @remove_users : (@remove_users |= remove_users.flatten)
37
+ end
38
+ def remove_clients(*remove_clients)
39
+ remove_clients.size == 0 ? @remove_clients : (@remove_clients |= remove_clients.flatten)
40
+ end
41
+ def remove_groups(*remove_groups)
42
+ remove_groups.size == 0 ? @remove_groups : (@remove_groups |= remove_groups.flatten)
43
+ end
44
+
45
+ # Specifies that this is a complete specification for the environment (i.e. attributes you don't specify will be
46
+ # reset to their defaults)
47
+ attribute :complete, :kind_of => [TrueClass, FalseClass]
48
+
49
+ attribute :raw_json, :kind_of => Hash
50
+ attribute :chef_server, :kind_of => Hash
51
+ end
52
+ end
53
+ end
@@ -1,52 +1,52 @@
1
- require 'cheffish'
2
- require 'chef/resource/lwrp_base'
3
-
4
- class Chef
5
- class Resource
6
- class ChefMirror < Chef::Resource::LWRPBase
7
- self.resource_name = 'chef_mirror'
8
-
9
- actions :upload, :download, :nothing
10
- default_action :nothing
11
-
12
- def initialize(*args)
13
- super
14
- chef_server run_context.cheffish.current_chef_server
15
- end
16
-
17
- # Path of the data to mirror, e.g. nodes, nodes/*, nodes/mynode,
18
- # */*, **, roles/base, data/secrets, cookbooks/apache2, etc.
19
- attribute :path, :kind_of => String, :name_attribute => true
20
-
21
- # Local path. Can be a string (top level of repository) or hash
22
- # (:chef_repo_path, :node_path, etc.)
23
- # If neither chef_repo_path nor versioned_cookbooks are set, they default to their
24
- # Chef::Config values. If chef_repo_path is set but versioned_cookbooks is not,
25
- # versioned_cookbooks defaults to true.
26
- attribute :chef_repo_path, :kind_of => [ String, Hash ]
27
-
28
- # Whether the repo path should contain cookbooks with versioned names,
29
- # i.e. cookbooks/mysql-1.0.0, cookbooks/mysql-1.2.0, etc.
30
- # Defaults to true if chef_repo_path is specified, or to Chef::Config.versioned_cookbooks otherwise.
31
- attribute :versioned_cookbooks, :kind_of => [ TrueClass, FalseClass ]
32
-
33
- # Chef server
34
- attribute :chef_server, :kind_of => Hash
35
-
36
- # Whether to purge deleted things: if we do not have cookbooks/x locally and we
37
- # *do* have cookbooks/x remotely, then :upload with purge will delete it.
38
- # Defaults to false.
39
- attribute :purge, :kind_of => [ TrueClass, FalseClass ]
40
-
41
- # Whether to freeze cookbooks on upload
42
- attribute :freeze, :kind_of => [ TrueClass, FalseClass ]
43
-
44
- # If this is true, only new files will be copied. File contents will not be
45
- # diffed, so changed files will never be uploaded.
46
- attribute :no_diff, :kind_of => [ TrueClass, FalseClass ]
47
-
48
- # Number of parallel threads to list/upload/download with. Defaults to 10.
49
- attribute :concurrency, :kind_of => Integer
50
- end
51
- end
52
- end
1
+ require 'cheffish'
2
+ require 'chef/resource/lwrp_base'
3
+
4
+ class Chef
5
+ class Resource
6
+ class ChefMirror < Chef::Resource::LWRPBase
7
+ self.resource_name = 'chef_mirror'
8
+
9
+ actions :upload, :download, :nothing
10
+ default_action :nothing
11
+
12
+ def initialize(*args)
13
+ super
14
+ chef_server run_context.cheffish.current_chef_server
15
+ end
16
+
17
+ # Path of the data to mirror, e.g. nodes, nodes/*, nodes/mynode,
18
+ # */*, **, roles/base, data/secrets, cookbooks/apache2, etc.
19
+ attribute :path, :kind_of => String, :name_attribute => true
20
+
21
+ # Local path. Can be a string (top level of repository) or hash
22
+ # (:chef_repo_path, :node_path, etc.)
23
+ # If neither chef_repo_path nor versioned_cookbooks are set, they default to their
24
+ # Chef::Config values. If chef_repo_path is set but versioned_cookbooks is not,
25
+ # versioned_cookbooks defaults to true.
26
+ attribute :chef_repo_path, :kind_of => [ String, Hash ]
27
+
28
+ # Whether the repo path should contain cookbooks with versioned names,
29
+ # i.e. cookbooks/mysql-1.0.0, cookbooks/mysql-1.2.0, etc.
30
+ # Defaults to true if chef_repo_path is specified, or to Chef::Config.versioned_cookbooks otherwise.
31
+ attribute :versioned_cookbooks, :kind_of => [ TrueClass, FalseClass ]
32
+
33
+ # Chef server
34
+ attribute :chef_server, :kind_of => Hash
35
+
36
+ # Whether to purge deleted things: if we do not have cookbooks/x locally and we
37
+ # *do* have cookbooks/x remotely, then :upload with purge will delete it.
38
+ # Defaults to false.
39
+ attribute :purge, :kind_of => [ TrueClass, FalseClass ]
40
+
41
+ # Whether to freeze cookbooks on upload
42
+ attribute :freeze, :kind_of => [ TrueClass, FalseClass ]
43
+
44
+ # If this is true, only new files will be copied. File contents will not be
45
+ # diffed, so changed files will never be uploaded.
46
+ attribute :no_diff, :kind_of => [ TrueClass, FalseClass ]
47
+
48
+ # Number of parallel threads to list/upload/download with. Defaults to 10.
49
+ attribute :concurrency, :kind_of => Integer
50
+ end
51
+ end
52
+ end
@@ -1,22 +1,22 @@
1
- require 'cheffish'
2
- require 'chef/resource/lwrp_base'
3
-
4
- class Chef
5
- class Resource
6
- class ChefNode < Chef::Resource::LWRPBase
7
- self.resource_name = 'chef_node'
8
-
9
- actions :create, :delete, :nothing
10
- default_action :create
11
-
12
- # Grab environment from with_environment
13
- def initialize(*args)
14
- super
15
- chef_environment run_context.cheffish.current_environment
16
- chef_server run_context.cheffish.current_chef_server
17
- end
18
-
19
- Cheffish.node_attributes(self)
20
- end
21
- end
22
- end
1
+ require 'cheffish'
2
+ require 'chef/resource/lwrp_base'
3
+
4
+ class Chef
5
+ class Resource
6
+ class ChefNode < Chef::Resource::LWRPBase
7
+ self.resource_name = 'chef_node'
8
+
9
+ actions :create, :delete, :nothing
10
+ default_action :create
11
+
12
+ # Grab environment from with_environment
13
+ def initialize(*args)
14
+ super
15
+ chef_environment run_context.cheffish.current_environment
16
+ chef_server run_context.cheffish.current_chef_server
17
+ end
18
+
19
+ Cheffish.node_attributes(self)
20
+ end
21
+ end
22
+ end
@@ -1,69 +1,69 @@
1
- require 'cheffish'
2
- require 'chef/resource/lwrp_base'
3
- require 'chef/run_list/run_list_item'
4
-
5
- class Chef
6
- class Resource
7
- class ChefOrganization < Chef::Resource::LWRPBase
8
- self.resource_name = 'chef_organization'
9
-
10
- actions :create, :delete, :nothing
11
- default_action :create
12
-
13
- # Grab environment from with_environment
14
- def initialize(*args)
15
- super
16
- chef_server run_context.cheffish.current_chef_server
17
- @invites = nil
18
- @members = nil
19
- @remove_members = []
20
- end
21
-
22
- attribute :name, :kind_of => String, :regex => Cheffish::NAME_REGEX, :name_attribute => true
23
- attribute :full_name, :kind_of => String
24
-
25
- # A list of users who must at least be invited to the org (but may already be
26
- # members). Invites will be sent to users who are not already invited/in the org.
27
- def invites(*users)
28
- if users.size == 0
29
- @invites || []
30
- else
31
- @invites ||= []
32
- @invites |= users.flatten
33
- end
34
- end
35
-
36
- def invites_specified?
37
- !!@invites
38
- end
39
-
40
- # A list of users who must be members of the org. This will use the
41
- # new Chef 12 POST /organizations/ORG/users endpoint to add them
42
- # directly to the org. If you do not have permission to perform
43
- # this operation, and the users are not a part of the org, the
44
- # resource update will fail.
45
- def members(*users)
46
- if users.size == 0
47
- @members || []
48
- else
49
- @members ||= []
50
- @members |= users.flatten
51
- end
52
- end
53
-
54
- def members_specified?
55
- !!@members
56
- end
57
-
58
- # A list of users who must not be members of the org. These users will be removed
59
- # from the org and invites will be revoked (if any).
60
- def remove_members(*users)
61
- users.size == 0 ? @remove_members : (@remove_members |= users.flatten)
62
- end
63
-
64
- attribute :complete, :kind_of => [ TrueClass, FalseClass ]
65
- attribute :raw_json, :kind_of => Hash
66
- attribute :chef_server, :kind_of => Hash
67
- end
68
- end
69
- end
1
+ require 'cheffish'
2
+ require 'chef/resource/lwrp_base'
3
+ require 'chef/run_list/run_list_item'
4
+
5
+ class Chef
6
+ class Resource
7
+ class ChefOrganization < Chef::Resource::LWRPBase
8
+ self.resource_name = 'chef_organization'
9
+
10
+ actions :create, :delete, :nothing
11
+ default_action :create
12
+
13
+ # Grab environment from with_environment
14
+ def initialize(*args)
15
+ super
16
+ chef_server run_context.cheffish.current_chef_server
17
+ @invites = nil
18
+ @members = nil
19
+ @remove_members = []
20
+ end
21
+
22
+ attribute :name, :kind_of => String, :regex => Cheffish::NAME_REGEX, :name_attribute => true
23
+ attribute :full_name, :kind_of => String
24
+
25
+ # A list of users who must at least be invited to the org (but may already be
26
+ # members). Invites will be sent to users who are not already invited/in the org.
27
+ def invites(*users)
28
+ if users.size == 0
29
+ @invites || []
30
+ else
31
+ @invites ||= []
32
+ @invites |= users.flatten
33
+ end
34
+ end
35
+
36
+ def invites_specified?
37
+ !!@invites
38
+ end
39
+
40
+ # A list of users who must be members of the org. This will use the
41
+ # new Chef 12 POST /organizations/ORG/users endpoint to add them
42
+ # directly to the org. If you do not have permission to perform
43
+ # this operation, and the users are not a part of the org, the
44
+ # resource update will fail.
45
+ def members(*users)
46
+ if users.size == 0
47
+ @members || []
48
+ else
49
+ @members ||= []
50
+ @members |= users.flatten
51
+ end
52
+ end
53
+
54
+ def members_specified?
55
+ !!@members
56
+ end
57
+
58
+ # A list of users who must not be members of the org. These users will be removed
59
+ # from the org and invites will be revoked (if any).
60
+ def remove_members(*users)
61
+ users.size == 0 ? @remove_members : (@remove_members |= users.flatten)
62
+ end
63
+
64
+ attribute :complete, :kind_of => [ TrueClass, FalseClass ]
65
+ attribute :raw_json, :kind_of => Hash
66
+ attribute :chef_server, :kind_of => Hash
67
+ end
68
+ end
69
+ end
@@ -1,35 +1,35 @@
1
- require 'chef/resource/lwrp_base'
2
-
3
- class Chef
4
- class Resource
5
- class ChefResolvedCookbooks < Chef::Resource::LWRPBase
6
- self.resource_name = 'chef_resolved_cookbooks'
7
-
8
- actions :resolve, :nothing
9
- default_action :resolve
10
-
11
- def initialize(*args)
12
- super
13
- require 'berkshelf'
14
- berksfile Berkshelf::Berksfile.new('/tmp/Berksfile')
15
- chef_server run_context.cheffish.current_chef_server
16
- @cookbooks_from = []
17
- end
18
-
19
- extend Forwardable
20
-
21
- def_delegators :@berksfile, :cookbook, :extension, :group, :metadata, :source
22
-
23
- def cookbooks_from(path = nil)
24
- if path
25
- @cookbooks_from << path
26
- else
27
- @cookbooks_from
28
- end
29
- end
30
-
31
- attribute :berksfile
32
- attribute :chef_server
33
- end
34
- end
35
- end
1
+ require 'chef/resource/lwrp_base'
2
+
3
+ class Chef
4
+ class Resource
5
+ class ChefResolvedCookbooks < Chef::Resource::LWRPBase
6
+ self.resource_name = 'chef_resolved_cookbooks'
7
+
8
+ actions :resolve, :nothing
9
+ default_action :resolve
10
+
11
+ def initialize(*args)
12
+ super
13
+ require 'berkshelf'
14
+ berksfile Berkshelf::Berksfile.new('/tmp/Berksfile')
15
+ chef_server run_context.cheffish.current_chef_server
16
+ @cookbooks_from = []
17
+ end
18
+
19
+ extend Forwardable
20
+
21
+ def_delegators :@berksfile, :cookbook, :extension, :group, :metadata, :source
22
+
23
+ def cookbooks_from(path = nil)
24
+ if path
25
+ @cookbooks_from << path
26
+ else
27
+ @cookbooks_from
28
+ end
29
+ end
30
+
31
+ attribute :berksfile
32
+ attribute :chef_server
33
+ end
34
+ end
35
+ end