chef 12.9.41-universal-mingw32 → 12.10.24-universal-mingw32
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 +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
File without changes
|
@@ -0,0 +1,51 @@
|
|
1
|
+
require "mixlib/shellout"
|
2
|
+
require "bundler"
|
3
|
+
|
4
|
+
describe "Chef Fips Integration Specs" do
|
5
|
+
def windows?
|
6
|
+
if RUBY_PLATFORM =~ /mswin|mingw|windows/
|
7
|
+
true
|
8
|
+
else
|
9
|
+
false
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
let(:omnibus_root) do
|
14
|
+
if windows?
|
15
|
+
"c:/opscode/chef"
|
16
|
+
else
|
17
|
+
"/opt/chef"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
let(:env) do
|
22
|
+
{
|
23
|
+
"PATH" => [ "#{omnibus_root}/embedded/bin", ENV["PATH"] ].join(File::PATH_SEPARATOR),
|
24
|
+
"BUNDLE_GEMFILE" => "#{omnibus_root}/Gemfile",
|
25
|
+
"GEM_PATH" => nil, "GEM_CACHE" => nil, "GEM_HOME" => nil,
|
26
|
+
"BUNDLE_IGNORE_CONFIG" => "true",
|
27
|
+
"BUNDLE_FROZEN" => "1",
|
28
|
+
"CHEF_FIPS" => "1"
|
29
|
+
}
|
30
|
+
end
|
31
|
+
|
32
|
+
let(:chef_dir) do
|
33
|
+
cmd = Mixlib::ShellOut.new("bundle show chef", env: env).run_command
|
34
|
+
cmd.error!
|
35
|
+
cmd.stdout.chomp
|
36
|
+
end
|
37
|
+
|
38
|
+
def run_rspec_test(test)
|
39
|
+
Bundler.with_clean_env do
|
40
|
+
cmd = Mixlib::ShellOut.new(
|
41
|
+
"bundle exec rspec -f documentation -t ~requires_git #{test}",
|
42
|
+
env: env, cwd: chef_dir, timeout: 3600
|
43
|
+
)
|
44
|
+
cmd.run_command.error!
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
it "passes the integration specs" do
|
49
|
+
run_rspec_test("spec/integration")
|
50
|
+
end
|
51
|
+
end
|
data/acceptance/fips/test/integration/fips-unit-functional/serverspec/fips-unit-functional_spec.rb
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
require "mixlib/shellout"
|
2
|
+
require "bundler"
|
3
|
+
|
4
|
+
describe "Chef Fips Unit/Functional Specs" do
|
5
|
+
def windows?
|
6
|
+
if RUBY_PLATFORM =~ /mswin|mingw|windows/
|
7
|
+
true
|
8
|
+
else
|
9
|
+
false
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
let(:omnibus_root) do
|
14
|
+
if windows?
|
15
|
+
"c:/opscode/chef"
|
16
|
+
else
|
17
|
+
"/opt/chef"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
let(:env) do
|
22
|
+
{
|
23
|
+
"PATH" => [ "#{omnibus_root}/embedded/bin", ENV["PATH"] ].join(File::PATH_SEPARATOR),
|
24
|
+
"BUNDLE_GEMFILE" => "#{omnibus_root}/Gemfile",
|
25
|
+
"GEM_PATH" => nil, "GEM_CACHE" => nil, "GEM_HOME" => nil,
|
26
|
+
"BUNDLE_IGNORE_CONFIG" => "true",
|
27
|
+
"BUNDLE_FROZEN" => "1",
|
28
|
+
"CHEF_FIPS" => "1"
|
29
|
+
}
|
30
|
+
end
|
31
|
+
|
32
|
+
let(:chef_dir) do
|
33
|
+
cmd = Mixlib::ShellOut.new("bundle show chef", env: env).run_command
|
34
|
+
cmd.error!
|
35
|
+
cmd.stdout.chomp
|
36
|
+
end
|
37
|
+
|
38
|
+
def run_rspec_test(test)
|
39
|
+
Bundler.with_clean_env do
|
40
|
+
cmd = Mixlib::ShellOut.new(
|
41
|
+
"bundle exec rspec -f documentation -t ~requires_git #{test}",
|
42
|
+
env: env, cwd: chef_dir, timeout: 3600
|
43
|
+
)
|
44
|
+
cmd.run_command.error!
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
it "passes the unit specs" do
|
49
|
+
run_rspec_test("spec/unit")
|
50
|
+
end
|
51
|
+
|
52
|
+
it "passes the functional specs" do
|
53
|
+
run_rspec_test("spec/functional")
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
File without changes
|
data/chef.gemspec
CHANGED
@@ -50,12 +50,6 @@ Gem::Specification.new do |s|
|
|
50
50
|
# very deliberately avoiding putting a ceiling on this to avoid depsolver conflicts.
|
51
51
|
s.add_dependency "bundler", ">= 1.10"
|
52
52
|
|
53
|
-
s.add_development_dependency "rack"
|
54
|
-
s.add_development_dependency "cheffish", ">= 1.1", "< 3.0"
|
55
|
-
s.add_development_dependency "github_changelog_generator", "1.11.3"
|
56
|
-
|
57
|
-
s.add_development_dependency "rake", "~> 10.1"
|
58
|
-
|
59
53
|
s.bindir = "bin"
|
60
54
|
s.executables = %w{ chef-client chef-solo knife chef-shell chef-apply }
|
61
55
|
|
File without changes
|
File without changes
|
data/{lib → lib-backcompat}/chef/chef_fs/file_system/default_environment_cannot_be_modified_error.rb
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,6 @@
|
|
1
|
+
require "chef/chef_fs/file_system/repository/file_system_entry"
|
2
|
+
|
3
|
+
module Chef::ChefFS::FileSystem::Repository
|
4
|
+
Chef.log_deprecation "Chef::ChefFS::FileSystem::Repository::ChefRepositoryFileSystemEntry is deprecated. Please use FileSystemEntry directly"
|
5
|
+
ChefRepositoryFileSystemEntry = FileSystemEntry
|
6
|
+
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/acl_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 Acl < BaseFile
|
28
|
+
|
29
|
+
def initialize(name, parent)
|
30
|
+
@data_handler = Chef::ChefFS::DataHandler::AclDataHandler.new
|
31
|
+
super
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
data/lib/chef/chef_fs/file_system/repository/{chef_repository_file_system_acls_dir.rb → acls_dir.rb}
RENAMED
@@ -16,7 +16,9 @@
|
|
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/acl"
|
20
|
+
require "chef/chef_fs/file_system/repository/directory"
|
21
|
+
require "chef/chef_fs/file_system/repository/acls_sub_dir"
|
20
22
|
require "chef/chef_fs/file_system/chef_server/acls_dir"
|
21
23
|
require "chef/chef_fs/data_handler/acl_data_handler"
|
22
24
|
|
@@ -24,14 +26,21 @@ class Chef
|
|
24
26
|
module ChefFS
|
25
27
|
module FileSystem
|
26
28
|
module Repository
|
27
|
-
class
|
28
|
-
def initialize(name, parent, path = nil)
|
29
|
-
super(name, parent, path, Chef::ChefFS::DataHandler::AclDataHandler.new)
|
30
|
-
end
|
29
|
+
class AclsDir < Repository::Directory
|
31
30
|
|
32
31
|
def can_have_child?(name, is_dir)
|
33
32
|
is_dir ? Chef::ChefFS::FileSystem::ChefServer::AclsDir::ENTITY_TYPES.include?(name) : name == "organization.json"
|
34
33
|
end
|
34
|
+
|
35
|
+
protected
|
36
|
+
|
37
|
+
def make_child_entry(child_name)
|
38
|
+
if child_name == "organization.json"
|
39
|
+
Acl.new(child_name, self)
|
40
|
+
else
|
41
|
+
AclsSubDir.new(child_name, self)
|
42
|
+
end
|
43
|
+
end
|
35
44
|
end
|
36
45
|
end
|
37
46
|
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/acl"
|
20
|
+
require "chef/chef_fs/data_handler/acl_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 AclsSubDir < 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
|
+
Acl.new(child_name, self)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,120 @@
|
|
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
|
+
class Chef
|
20
|
+
module ChefFS
|
21
|
+
module FileSystem
|
22
|
+
module Repository
|
23
|
+
|
24
|
+
class BaseFile
|
25
|
+
|
26
|
+
attr_reader :name
|
27
|
+
attr_reader :parent
|
28
|
+
attr_reader :path
|
29
|
+
attr_reader :file_path
|
30
|
+
attr_reader :data_handler
|
31
|
+
|
32
|
+
def initialize(name, parent)
|
33
|
+
@parent = parent
|
34
|
+
@name = name
|
35
|
+
@path = Chef::ChefFS::PathUtils.join(parent.path, name)
|
36
|
+
@file_path = "#{parent.file_path}/#{name}"
|
37
|
+
end
|
38
|
+
|
39
|
+
def dir?
|
40
|
+
false
|
41
|
+
end
|
42
|
+
|
43
|
+
def is_json_file?
|
44
|
+
File.extname(name) == ".json"
|
45
|
+
end
|
46
|
+
|
47
|
+
def name_valid?
|
48
|
+
!name.start_with?(".") && is_json_file?
|
49
|
+
end
|
50
|
+
|
51
|
+
def fs_entry_valid?
|
52
|
+
name_valid? && exists?
|
53
|
+
end
|
54
|
+
|
55
|
+
def create(file_contents)
|
56
|
+
if exists?
|
57
|
+
raise Chef::ChefFS::FileSystem::AlreadyExistsError.new(:create_child, self)
|
58
|
+
else
|
59
|
+
write(file_contents)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
def can_have_child?(name, is_dir)
|
64
|
+
false
|
65
|
+
end
|
66
|
+
|
67
|
+
attr_writer :write_pretty_json
|
68
|
+
def write_pretty_json
|
69
|
+
@write_pretty_json.nil? ? root.write_pretty_json : @write_pretty_json
|
70
|
+
end
|
71
|
+
|
72
|
+
def path_for_printing
|
73
|
+
file_path
|
74
|
+
end
|
75
|
+
|
76
|
+
def delete(_)
|
77
|
+
File.delete(file_path)
|
78
|
+
rescue Errno::ENOENT
|
79
|
+
raise Chef::ChefFS::FileSystem::NotFoundError.new(self, $!)
|
80
|
+
end
|
81
|
+
|
82
|
+
def exists?
|
83
|
+
File.file?(file_path)
|
84
|
+
end
|
85
|
+
|
86
|
+
def minimize(content, entry)
|
87
|
+
object = Chef::JSONCompat.parse(content)
|
88
|
+
object = data_handler.normalize(object, entry)
|
89
|
+
object = data_handler.minimize(object, entry)
|
90
|
+
Chef::JSONCompat.to_json_pretty(object)
|
91
|
+
end
|
92
|
+
|
93
|
+
def read
|
94
|
+
File.open(file_path, "rb") { |f| f.read }
|
95
|
+
rescue Errno::ENOENT
|
96
|
+
raise Chef::ChefFS::FileSystem::NotFoundError.new(self, $!)
|
97
|
+
end
|
98
|
+
|
99
|
+
def write(content)
|
100
|
+
if content && write_pretty_json && is_json_file?
|
101
|
+
content = minimize(content, self)
|
102
|
+
end
|
103
|
+
File.open(file_path, "wb") do |file|
|
104
|
+
file.write(content)
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
def root
|
109
|
+
parent.root
|
110
|
+
end
|
111
|
+
|
112
|
+
def compare_to(other)
|
113
|
+
nil
|
114
|
+
end
|
115
|
+
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
@@ -16,7 +16,7 @@
|
|
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/file_system_entry"
|
20
20
|
require "chef/chef_fs/file_system/repository/cookbooks_dir"
|
21
21
|
require "chef/chef_fs/file_system/exceptions"
|
22
22
|
|