chef 12.9.41-universal-mingw32 → 12.10.24-universal-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +52 -13
- data/README.md +145 -0
- data/Rakefile +4 -14
- data/VERSION +1 -1
- data/acceptance/.gitignore +0 -1
- data/acceptance/Gemfile +2 -2
- data/acceptance/Gemfile.lock +235 -0
- data/acceptance/fips/.kitchen.yml +5 -1
- data/acceptance/fips/test/integration/{fips → fips-integration}/serverspec/Gemfile +0 -0
- data/acceptance/fips/test/integration/fips-integration/serverspec/fips-integration_spec.rb +51 -0
- data/acceptance/fips/test/integration/fips-unit-functional/serverspec/Gemfile +3 -0
- data/acceptance/fips/test/integration/fips-unit-functional/serverspec/fips-unit-functional_spec.rb +56 -0
- data/{chef-windows.gemspec → chef-universal-mingw32.gemspec} +0 -0
- data/chef.gemspec +0 -6
- data/{lib → lib-backcompat}/chef/chef_fs/file_system/already_exists_error.rb +0 -0
- data/{lib → lib-backcompat}/chef/chef_fs/file_system/cookbook_frozen_error.rb +0 -0
- data/{lib → lib-backcompat}/chef/chef_fs/file_system/default_environment_cannot_be_modified_error.rb +0 -0
- data/{lib → lib-backcompat}/chef/chef_fs/file_system/file_system_error.rb +0 -0
- data/{lib → lib-backcompat}/chef/chef_fs/file_system/must_delete_recursively_error.rb +0 -0
- data/{lib → lib-backcompat}/chef/chef_fs/file_system/not_found_error.rb +0 -0
- data/{lib → lib-backcompat}/chef/chef_fs/file_system/operation_failed_error.rb +0 -0
- data/{lib → lib-backcompat}/chef/chef_fs/file_system/operation_not_allowed_error.rb +0 -0
- data/lib-backcompat/chef/chef_fs/file_system/repository/chef_repository_file_system_acls_dir.rb +5 -0
- data/lib-backcompat/chef/chef_fs/file_system/repository/chef_repository_file_system_client_keys_dir.rb +5 -0
- data/lib-backcompat/chef/chef_fs/file_system/repository/chef_repository_file_system_entry.rb +6 -0
- data/lib-backcompat/chef/chef_fs/file_system/repository/chef_repository_file_system_policies_dir.rb +5 -0
- data/{lib → lib-backcompat}/chef/chef_fs/file_system/repository/file_system_root_dir.rb +1 -0
- data/lib/chef/chef_fs/file_system/repository/acl.rb +38 -0
- data/lib/chef/chef_fs/file_system/repository/{chef_repository_file_system_acls_dir.rb → acls_dir.rb} +14 -5
- data/lib/chef/chef_fs/file_system/repository/acls_sub_dir.rb +42 -0
- data/lib/chef/chef_fs/file_system/repository/base_file.rb +120 -0
- data/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_entry.rb +1 -1
- data/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_root_dir.rb +36 -32
- data/lib/chef/chef_fs/file_system/repository/client.rb +38 -0
- data/lib/chef/chef_fs/file_system/repository/client_key.rb +38 -0
- data/lib/chef/chef_fs/file_system/repository/{chef_repository_file_system_client_keys_dir.rb → client_keys_dir.rb} +9 -5
- data/lib/chef/chef_fs/file_system/repository/client_keys_sub_dir.rb +42 -0
- data/lib/chef/chef_fs/file_system/repository/clients_dir.rb +40 -0
- data/lib/chef/chef_fs/file_system/repository/container.rb +38 -0
- data/lib/chef/chef_fs/file_system/repository/containers_dir.rb +41 -0
- data/lib/chef/chef_fs/file_system/repository/cookbooks_dir.rb +0 -1
- data/lib/chef/chef_fs/file_system/repository/data_bag_item.rb +3 -79
- data/lib/chef/chef_fs/file_system/repository/directory.rb +15 -2
- data/lib/chef/chef_fs/file_system/repository/environment.rb +38 -0
- data/lib/chef/chef_fs/file_system/repository/environments_dir.rb +41 -0
- data/lib/chef/chef_fs/file_system/repository/file_system_entry.rb +66 -30
- data/lib/chef/chef_fs/file_system/repository/group.rb +38 -0
- data/lib/chef/chef_fs/file_system/repository/groups_dir.rb +41 -0
- data/lib/chef/chef_fs/file_system/repository/node.rb +38 -0
- data/lib/chef/chef_fs/file_system/repository/nodes_dir.rb +41 -0
- data/lib/chef/chef_fs/file_system/repository/{chef_repository_file_system_policies_dir.rb → policies_dir.rb} +9 -5
- data/lib/chef/chef_fs/file_system/repository/policy.rb +38 -0
- data/lib/chef/chef_fs/file_system/repository/policy_group.rb +38 -0
- data/lib/chef/chef_fs/file_system/repository/policy_groups_dir.rb +41 -0
- data/lib/chef/chef_fs/file_system/repository/role.rb +38 -0
- data/lib/chef/chef_fs/file_system/repository/roles_dir.rb +41 -0
- data/lib/chef/chef_fs/file_system/repository/user.rb +38 -0
- data/lib/chef/chef_fs/file_system/repository/users_dir.rb +41 -0
- data/lib/chef/dsl/declare_resource.rb +182 -7
- data/lib/chef/http/json_input.rb +2 -2
- data/lib/chef/knife.rb +1 -1
- data/lib/chef/mixin/shell_out.rb +10 -21
- data/lib/chef/property.rb +9 -2
- data/lib/chef/provider.rb +8 -7
- data/lib/chef/provider/apt_repository.rb +8 -6
- data/lib/chef/provider/directory.rb +15 -1
- data/lib/chef/provider/env/windows.rb +1 -1
- data/lib/chef/provider/mdadm.rb +1 -0
- data/lib/chef/provider/package/easy_install.rb +2 -0
- data/lib/chef/provider/package/rubygems.rb +4 -1
- data/lib/chef/provider/package/windows.rb +1 -1
- data/lib/chef/recipe.rb +1 -2
- data/lib/chef/resource/apt_repository.rb +6 -6
- data/lib/chef/resource/mdadm.rb +9 -0
- data/lib/chef/resource_collection.rb +5 -0
- data/lib/chef/resource_collection/resource_list.rb +10 -0
- data/lib/chef/resource_collection/resource_set.rb +14 -11
- data/lib/chef/version.rb +1 -1
- data/spec/functional/resource/git_spec.rb +1 -3
- data/spec/functional/resource/group_spec.rb +5 -5
- data/spec/functional/tiny_server_spec.rb +1 -1
- data/spec/functional/util/powershell/cmdlet_spec.rb +1 -1
- data/spec/functional/win32/registry_spec.rb +3 -3
- data/spec/integration/solo/solo_spec.rb +2 -2
- data/spec/support/shared/functional/securable_resource.rb +1 -1
- data/spec/support/shared/unit/provider/file.rb +3 -3
- data/spec/support/shared/unit/windows_script_resource.rb +1 -1
- data/spec/unit/application/apply_spec.rb +1 -0
- data/spec/unit/chef_fs/file_system/repository/base_file_spec.rb +128 -0
- data/spec/unit/chef_fs/file_system/repository/directory_spec.rb +174 -0
- data/spec/unit/cookbook/metadata_spec.rb +1 -1
- data/spec/unit/dsl/declare_resource_spec.rb +335 -0
- data/spec/unit/knife/bootstrap_spec.rb +2 -2
- data/spec/unit/mixin/shell_out_spec.rb +4 -0
- data/spec/unit/node/attribute_spec.rb +1 -1
- data/spec/unit/node/immutable_collections_spec.rb +2 -2
- data/spec/unit/node_map_spec.rb +1 -1
- data/spec/unit/property/validation_spec.rb +23 -7
- data/spec/unit/provider/apt_repository_spec.rb +5 -0
- data/spec/unit/provider/apt_update_spec.rb +1 -0
- data/spec/unit/provider/directory_spec.rb +0 -7
- data/spec/unit/provider/file/content_spec.rb +1 -1
- data/spec/unit/provider/mdadm_spec.rb +9 -0
- data/spec/unit/provider/package/easy_install_spec.rb +6 -0
- data/spec/unit/provider/package/rubygems_spec.rb +8 -4
- data/spec/unit/provider/package/yum_spec.rb +1 -1
- data/spec/unit/provider/powershell_script_spec.rb +1 -1
- data/spec/unit/provider/user/dscl_spec.rb +6 -6
- data/spec/unit/recipe_spec.rb +1 -0
- data/spec/unit/resource/apt_repository_spec.rb +4 -0
- data/spec/unit/resource/file/verification_spec.rb +1 -1
- data/spec/unit/resource/file_spec.rb +2 -2
- data/spec/unit/resource/mdadm_spec.rb +7 -2
- data/spec/unit/resource_collection_spec.rb +30 -0
- data/spec/unit/resource_spec.rb +1 -1
- data/tasks/bin/bundle-platform +15 -0
- data/tasks/bin/bundle-platform.bat +2 -0
- data/tasks/bin/create-override-gemfile +110 -0
- data/tasks/bin/run_chef_tests +17 -0
- data/tasks/bin/run_external_test +47 -0
- data/tasks/bundle.rb +97 -0
- data/tasks/bundle_util.rb +94 -0
- data/tasks/changelog.rb +12 -0
- data/tasks/dependencies.rb +147 -0
- data/tasks/gemfile_util.rb +390 -0
- data/tasks/maintainers.rb +2 -1
- data/tasks/rspec.rb +2 -1
- metadata +61 -83
- data/acceptance/fips/test/integration/fips/serverspec/fips_spec.rb +0 -39
- data/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_entry.rb +0 -83
- data/tasks/external_tests.rb +0 -64
@@ -17,13 +17,21 @@
|
|
17
17
|
#
|
18
18
|
|
19
19
|
require "chef/chef_fs/file_system/base_fs_dir"
|
20
|
-
require "chef/chef_fs/file_system/repository/
|
20
|
+
require "chef/chef_fs/file_system/repository/acls_dir"
|
21
|
+
require "chef/chef_fs/file_system/repository/clients_dir"
|
21
22
|
require "chef/chef_fs/file_system/repository/cookbooks_dir"
|
22
23
|
require "chef/chef_fs/file_system/repository/cookbook_artifacts_dir"
|
24
|
+
require "chef/chef_fs/file_system/repository/containers_dir"
|
23
25
|
require "chef/chef_fs/file_system/repository/data_bags_dir"
|
24
|
-
require "chef/chef_fs/file_system/repository/
|
25
|
-
require "chef/chef_fs/file_system/repository/
|
26
|
-
require "chef/chef_fs/file_system/repository/
|
26
|
+
require "chef/chef_fs/file_system/repository/environments_dir"
|
27
|
+
require "chef/chef_fs/file_system/repository/groups_dir"
|
28
|
+
require "chef/chef_fs/file_system/repository/nodes_dir"
|
29
|
+
require "chef/chef_fs/file_system/repository/policy_groups_dir"
|
30
|
+
require "chef/chef_fs/file_system/repository/roles_dir"
|
31
|
+
require "chef/chef_fs/file_system/repository/users_dir"
|
32
|
+
require "chef/chef_fs/file_system/repository/client_keys_dir"
|
33
|
+
require "chef/chef_fs/file_system/repository/file_system_entry"
|
34
|
+
require "chef/chef_fs/file_system/repository/policies_dir"
|
27
35
|
require "chef/chef_fs/file_system/repository/versioned_cookbooks_dir"
|
28
36
|
require "chef/chef_fs/file_system/multiplexed_dir"
|
29
37
|
require "chef/chef_fs/data_handler/client_data_handler"
|
@@ -142,7 +150,7 @@ class Chef
|
|
142
150
|
existing_paths = root_paths.select { |path| File.exists?(path) }
|
143
151
|
if existing_paths.size > 0
|
144
152
|
MultiplexedDir.new(existing_paths.map do |path|
|
145
|
-
dir =
|
153
|
+
dir = FileSystemEntry.new(name, parent, path)
|
146
154
|
dir.write_pretty_json = !!write_pretty_json
|
147
155
|
dir
|
148
156
|
end)
|
@@ -166,6 +174,14 @@ class Chef
|
|
166
174
|
return NonexistentFSObject.new(name, self)
|
167
175
|
end
|
168
176
|
case name
|
177
|
+
when "acls"
|
178
|
+
dirs = paths.map { |path| AclsDir.new(name, self, path) }
|
179
|
+
when "client_keys"
|
180
|
+
dirs = paths.map { |path| ClientKeysDir.new(name, self, path) }
|
181
|
+
when "clients"
|
182
|
+
dirs = paths.map { |path| ClientsDir.new(name, self, path) }
|
183
|
+
when "containers"
|
184
|
+
dirs = paths.map { |path| ContainersDir.new(name, self, path) }
|
169
185
|
when "cookbooks"
|
170
186
|
if versioned_cookbooks
|
171
187
|
dirs = paths.map { |path| VersionedCookbooksDir.new(name, self, path) }
|
@@ -174,36 +190,24 @@ class Chef
|
|
174
190
|
end
|
175
191
|
when "cookbook_artifacts"
|
176
192
|
dirs = paths.map { |path| CookbookArtifactsDir.new(name, self, path) }
|
177
|
-
when "policies"
|
178
|
-
dirs = paths.map { |path| ChefRepositoryFileSystemPoliciesDir.new(name, self, path) }
|
179
193
|
when "data_bags"
|
180
194
|
dirs = paths.map { |path| DataBagsDir.new(name, self, path) }
|
181
|
-
when "
|
182
|
-
dirs = paths.map { |path|
|
183
|
-
when "
|
184
|
-
dirs = paths.map { |path|
|
195
|
+
when "environments"
|
196
|
+
dirs = paths.map { |path| EnvironmentsDir.new(name, self, path) }
|
197
|
+
when "groups"
|
198
|
+
dirs = paths.map { |path| GroupsDir.new(name, self, path) }
|
199
|
+
when "nodes"
|
200
|
+
dirs = paths.map { |path| NodesDir.new(name, self, path) }
|
201
|
+
when "policy_groups"
|
202
|
+
dirs = paths.map { |path| PolicyGroupsDir.new(name, self, path) }
|
203
|
+
when "policies"
|
204
|
+
dirs = paths.map { |path| PoliciesDir.new(name, self, path) }
|
205
|
+
when "roles"
|
206
|
+
dirs = paths.map { |path| RolesDir.new(name, self, path) }
|
207
|
+
when "users"
|
208
|
+
dirs = paths.map { |path| UsersDir.new(name, self, path) }
|
185
209
|
else
|
186
|
-
|
187
|
-
when "clients"
|
188
|
-
Chef::ChefFS::DataHandler::ClientDataHandler.new
|
189
|
-
when "environments"
|
190
|
-
Chef::ChefFS::DataHandler::EnvironmentDataHandler.new
|
191
|
-
when "nodes"
|
192
|
-
Chef::ChefFS::DataHandler::NodeDataHandler.new
|
193
|
-
when "policy_groups"
|
194
|
-
Chef::ChefFS::DataHandler::PolicyGroupDataHandler.new
|
195
|
-
when "roles"
|
196
|
-
Chef::ChefFS::DataHandler::RoleDataHandler.new
|
197
|
-
when "users"
|
198
|
-
Chef::ChefFS::DataHandler::UserDataHandler.new
|
199
|
-
when "groups"
|
200
|
-
Chef::ChefFS::DataHandler::GroupDataHandler.new
|
201
|
-
when "containers"
|
202
|
-
Chef::ChefFS::DataHandler::ContainerDataHandler.new
|
203
|
-
else
|
204
|
-
raise "Unknown top level path #{name}"
|
205
|
-
end
|
206
|
-
dirs = paths.map { |path| ChefRepositoryFileSystemEntry.new(name, self, path, data_handler) }
|
210
|
+
raise "Unknown top level path #{name}"
|
207
211
|
end
|
208
212
|
MultiplexedDir.new(dirs)
|
209
213
|
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
#
|
2
|
+
# Author:: Thom May (<thom@chef.io>)
|
3
|
+
# Copyright:: Copyright 2013-2016, Chef Software Inc.
|
4
|
+
# License:: Apache License, Version 2.0
|
5
|
+
#
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
+
# you may not use this file except in compliance with the License.
|
8
|
+
# You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
# See the License for the specific language governing permissions and
|
16
|
+
# limitations under the License.
|
17
|
+
#
|
18
|
+
|
19
|
+
require "chef/chef_fs/data_handler/client_data_handler"
|
20
|
+
require "chef/chef_fs/file_system/repository/base_file"
|
21
|
+
|
22
|
+
class Chef
|
23
|
+
module ChefFS
|
24
|
+
module FileSystem
|
25
|
+
module Repository
|
26
|
+
|
27
|
+
class Client < BaseFile
|
28
|
+
|
29
|
+
def initialize(name, parent)
|
30
|
+
@data_handler = Chef::ChefFS::DataHandler::ClientDataHandler.new
|
31
|
+
super
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
#
|
2
|
+
# Author:: Thom May (<thom@chef.io>)
|
3
|
+
# Copyright:: Copyright 2013-2016, Chef Software Inc.
|
4
|
+
# License:: Apache License, Version 2.0
|
5
|
+
#
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
+
# you may not use this file except in compliance with the License.
|
8
|
+
# You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
# See the License for the specific language governing permissions and
|
16
|
+
# limitations under the License.
|
17
|
+
#
|
18
|
+
|
19
|
+
require "chef/chef_fs/data_handler/client_key_data_handler"
|
20
|
+
require "chef/chef_fs/file_system/repository/base_file"
|
21
|
+
|
22
|
+
class Chef
|
23
|
+
module ChefFS
|
24
|
+
module FileSystem
|
25
|
+
module Repository
|
26
|
+
|
27
|
+
class ClientKey < BaseFile
|
28
|
+
|
29
|
+
def initialize(name, parent)
|
30
|
+
@data_handler = Chef::ChefFS::DataHandler::ClientKeyDataHandler.new
|
31
|
+
super
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -16,21 +16,25 @@
|
|
16
16
|
# limitations under the License.
|
17
17
|
#
|
18
18
|
|
19
|
-
require "chef/chef_fs/file_system/repository/
|
19
|
+
require "chef/chef_fs/file_system/repository/client_keys_sub_dir"
|
20
20
|
require "chef/chef_fs/data_handler/client_key_data_handler"
|
21
|
+
require "chef/chef_fs/file_system/repository/directory"
|
21
22
|
|
22
23
|
class Chef
|
23
24
|
module ChefFS
|
24
25
|
module FileSystem
|
25
26
|
module Repository
|
26
|
-
class
|
27
|
-
def initialize(name, parent, path = nil)
|
28
|
-
super(name, parent, path, Chef::ChefFS::DataHandler::ClientKeyDataHandler.new)
|
29
|
-
end
|
27
|
+
class ClientKeysDir < Repository::Directory
|
30
28
|
|
31
29
|
def can_have_child?(name, is_dir)
|
32
30
|
is_dir && !name.start_with?(".")
|
33
31
|
end
|
32
|
+
|
33
|
+
protected
|
34
|
+
|
35
|
+
def make_child_entry(child_name)
|
36
|
+
ClientKeysSubDir.new(child_name, self)
|
37
|
+
end
|
34
38
|
end
|
35
39
|
end
|
36
40
|
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
#
|
2
|
+
# Author:: Jordan Running (<jr@chef.io>)
|
3
|
+
# Copyright:: Copyright 2013-2016, Chef Software Inc.
|
4
|
+
# License:: Apache License, Version 2.0
|
5
|
+
#
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
+
# you may not use this file except in compliance with the License.
|
8
|
+
# You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
# See the License for the specific language governing permissions and
|
16
|
+
# limitations under the License.
|
17
|
+
#
|
18
|
+
|
19
|
+
require "chef/chef_fs/file_system/repository/client_key"
|
20
|
+
require "chef/chef_fs/data_handler/client_key_data_handler"
|
21
|
+
require "chef/chef_fs/file_system/repository/directory"
|
22
|
+
|
23
|
+
class Chef
|
24
|
+
module ChefFS
|
25
|
+
module FileSystem
|
26
|
+
module Repository
|
27
|
+
class ClientKeysSubDir < Repository::Directory
|
28
|
+
|
29
|
+
def can_have_child?(name, is_dir)
|
30
|
+
!is_dir && File.extname(name) == ".json"
|
31
|
+
end
|
32
|
+
|
33
|
+
protected
|
34
|
+
|
35
|
+
def make_child_entry(child_name)
|
36
|
+
ClientKey.new(child_name, self)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
#
|
2
|
+
# Author:: John Keiser (<jkeiser@chef.io>)
|
3
|
+
# Author:: Ho-Sheng Hsiao (<hosh@chef.io>)
|
4
|
+
# Copyright:: Copyright 2012-2016, Chef Software Inc.
|
5
|
+
# License:: Apache License, Version 2.0
|
6
|
+
#
|
7
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
8
|
+
# you may not use this file except in compliance with the License.
|
9
|
+
# You may obtain a copy of the License at
|
10
|
+
#
|
11
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
+
#
|
13
|
+
# Unless required by applicable law or agreed to in writing, software
|
14
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
15
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
16
|
+
# See the License for the specific language governing permissions and
|
17
|
+
# limitations under the License.
|
18
|
+
#
|
19
|
+
|
20
|
+
require "chef/chef_fs/file_system/repository/client"
|
21
|
+
require "chef/chef_fs/file_system/repository/directory"
|
22
|
+
require "chef/chef_fs/file_system/exceptions"
|
23
|
+
|
24
|
+
class Chef
|
25
|
+
module ChefFS
|
26
|
+
module FileSystem
|
27
|
+
module Repository
|
28
|
+
class ClientsDir < Repository::Directory
|
29
|
+
def can_have_child?(name, is_dir)
|
30
|
+
!is_dir && File.extname(name) == ".json"
|
31
|
+
end
|
32
|
+
|
33
|
+
def make_child_entry(child_name)
|
34
|
+
Client.new(child_name, self)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
#
|
2
|
+
# Author:: Thom May (<thom@chef.io>)
|
3
|
+
# Copyright:: Copyright 2013-2016, Chef Software Inc.
|
4
|
+
# License:: Apache License, Version 2.0
|
5
|
+
#
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
+
# you may not use this file except in compliance with the License.
|
8
|
+
# You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
# See the License for the specific language governing permissions and
|
16
|
+
# limitations under the License.
|
17
|
+
#
|
18
|
+
|
19
|
+
require "chef/chef_fs/data_handler/container_data_handler"
|
20
|
+
require "chef/chef_fs/file_system/repository/base_file"
|
21
|
+
|
22
|
+
class Chef
|
23
|
+
module ChefFS
|
24
|
+
module FileSystem
|
25
|
+
module Repository
|
26
|
+
|
27
|
+
class Container < BaseFile
|
28
|
+
|
29
|
+
def initialize(name, parent)
|
30
|
+
@data_handler = Chef::ChefFS::DataHandler::ContainerDataHandler.new
|
31
|
+
super
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
#
|
2
|
+
# Author:: John Keiser (<jkeiser@chef.io>)
|
3
|
+
# Author:: Ho-Sheng Hsiao (<hosh@chef.io>)
|
4
|
+
# Copyright:: Copyright 2012-2016, Chef Software Inc.
|
5
|
+
# License:: Apache License, Version 2.0
|
6
|
+
#
|
7
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
8
|
+
# you may not use this file except in compliance with the License.
|
9
|
+
# You may obtain a copy of the License at
|
10
|
+
#
|
11
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
+
#
|
13
|
+
# Unless required by applicable law or agreed to in writing, software
|
14
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
15
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
16
|
+
# See the License for the specific language governing permissions and
|
17
|
+
# limitations under the License.
|
18
|
+
#
|
19
|
+
|
20
|
+
require "chef/chef_fs/file_system/repository/container"
|
21
|
+
require "chef/chef_fs/file_system/repository/directory"
|
22
|
+
require "chef/chef_fs/file_system/exceptions"
|
23
|
+
|
24
|
+
class Chef
|
25
|
+
module ChefFS
|
26
|
+
module FileSystem
|
27
|
+
module Repository
|
28
|
+
class ContainersDir < Repository::Directory
|
29
|
+
|
30
|
+
def can_have_child?(name, is_dir)
|
31
|
+
!is_dir && File.extname(name) == ".json"
|
32
|
+
end
|
33
|
+
|
34
|
+
def make_child_entry(child_name)
|
35
|
+
Container.new(child_name, self)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -17,7 +17,6 @@
|
|
17
17
|
#
|
18
18
|
|
19
19
|
require "chef/chef_fs/file_system/repository/directory"
|
20
|
-
require "chef/chef_fs/file_system/repository/chef_repository_file_system_entry"
|
21
20
|
require "chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_dir"
|
22
21
|
require "chef/cookbook/chefignore"
|
23
22
|
|
@@ -17,97 +17,21 @@
|
|
17
17
|
#
|
18
18
|
|
19
19
|
require "chef/chef_fs/data_handler/data_bag_item_data_handler"
|
20
|
+
require "chef/chef_fs/file_system/repository/base_file"
|
20
21
|
|
21
22
|
class Chef
|
22
23
|
module ChefFS
|
23
24
|
module FileSystem
|
24
25
|
module Repository
|
25
26
|
|
26
|
-
class DataBagItem
|
27
|
-
|
28
|
-
attr_reader :name
|
29
|
-
attr_reader :parent
|
30
|
-
attr_reader :path
|
31
|
-
attr_reader :file_path
|
27
|
+
class DataBagItem < BaseFile
|
32
28
|
|
33
29
|
def initialize(name, parent)
|
34
|
-
@parent = parent
|
35
|
-
@name = name
|
36
|
-
@path = Chef::ChefFS::PathUtils.join(parent.path, name)
|
37
30
|
@data_handler = Chef::ChefFS::DataHandler::DataBagItemDataHandler.new
|
38
|
-
|
39
|
-
end
|
40
|
-
|
41
|
-
# Public API callied by chef_fs/file_system
|
42
|
-
def dir?
|
43
|
-
false
|
44
|
-
end
|
45
|
-
|
46
|
-
def name_valid?
|
47
|
-
!name.start_with?(".") && name.end_with?(".json")
|
48
|
-
end
|
49
|
-
|
50
|
-
def fs_entry_valid?
|
51
|
-
name_valid? && File.file?(file_path)
|
52
|
-
end
|
53
|
-
|
54
|
-
def create(file_contents)
|
55
|
-
if exists?
|
56
|
-
raise Chef::ChefFS::FileSystem::AlreadyExistsError.new(:create_child, self)
|
57
|
-
else
|
58
|
-
write(file_contents)
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
def can_have_child?(name, is_dir)
|
63
|
-
false
|
64
|
-
end
|
65
|
-
|
66
|
-
def write_pretty_json=(value)
|
67
|
-
@write_pretty_json = value
|
68
|
-
end
|
69
|
-
|
70
|
-
def write_pretty_json
|
71
|
-
@write_pretty_json.nil? ? root.write_pretty_json : @write_pretty_json
|
31
|
+
super
|
72
32
|
end
|
73
33
|
|
74
|
-
def path_for_printing
|
75
|
-
file_path
|
76
|
-
end
|
77
|
-
|
78
|
-
def delete(recurse)
|
79
|
-
File.delete(file_path)
|
80
|
-
rescue Errno::ENOENT
|
81
|
-
raise Chef::ChefFS::FileSystem::NotFoundError.new(self, $!)
|
82
|
-
end
|
83
|
-
|
84
|
-
def exists?
|
85
|
-
File.exists?(file_path)
|
86
|
-
end
|
87
|
-
|
88
|
-
def read
|
89
|
-
begin
|
90
|
-
File.open(file_path, "rb") { |f| f.read }
|
91
|
-
rescue Errno::ENOENT
|
92
|
-
raise Chef::ChefFS::FileSystem::NotFoundError.new(self, $!)
|
93
|
-
end
|
94
|
-
end
|
95
|
-
|
96
|
-
def write(content)
|
97
|
-
File.open(file_path, "wb") do |file|
|
98
|
-
file.write(content)
|
99
|
-
end
|
100
|
-
end
|
101
|
-
|
102
|
-
def root
|
103
|
-
parent.root
|
104
|
-
end
|
105
|
-
|
106
|
-
def compare_to(other)
|
107
|
-
nil
|
108
|
-
end
|
109
34
|
end
|
110
|
-
|
111
35
|
end
|
112
36
|
end
|
113
37
|
end
|