chef 12.9.41 → 12.10.24
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
@@ -1,39 +0,0 @@
|
|
1
|
-
require "mixlib/shellout"
|
2
|
-
require "bundler"
|
3
|
-
|
4
|
-
describe "Chef Fips 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(:chef_dir) do
|
14
|
-
if windows?
|
15
|
-
Dir.glob("c:/opscode/chef/embedded/lib/ruby/gems/*/gems/chef-[0-9]*").last
|
16
|
-
else
|
17
|
-
Dir.glob("/opt/chef/embedded/lib/ruby/gems/*/gems/chef-[0-9]*").last
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
let(:path) do
|
22
|
-
if windows?
|
23
|
-
'C:\opscode\chef\embedded\bin'
|
24
|
-
else
|
25
|
-
"/opt/chef/embedded/bin"
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
it "passes the unit and functional specs" do
|
30
|
-
Bundler.with_clean_env do
|
31
|
-
ruby_cmd = Mixlib::ShellOut.new(
|
32
|
-
"bundle exec rspec -t ~requires_git spec/unit spec/functional", :env => { "PATH" => [ENV["PATH"], path].join(File::PATH_SEPARATOR),
|
33
|
-
"GEM_PATH" => nil, "GEM_CACHE" => nil, "GEM_HOME" => nil,
|
34
|
-
"CHEF_FIPS" => "1" },
|
35
|
-
:live_stream => STDOUT, :cwd => chef_dir, :timeout => 3600)
|
36
|
-
expect { ruby_cmd.run_command.error! }.not_to raise_exception
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
@@ -1,83 +0,0 @@
|
|
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/file_system_entry"
|
21
|
-
require "chef/chef_fs/file_system/exceptions"
|
22
|
-
|
23
|
-
class Chef
|
24
|
-
module ChefFS
|
25
|
-
module FileSystem
|
26
|
-
module Repository
|
27
|
-
# ChefRepositoryFileSystemEntry works just like FileSystemEntry,
|
28
|
-
# except can inflate Chef objects
|
29
|
-
class ChefRepositoryFileSystemEntry < FileSystemEntry
|
30
|
-
def initialize(name, parent, file_path = nil, data_handler = nil)
|
31
|
-
super(name, parent, file_path)
|
32
|
-
@data_handler = data_handler
|
33
|
-
end
|
34
|
-
|
35
|
-
def write_pretty_json=(value)
|
36
|
-
@write_pretty_json = value
|
37
|
-
end
|
38
|
-
|
39
|
-
def write_pretty_json
|
40
|
-
@write_pretty_json.nil? ? root.write_pretty_json : @write_pretty_json
|
41
|
-
end
|
42
|
-
|
43
|
-
def data_handler
|
44
|
-
@data_handler || parent.data_handler
|
45
|
-
end
|
46
|
-
|
47
|
-
def chef_object
|
48
|
-
begin
|
49
|
-
return data_handler.chef_object(Chef::JSONCompat.parse(read))
|
50
|
-
rescue
|
51
|
-
Chef::Log.error("Could not read #{path_for_printing} into a Chef object: #{$!}")
|
52
|
-
end
|
53
|
-
nil
|
54
|
-
end
|
55
|
-
|
56
|
-
def can_have_child?(name, is_dir)
|
57
|
-
!is_dir && name[-5..-1] == ".json"
|
58
|
-
end
|
59
|
-
|
60
|
-
def write(file_contents)
|
61
|
-
if file_contents && write_pretty_json && name[-5..-1] == ".json"
|
62
|
-
file_contents = minimize(file_contents, self)
|
63
|
-
end
|
64
|
-
super(file_contents)
|
65
|
-
end
|
66
|
-
|
67
|
-
def minimize(file_contents, entry)
|
68
|
-
object = Chef::JSONCompat.parse(file_contents)
|
69
|
-
object = data_handler.normalize(object, entry)
|
70
|
-
object = data_handler.minimize(object, entry)
|
71
|
-
Chef::JSONCompat.to_json_pretty(object)
|
72
|
-
end
|
73
|
-
|
74
|
-
protected
|
75
|
-
|
76
|
-
def make_child_entry(child_name)
|
77
|
-
ChefRepositoryFileSystemEntry.new(child_name, self)
|
78
|
-
end
|
79
|
-
end
|
80
|
-
end
|
81
|
-
end
|
82
|
-
end
|
83
|
-
end
|
data/tasks/external_tests.rb
DELETED
@@ -1,64 +0,0 @@
|
|
1
|
-
require "tempfile"
|
2
|
-
require "bundler"
|
3
|
-
|
4
|
-
CURRENT_GEM_NAME = "chef"
|
5
|
-
CURRENT_GEM_PATH = File.expand_path("../..", __FILE__)
|
6
|
-
|
7
|
-
def bundle_exec_with_chef(test_gem, commands)
|
8
|
-
gem_path = Bundler.environment.specs[test_gem].first.full_gem_path
|
9
|
-
gemfile_path = File.join(gem_path, "Gemfile.#{CURRENT_GEM_NAME}-external-test")
|
10
|
-
gemfile = File.open(gemfile_path, "w")
|
11
|
-
begin
|
12
|
-
IO.read(File.join(gem_path, "Gemfile")).each_line do |line|
|
13
|
-
if line =~ /^\s*gemspec/
|
14
|
-
next
|
15
|
-
elsif line =~ /^\s*gem '#{CURRENT_GEM_NAME}'|\s*gem "#{CURRENT_GEM_NAME}"/
|
16
|
-
next
|
17
|
-
elsif line =~ /^\s*dev_gem\s*['"](.+)['"]\s*$/
|
18
|
-
line = "gem '#{$1}', github: 'poise/#{$1}'"
|
19
|
-
elsif line =~ /\s*gem\s*['"]#{test_gem}['"]/ # foodcritic end
|
20
|
-
next
|
21
|
-
end
|
22
|
-
gemfile.puts(line)
|
23
|
-
end
|
24
|
-
gemfile.puts("gem #{CURRENT_GEM_NAME.inspect}, path: #{CURRENT_GEM_PATH.inspect}")
|
25
|
-
gemfile.puts("gemspec path: #{gem_path.inspect}")
|
26
|
-
gemfile.close
|
27
|
-
Dir.chdir(gem_path) do
|
28
|
-
Bundler.with_clean_env do
|
29
|
-
unless system({ "BUNDLE_GEMFILE" => gemfile_path, "RUBYOPT" => nil, "GEMFILE_MOD" => nil }, "bundle update")
|
30
|
-
raise "Error running bundle update of #{gemfile_path} in #{gem_path}: #{$?.exitstatus}\nGemfile:\n#{IO.read(gemfile_path)}"
|
31
|
-
end
|
32
|
-
Array(commands).each do |command|
|
33
|
-
unless system({ "BUNDLE_GEMFILE" => gemfile_path, "RUBYOPT" => nil, "GEMFILE_MOD" => nil }, "bundle exec #{command}")
|
34
|
-
raise "Error running bundle exec #{command} in #{gem_path} with BUNDLE_GEMFILE=#{gemfile_path}: #{$?.exitstatus}\nGemfile:\n#{IO.read(gemfile_path)}"
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
ensure
|
40
|
-
File.delete(gemfile_path) if File.exist?(gemfile_path)
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
EXTERNAL_PROJECTS = {
|
45
|
-
"chef-zero" => [ "rake spec", "rake cheffs" ],
|
46
|
-
"cheffish" => "rake spec",
|
47
|
-
"chef-provisioning" => "rake spec",
|
48
|
-
"chef-provisioning-aws" => "rake spec",
|
49
|
-
"chef-sugar" => "rake",
|
50
|
-
"foodcritic" => "rake test",
|
51
|
-
"chefspec" => "rake",
|
52
|
-
"chef-rewind" => "rake spec",
|
53
|
-
"poise" => "rake spec",
|
54
|
-
"halite" => "rake spec",
|
55
|
-
"knife-windows" => "rake unit_spec",
|
56
|
-
}
|
57
|
-
|
58
|
-
task :external_specs => EXTERNAL_PROJECTS.keys.map { |g| :"#{g.sub("-", "_")}_spec" }
|
59
|
-
|
60
|
-
EXTERNAL_PROJECTS.each do |test_gem, commands|
|
61
|
-
task :"#{test_gem.tr("-", "_")}_spec" do
|
62
|
-
bundle_exec_with_chef(test_gem, commands)
|
63
|
-
end
|
64
|
-
end
|