diff options
29 files changed, 233 insertions, 199 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index ce6551c3eb..809a965d8e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,14 +1,20 @@ +## 12.7.1 +* [**Daniel Steen**](https://github.com/dansteen) + * [pr#3183](https://github.com/chef/chef/pull/3183) Provide more helpful error message when accidentally using --secret instead of --secret-file + +* [pr#4532](https://github.com/chef/chef/pull/4532) Bump Bundler + Rubygems +* [pr#4550](https://github.com/chef/chef/pull/4550) Use a streaming request to download cookbook ## 12.7.0 * [**Nate Walck**](https://github.com/natewalck) - [pr#4078](https://github.com/chef/chef/pull/4078) Add `osx_profile` resource for OS X + * [pr#4078](https://github.com/chef/chef/pull/4078) Add `osx_profile` resource for OS X * [**Timothy Cyrus**](https://github.com/tcyrus) - [pr#4420](https://github.com/chef/chef/pull/4420) Update code climate badge and code climate blocks in README.md + * [pr#4420](https://github.com/chef/chef/pull/4420) Update code climate badge and code climate blocks in README.md * [**Jordan Running**](https://github.com/jrunning) - [pr#4399](https://github.com/chef/chef/pull/4399) Correctly save policy_name and policy_group with `knife node edit` + * [pr#4399](https://github.com/chef/chef/pull/4399) Correctly save policy_name and policy_group with `knife node edit` * [**Brian Goad**](https://github.com/bbbco) - [pr#4315](https://github.com/chef/chef/pull/4315) Add extra tests around whether to skip with multiple guards + * [pr#4315](https://github.com/chef/chef/pull/4315) Add extra tests around whether to skip with multiple guards * [pr#4516](https://github.com/chef/chef/pull/4516) Return propper error messages when using windows based `mount`, `user` and `group` resources * [pr#4500](https://github.com/chef/chef/pull/4500) Explicitly declare directory permissions of chef install on windows to restrict rights on Windows client versions @@ -20,38 +26,38 @@ * [pr#4479](https://github.com/chef/chef/pull/4479) Remove incorrect cookbook artifact normalization * [pr#4470](https://github.com/chef/chef/pull/4470) Fix sh spacing issues * [pr#4434](https://github.com/chef/chef/pull/4434) adds EOFError message to handlers -* [pr#4422](https://github.com/chef/chef/pull/4422) Add an apt_update resource -* [pr#4287](https://github.com/chef/chef/pull/4287) Default Chef with FIPS OpenSSL to use sign v1.3 -* [pr#4461](https://github.com/chef/chef/pull/4461) debian-6 is EOL next month -* [pr#4460](https://github.com/chef/chef/pull/4460) Set range of system user/group id to max of 200 -* [pr#4231](https://github.com/chef/chef/pull/4231) zypper multipackage patch -* [pr#4459](https://github.com/chef/chef/pull/4459) use require_paths and not path so bundler grabs all paths from a git reference -* [pr#4450](https://github.com/chef/chef/pull/4450) don't warn about ambiguous property usage -* [pr#4445](https://github.com/chef/chef/pull/4445) Add CBGB to the repository -* [pr#4423](https://github.com/chef/chef/pull/4423) Add deprecation warnings to Chef::REST and all json_creates -* [pr#4439](https://github.com/chef/chef/pull/4439) Sometimes chocolately doesn't appear on the path -* [pr#4432](https://github.com/chef/chef/pull/4432) add get_rest etc calls to ServerAPI -* [pr#4435](https://github.com/chef/chef/pull/4435) add nokogiri to omnibus-chef -* [pr#4419](https://github.com/chef/chef/pull/4419) explicitly adding .bat to service executable called by service in case users remove .bat from PATHEXT -* [pr#4413](https://github.com/chef/chef/pull/4413) configure chef client windows service to the correct chef directory -* [pr#4377](https://github.com/chef/chef/pull/4377) fixing candidate filtering and adding functional tests for chocolatey_package -* [pr#4406](https://github.com/chef/chef/pull/4406) Updating to the latest release of net-ssh to consume https://github.com/net-ssh/net-ssh/pull/280 -* [pr#4405](https://github.com/chef/chef/pull/4405) ServerAPI will return a raw hash, so do that -* [pr#4400](https://github.com/chef/chef/pull/4400) inflate an environment after loading it -* [pr#4396](https://github.com/chef/chef/pull/4396) Remove duplicate initialization of @password in user_v1 -* [pr#4344](https://github.com/chef/chef/pull/4344) Warn (v. info) when reloading resources -* [pr#4369](https://github.com/chef/chef/pull/4369) Migrate omnibus-chef project/software definitions for chef in here -* [pr#4106](https://github.com/chef/chef/pull/4106) add chocolatey_package to core chef -* [pr#4321](https://github.com/chef/chef/pull/4321) fix run_as_user of windows_service -* [pr#4333](https://github.com/chef/chef/pull/4333) no longer wait on node search to refresh vault but pass created ApiCient instead -* [pr#4325](https://github.com/chef/chef/pull/4325) Pin win32-eventlog to 0.6.3 to avoid clashing CreateEvent definition -* [pr#4312](https://github.com/chef/chef/pull/4312) Updates the template to use omnitruck-direct.chef.io -* [pr#4277](https://github.com/chef/chef/pull/4277) non msi packages must explicitly provide a source attribute on install -* [pr#4309](https://github.com/chef/chef/pull/4309) tags always an array; fix set_unless -* [pr#4278](https://github.com/chef/chef/pull/4278) make file resource use properties -* [pr#4288](https://github.com/chef/chef/pull/4288) Fix no_proxy setting in chef-config -* [pr#4273](https://github.com/chef/chef/pull/4273) Use signing protocol 1.1 by default -* [pr#4520](https://github.com/chef/chef/pull/4520) Fix a few `dsc_resource` bugs +* [pr#4422](https://github.com/chef/chef/pull/4422) Add an apt_update resource +* [pr#4287](https://github.com/chef/chef/pull/4287) Default Chef with FIPS OpenSSL to use sign v1.3 +* [pr#4461](https://github.com/chef/chef/pull/4461) debian-6 is EOL next month +* [pr#4460](https://github.com/chef/chef/pull/4460) Set range of system user/group id to max of 200 +* [pr#4231](https://github.com/chef/chef/pull/4231) zypper multipackage patch +* [pr#4459](https://github.com/chef/chef/pull/4459) use require_paths and not path so bundler grabs all paths from a git reference +* [pr#4450](https://github.com/chef/chef/pull/4450) don't warn about ambiguous property usage +* [pr#4445](https://github.com/chef/chef/pull/4445) Add CBGB to the repository +* [pr#4423](https://github.com/chef/chef/pull/4423) Add deprecation warnings to Chef::REST and all json_creates +* [pr#4439](https://github.com/chef/chef/pull/4439) Sometimes chocolately doesn't appear on the path +* [pr#4432](https://github.com/chef/chef/pull/4432) add get_rest etc calls to ServerAPI +* [pr#4435](https://github.com/chef/chef/pull/4435) add nokogiri to omnibus-chef +* [pr#4419](https://github.com/chef/chef/pull/4419) explicitly adding .bat to service executable called by service in case users remove .bat from PATHEXT +* [pr#4413](https://github.com/chef/chef/pull/4413) configure chef client windows service to the correct chef directory +* [pr#4377](https://github.com/chef/chef/pull/4377) fixing candidate filtering and adding functional tests for chocolatey_package +* [pr#4406](https://github.com/chef/chef/pull/4406) Updating to the latest release of net-ssh to consume https://github.com/net-ssh/net-ssh/pull/280 +* [pr#4405](https://github.com/chef/chef/pull/4405) ServerAPI will return a raw hash, so do that +* [pr#4400](https://github.com/chef/chef/pull/4400) inflate an environment after loading it +* [pr#4396](https://github.com/chef/chef/pull/4396) Remove duplicate initialization of @password in user_v1 +* [pr#4344](https://github.com/chef/chef/pull/4344) Warn (v. info) when reloading resources +* [pr#4369](https://github.com/chef/chef/pull/4369) Migrate omnibus-chef project/software definitions for chef in here +* [pr#4106](https://github.com/chef/chef/pull/4106) add chocolatey_package to core chef +* [pr#4321](https://github.com/chef/chef/pull/4321) fix run_as_user of windows_service +* [pr#4333](https://github.com/chef/chef/pull/4333) no longer wait on node search to refresh vault but pass created ApiCient instead +* [pr#4325](https://github.com/chef/chef/pull/4325) Pin win32-eventlog to 0.6.3 to avoid clashing CreateEvent definition +* [pr#4312](https://github.com/chef/chef/pull/4312) Updates the template to use omnitruck-direct.chef.io +* [pr#4277](https://github.com/chef/chef/pull/4277) non msi packages must explicitly provide a source attribute on install +* [pr#4309](https://github.com/chef/chef/pull/4309) tags always an array; fix set_unless +* [pr#4278](https://github.com/chef/chef/pull/4278) make file resource use properties +* [pr#4288](https://github.com/chef/chef/pull/4288) Fix no_proxy setting in chef-config +* [pr#4273](https://github.com/chef/chef/pull/4273) Use signing protocol 1.1 by default +* [pr#4520](https://github.com/chef/chef/pull/4520) Fix a few `dsc_resource` bugs ## 12.6.0 @@ -1 +1 @@ -12.7.0 +12.7.1 diff --git a/acceptance/.shared/kitchen_acceptance/.kitchen.ec2.yml b/acceptance/.shared/kitchen_acceptance/.kitchen.ec2.yml index fc82c907e6..e4b2211c8b 100644 --- a/acceptance/.shared/kitchen_acceptance/.kitchen.ec2.yml +++ b/acceptance/.shared/kitchen_acceptance/.kitchen.ec2.yml @@ -30,6 +30,8 @@ provisioner: product_name: <%= ENV["KITCHEN_CHEF_PRODUCT"] %> product_version: <%= ENV["KITCHEN_CHEF_VERSION"] %> channel: <%= ENV["KITCHEN_CHEF_CHANNEL"] %> + client_rb: + audit_mode: :enabled platforms: # @@ -44,7 +46,7 @@ platforms: driver: image_search: name: debian-jessie-* - owner-id: 379101102735 + owner-id: "379101102735" architecture: x86_64 virtualization-type: hvm block-device-mapping.volume-type: gp2 @@ -55,7 +57,7 @@ platforms: driver: image_search: name: debian-wheezy-* - owner-id: 379101102735 + owner-id: "379101102735" architecture: x86_64 virtualization-type: hvm block-device-mapping.volume-type: standard @@ -69,7 +71,7 @@ platforms: driver: image_search: name: ubuntu/images/*/ubuntu-*-15.10-amd64-server-* - owner-id: 099720109477 + owner-id: "099720109477" architecture: x86_64 virtualization-type: hvm block-device-mapping.volume-type: gp2 @@ -80,24 +82,24 @@ platforms: driver: image_search: name: ubuntu/images/*/ubuntu-*-14.04-*-server-* - owner-id: 099720109477 + owner-id: "099720109477" + architecture: x86_64 + virtualization-type: hvm + block-device-mapping.volume-type: gp2 + image-type: machine + transport: + username: ubuntu + - name: ubuntu-12.04 + driver: + image_search: + name: ubuntu/images/*/ubuntu-*-12.04-*-server-* + owner-id: "099720109477" architecture: x86_64 virtualization-type: hvm block-device-mapping.volume-type: gp2 image-type: machine transport: username: ubuntu - # - name: ubuntu-12.04 - # driver: - # image_search: - # name: ubuntu/images/*/ubuntu-*-12.04-*-server-* - # owner-id: 099720109477 - # architecture: x86_64 - # virtualization-type: hvm - # block-device-mapping.volume-type: gp2 - # image-type: machine - # transport: - # username: ubuntu # # Red Hat Enterprise Linux # @@ -105,7 +107,7 @@ platforms: driver: image_search: name: RHEL-7.* - owner-id: 309956199498 + owner-id: "309956199498" architecture: x86_64 virtualization-type: hvm block-device-mapping.volume-type: gp2 @@ -116,7 +118,7 @@ platforms: driver: image_search: name: RHEL-6.* - owner-id: 309956199498 + owner-id: "309956199498" architecture: x86_64 virtualization-type: hvm block-device-mapping.volume-type: gp2 @@ -127,7 +129,7 @@ platforms: driver: image_search: name: RHEL-5.* - owner-id: 309956199498 + owner-id: "309956199498" architecture: x86_64 virtualization-type: paravirtual block-device-mapping.volume-type: gp2 @@ -141,7 +143,7 @@ platforms: driver: image_search: name: FreeBSD/EC2 10.*-RELEASE* - owner-id: 118940168514 + owner-id: "118940168514" architecture: x86_64 virtualization-type: hvm block-device-mapping.volume-type: gp2 @@ -152,24 +154,24 @@ platforms: driver: image_search: name: FreeBSD/EC2 9.*-RELEASE* - owner-id: 118940168514 + owner-id: "118940168514" architecture: x86_64 virtualization-type: hvm block-device-mapping.volume-type: gp2 image-type: machine transport: username: ec2-user - # - name: freebsd-8 - # driver: - # image_search: - # name: FreeBSD/EC2 8.*-RELEASE* - # owner-id: 118940168514 - # architecture: x86_64 - # virtualization-type: hvm - # block-device-mapping.volume-type: standard - # image-type: machine - # transport: - # username: ec2-user + - name: freebsd-8 + driver: + image_search: + name: FreeBSD/EC2 8.*-RELEASE* + owner-id: "118940168514" + architecture: x86_64 + virtualization-type: hvm + block-device-mapping.volume-type: standard + image-type: machine + transport: + username: ec2-user # # OS/X # @@ -243,28 +245,28 @@ platforms: # # Centos # - # - name: centos-7 - # driver: - # image_search: - # name: CentOS Linux 7 * - # owner-alias: aws-marketplace - # architecture: x86_64 - # virtualization-type: hvm - # block-device-mapping.volume-type: standard - # image-type: machine - # transport: - # username: root - # - name: centos-6 - # driver: - # image_search: - # name: CentOS-6.5-GA-* - # owner-alias: aws-marketplace - # architecture: x86_64 - # virtualization-type: paravirtual - # block-device-mapping.volume-type: standard - # image-type: machine - # transport: - # username: root + - name: centos-7 + driver: + image_search: + name: CentOS Linux 7 * + owner-alias: aws-marketplace + architecture: x86_64 + virtualization-type: hvm + block-device-mapping.volume-type: standard + image-type: machine + transport: + username: root + - name: centos-6 + driver: + image_search: + name: CentOS-6.5-GA-* + owner-alias: aws-marketplace + architecture: x86_64 + virtualization-type: paravirtual + block-device-mapping.volume-type: standard + image-type: machine + transport: + username: root # # Fedora # @@ -272,7 +274,7 @@ platforms: driver: image_search: name: Fedora-Cloud-Base-21-* - owner-id: 125523088429 + owner-id: "125523088429" architecture: x86_64 virtualization-type: hvm block-device-mapping.volume-type: gp2 diff --git a/acceptance/.shared/kitchen_acceptance/.kitchen.vagrant.yml b/acceptance/.shared/kitchen_acceptance/.kitchen.vagrant.yml index f978658477..2cdb74a475 100644 --- a/acceptance/.shared/kitchen_acceptance/.kitchen.vagrant.yml +++ b/acceptance/.shared/kitchen_acceptance/.kitchen.vagrant.yml @@ -10,6 +10,8 @@ provisioner: product_name: <%= ENV["KITCHEN_CHEF_PRODUCT"] %> product_version: <%= ENV["KITCHEN_CHEF_VERSION"] %> channel: <%= ENV["KITCHEN_CHEF_CHANNEL"] %> + client_rb: + audit_mode: :enabled platforms: <% %w( diff --git a/acceptance/.shared/kitchen_acceptance/libraries/kitchen.rb b/acceptance/.shared/kitchen_acceptance/libraries/kitchen.rb index 5380b7002c..d3913ebb11 100644 --- a/acceptance/.shared/kitchen_acceptance/libraries/kitchen.rb +++ b/acceptance/.shared/kitchen_acceptance/libraries/kitchen.rb @@ -1,43 +1,46 @@ -class Kitchen < Chef::Resource - resource_name :kitchen +module KitchenAcceptance + class Kitchen < Chef::Resource + resource_name :kitchen - property :command, String, name_property: true - property :driver, %w(ec2 vagrant), coerce: proc { |v| v.to_s }, default: lazy { ENV["KITCHEN_DRIVER"] || :ec2 } - property :instances, String, default: lazy { ENV["KITCHEN_INSTANCES"] } - property :kitchen_dir, String, default: Chef.node['chef-acceptance']['suite-dir'] - property :chef_product, String, default: lazy { - ENV["KITCHEN_CHEF_PRODUCT"] || - # If we're running the chef or chefdk projects in jenkins, pick up the project name. - (%w(chef chefdk).include?(ENV["PROJECT_NAME"]) ? ENV["PROJECT_NAME"] : "chef") - } - property :chef_channel, String, default: lazy { - ENV["KITCHEN_CHEF_CHANNEL"] || - # Pick up current if we can't connect to artifactory - (ENV["ARTIFACTORY_USERNAME"] ? "unstable" : "current") - } - property :chef_version, String, default: lazy { - ENV["KITCHEN_CHEF_VERSION"] || - # If we're running the chef or chefdk projects in jenkins, pick up the project name. - (ENV["PROJECT_NAME"] == chef_product ? ENV["OMNIBUS_BUILD_VERSION"] : nil) || - "latest" - } - property :artifactory_username, String, default: lazy { ENV["ARTIFACTORY_USERNAME"] } - property :artifactory_password, String, default: lazy { ENV["ARTIFACTORY_PASSWORD"] } - property :env, Hash, default: {} + property :command, String, name_property: true + property :driver, %w(ec2 vagrant), coerce: proc { |v| v.to_s }, default: lazy { ENV["KITCHEN_DRIVER"] || :ec2 } + property :instances, String, default: lazy { ENV["KITCHEN_INSTANCES"] } + property :kitchen_dir, String, default: Chef.node['chef-acceptance']['suite-dir'] + property :chef_product, String, default: lazy { + ENV["KITCHEN_CHEF_PRODUCT"] || + # If we're running the chef or chefdk projects in jenkins, pick up the project name. + (%w(chef chefdk).include?(ENV["PROJECT_NAME"]) ? ENV["PROJECT_NAME"] : "chef") + } + property :chef_channel, String, default: lazy { + ENV["KITCHEN_CHEF_CHANNEL"] || + # Pick up current if we can't connect to artifactory + (ENV["ARTIFACTORY_USERNAME"] ? "unstable" : "current") + } + property :chef_version, String, default: lazy { + ENV["KITCHEN_CHEF_VERSION"] || + # If we're running the chef or chefdk projects in jenkins, pick up the project name. + (ENV["PROJECT_NAME"] == chef_product ? ENV["OMNIBUS_BUILD_VERSION"] : nil) || + "latest" + } + property :artifactory_username, String, default: lazy { ENV["ARTIFACTORY_USERNAME"] } + property :artifactory_password, String, default: lazy { ENV["ARTIFACTORY_PASSWORD"] } + property :env, Hash, default: {} + property :kitchen_options, String, default: lazy { ENV["PROJECT_NAME"] ? "-c -l debug" : "-c" } - action :run do - execute "bundle exec kitchen #{command}#{instances ? " #{instances}" : ""}" do - cwd kitchen_dir - env({ - "KITCHEN_DRIVER" => driver, - "KITCHEN_INSTANCES" => instances, - "KITCHEN_LOCAL_YAML" => ::File.expand_path("../../.kitchen.#{driver}.yml", __FILE__), - "KITCHEN_CHEF_PRODUCT" => chef_product, - "KITCHEN_CHEF_CHANNEL" => chef_channel, - "KITCHEN_CHEF_VERSION" => chef_version, - "ARTIFACTORY_USERNAME" => artifactory_username, - "ARTIFACTORY_PASSWORD" => artifactory_password - }.merge(new_resource.env)) + action :run do + execute "bundle exec kitchen #{command}#{instances ? " #{instances}" : ""}#{kitchen_options ? " #{kitchen_options}" : ""}" do + cwd kitchen_dir + env({ + "KITCHEN_DRIVER" => driver, + "KITCHEN_INSTANCES" => instances, + "KITCHEN_LOCAL_YAML" => ::File.expand_path("../../.kitchen.#{driver}.yml", __FILE__), + "KITCHEN_CHEF_PRODUCT" => chef_product, + "KITCHEN_CHEF_CHANNEL" => chef_channel, + "KITCHEN_CHEF_VERSION" => chef_version, + "ARTIFACTORY_USERNAME" => artifactory_username, + "ARTIFACTORY_PASSWORD" => artifactory_password + }.merge(new_resource.env)) + end end end end diff --git a/acceptance/cookbook-git/.acceptance/acceptance-cookbook/libraries/init.rb b/acceptance/cookbook-git/.acceptance/acceptance-cookbook/libraries/init.rb deleted file mode 100644 index 8561d6e798..0000000000 --- a/acceptance/cookbook-git/.acceptance/acceptance-cookbook/libraries/init.rb +++ /dev/null @@ -1,17 +0,0 @@ -module CookbookGit - def self.test_cookbook_name - "git" - end - - def self.test_run_path - File.join(Chef.node["chef-acceptance"]["suite-dir"], "test_run") - end - - def self.acceptance_path - File.expand_path("..", Chef.node["chef-acceptance"]["suite-dir"]) - end - - def self.acceptance_gemfile - File.join(acceptance_path, "Gemfile") - end -end diff --git a/acceptance/cookbook-git/.acceptance/acceptance-cookbook/recipes/destroy.rb b/acceptance/cookbook-git/.acceptance/acceptance-cookbook/recipes/destroy.rb deleted file mode 100644 index fce4a2f315..0000000000 --- a/acceptance/cookbook-git/.acceptance/acceptance-cookbook/recipes/destroy.rb +++ /dev/null @@ -1,7 +0,0 @@ -# Run the test on the current platform -kitchen "destroy" do - kitchen_dir "#{CookbookGit.test_run_path}/#{CookbookGit.test_cookbook_name}" - env "BUNDLE_GEMFILE" => CookbookGit.acceptance_gemfile, - "KITCHEN_GLOBAL_YAML" => ::File.join(CookbookGit.test_run_path, CookbookGit.test_cookbook_name, ".kitchen.yml"), - "KITCHEN_YAML" => ::File.join(node["chef-acceptance"]["suite-dir"], ".kitchen.yml") -end diff --git a/acceptance/cookbook-git/.acceptance/acceptance-cookbook/recipes/provision.rb b/acceptance/cookbook-git/.acceptance/acceptance-cookbook/recipes/provision.rb deleted file mode 100644 index 39cbafc7dd..0000000000 --- a/acceptance/cookbook-git/.acceptance/acceptance-cookbook/recipes/provision.rb +++ /dev/null @@ -1,17 +0,0 @@ -# Grab the cookbook -directory CookbookGit.test_run_path - -# TODO Grab the source URL from supermarket -# TODO get git to include its kitchen tests in the cookbook. -git "#{CookbookGit.test_run_path}/#{CookbookGit.test_cookbook_name}" do - repository "https://github.com/jkeiser/#{CookbookGit.test_cookbook_name}.git" - branch "jk/windows-fix" -end - -# Run the test on the current platform -kitchen "converge" do - kitchen_dir "#{CookbookGit.test_run_path}/#{CookbookGit.test_cookbook_name}" - env "BUNDLE_GEMFILE" => CookbookGit.acceptance_gemfile, - "KITCHEN_GLOBAL_YAML" => ::File.join(CookbookGit.test_run_path, CookbookGit.test_cookbook_name, ".kitchen.yml"), - "KITCHEN_YAML" => ::File.join(node["chef-acceptance"]["suite-dir"], ".kitchen.yml") -end diff --git a/acceptance/cookbook-git/.acceptance/acceptance-cookbook/recipes/verify.rb b/acceptance/cookbook-git/.acceptance/acceptance-cookbook/recipes/verify.rb deleted file mode 100644 index 84004bab3a..0000000000 --- a/acceptance/cookbook-git/.acceptance/acceptance-cookbook/recipes/verify.rb +++ /dev/null @@ -1,6 +0,0 @@ -kitchen "verify" do - kitchen_dir "#{CookbookGit.test_run_path}/#{CookbookGit.test_cookbook_name}" - env "BUNDLE_GEMFILE" => CookbookGit.acceptance_gemfile, - "KITCHEN_GLOBAL_YAML" => ::File.join(CookbookGit.test_run_path, CookbookGit.test_cookbook_name, ".kitchen.yml"), - "KITCHEN_YAML" => ::File.join(node["chef-acceptance"]["suite-dir"], ".kitchen.yml") -end diff --git a/acceptance/cookbook-git/.acceptance/acceptance-cookbook/.gitignore b/acceptance/top-cookbooks/.acceptance/acceptance-cookbook/.gitignore index 041413b040..041413b040 100644 --- a/acceptance/cookbook-git/.acceptance/acceptance-cookbook/.gitignore +++ b/acceptance/top-cookbooks/.acceptance/acceptance-cookbook/.gitignore diff --git a/acceptance/top-cookbooks/.acceptance/acceptance-cookbook/libraries/cookbook_kitchen.rb b/acceptance/top-cookbooks/.acceptance/acceptance-cookbook/libraries/cookbook_kitchen.rb new file mode 100644 index 0000000000..5d851a6ac6 --- /dev/null +++ b/acceptance/top-cookbooks/.acceptance/acceptance-cookbook/libraries/cookbook_kitchen.rb @@ -0,0 +1,43 @@ +class CookbookKitchen < KitchenAcceptance::Kitchen + resource_name :cookbook_kitchen + + property :command, default: lazy { name.split(" ")[0] } + property :kitchen_dir, default: lazy { ::File.join(repository_root, cookbook_relative_dir) } + property :test_cookbook, String, default: lazy { name.split(" ")[1] } + property :repository, String, default: lazy { "chef-cookbooks/#{test_cookbook}" }, + coerce: proc { |v| + # chef-cookbooks/runit -> https://github.com/chef-cookbooks/runit.git + if !v.include?(':') + "https://github.com/#{v}.git" + else + v + end + } + property :repository_root, String, default: lazy { ::File.join(Chef.node["chef-acceptance"]["suite-dir"], "test_run", test_cookbook) } + property :branch, String, default: "master" + property :cookbook_relative_dir, String, default: "" + property :env, default: lazy { + { + "BUNDLE_GEMFILE" => ::File.expand_path("../Gemfile", Chef.node["chef-acceptance"]["suite-dir"]), +# "KITCHEN_GLOBAL_YAML" => ::File.join(kitchen_dir, ".kitchen.yml"), + "KITCHEN_YAML" => ::File.join(node["chef-acceptance"]["suite-dir"], ".kitchen.#{test_cookbook}.yml") + } + } + + action :run do + # Ensure the parent directory exists + directory ::File.expand_path("..", repository_root) do + recursive true + end + + # Grab the cookbook + # TODO Grab the source URL from supermarket + # TODO get git to include its kitchen tests in the cookbook. + git repository_root do + repository new_resource.repository + branch new_resource.branch + end + + super() + end +end diff --git a/acceptance/top-cookbooks/.acceptance/acceptance-cookbook/libraries/top_cookbooks.rb b/acceptance/top-cookbooks/.acceptance/acceptance-cookbook/libraries/top_cookbooks.rb new file mode 100644 index 0000000000..d9086366da --- /dev/null +++ b/acceptance/top-cookbooks/.acceptance/acceptance-cookbook/libraries/top_cookbooks.rb @@ -0,0 +1,15 @@ +class TopCookbooks < Chef::Resource + resource_name :top_cookbooks + + property :command, String, name_property: true + + action :run do + cookbook_kitchen "#{command} git" do + end + + cookbook_kitchen "#{command} learn-the-basics-ubuntu" do + repository "learn-chef/learn-chef-acceptance" + cookbook_relative_dir "cookbooks/learn-the-basics-ubuntu" + end + end +end diff --git a/acceptance/cookbook-git/.acceptance/acceptance-cookbook/metadata.rb b/acceptance/top-cookbooks/.acceptance/acceptance-cookbook/metadata.rb index 26cdab4e99..26cdab4e99 100644 --- a/acceptance/cookbook-git/.acceptance/acceptance-cookbook/metadata.rb +++ b/acceptance/top-cookbooks/.acceptance/acceptance-cookbook/metadata.rb diff --git a/acceptance/top-cookbooks/.acceptance/acceptance-cookbook/recipes/destroy.rb b/acceptance/top-cookbooks/.acceptance/acceptance-cookbook/recipes/destroy.rb new file mode 100644 index 0000000000..63d10e86e4 --- /dev/null +++ b/acceptance/top-cookbooks/.acceptance/acceptance-cookbook/recipes/destroy.rb @@ -0,0 +1 @@ +top_cookbooks "destroy" diff --git a/acceptance/top-cookbooks/.acceptance/acceptance-cookbook/recipes/provision.rb b/acceptance/top-cookbooks/.acceptance/acceptance-cookbook/recipes/provision.rb new file mode 100644 index 0000000000..7b16f8e66f --- /dev/null +++ b/acceptance/top-cookbooks/.acceptance/acceptance-cookbook/recipes/provision.rb @@ -0,0 +1 @@ +top_cookbooks "converge" diff --git a/acceptance/top-cookbooks/.acceptance/acceptance-cookbook/recipes/verify.rb b/acceptance/top-cookbooks/.acceptance/acceptance-cookbook/recipes/verify.rb new file mode 100644 index 0000000000..8d00a2e301 --- /dev/null +++ b/acceptance/top-cookbooks/.acceptance/acceptance-cookbook/recipes/verify.rb @@ -0,0 +1 @@ +top_cookbooks "verify" diff --git a/acceptance/cookbook-git/.gitignore b/acceptance/top-cookbooks/.gitignore index 306f0cce57..306f0cce57 100644 --- a/acceptance/cookbook-git/.gitignore +++ b/acceptance/top-cookbooks/.gitignore diff --git a/acceptance/cookbook-git/.kitchen.yml b/acceptance/top-cookbooks/.kitchen.git.yml index d087446a40..8db1829d5f 100644 --- a/acceptance/cookbook-git/.kitchen.yml +++ b/acceptance/top-cookbooks/.kitchen.git.yml @@ -1,10 +1,10 @@ suites: - - name: default + - name: git-default run_list: ["recipe[git]"] includes: [ubuntu-14.04] - - name: source + - name: git-source run_list: ["recipe[git::source]"] includes: [nonexistent] - - name: default-windows + - name: git-default-windows run_list: ["recipe[git]"] includes: [windows-2012r2] diff --git a/acceptance/top-cookbooks/.kitchen.learn-the-basics-rhel.yml b/acceptance/top-cookbooks/.kitchen.learn-the-basics-rhel.yml new file mode 100644 index 0000000000..6b8848efae --- /dev/null +++ b/acceptance/top-cookbooks/.kitchen.learn-the-basics-rhel.yml @@ -0,0 +1,4 @@ +suites: + - name: learn-the-basics-rhel-default + run_list: ["recipe[learn-the-basics-rhel::default]"] + includes: [el-6] diff --git a/acceptance/top-cookbooks/.kitchen.learn-the-basics-ubuntu.yml b/acceptance/top-cookbooks/.kitchen.learn-the-basics-ubuntu.yml new file mode 100644 index 0000000000..b0a3e45aa3 --- /dev/null +++ b/acceptance/top-cookbooks/.kitchen.learn-the-basics-ubuntu.yml @@ -0,0 +1,4 @@ +suites: + - name: learn-the-basics-ubuntu-default + run_list: ["recipe[learn-the-basics-ubuntu::default]"] + includes: [ubuntu-14.04] diff --git a/chef-config/lib/chef-config/version.rb b/chef-config/lib/chef-config/version.rb index 965ac17ce7..1ca332defb 100644 --- a/chef-config/lib/chef-config/version.rb +++ b/chef-config/lib/chef-config/version.rb @@ -21,7 +21,7 @@ module ChefConfig CHEFCONFIG_ROOT = File.dirname(File.expand_path(File.dirname(__FILE__))) - VERSION = "12.7.0" + VERSION = "12.7.1" end # diff --git a/lib/chef/cookbook/remote_file_vendor.rb b/lib/chef/cookbook/remote_file_vendor.rb index 9155162c4c..e63d094dc4 100644 --- a/lib/chef/cookbook/remote_file_vendor.rb +++ b/lib/chef/cookbook/remote_file_vendor.rb @@ -63,7 +63,7 @@ class Chef # (remote, per manifest), do the update. This will also execute if there # is no current checksum. if current_checksum != found_manifest_record["checksum"] - raw_file = @rest.get(found_manifest_record[:url], true) + raw_file = @rest.streaming_request(found_manifest_record[:url]) Chef::Log.debug("Storing updated #{cache_filename} in the cache.") Chef::FileCache.move_to(raw_file.path, cache_filename) diff --git a/lib/chef/encrypted_data_bag_item/decryptor.rb b/lib/chef/encrypted_data_bag_item/decryptor.rb index 652c5bf718..a002a98a79 100644 --- a/lib/chef/encrypted_data_bag_item/decryptor.rb +++ b/lib/chef/encrypted_data_bag_item/decryptor.rb @@ -92,7 +92,8 @@ class Chef::EncryptedDataBagItem plaintext = openssl_decryptor.update(encrypted_bytes) plaintext << openssl_decryptor.final rescue OpenSSL::Cipher::CipherError => e - raise DecryptionFailure, "Error decrypting data bag value: '#{e.message}'. Most likely the provided key is incorrect" + # if the key length is less than 150 characters, and it contains slashes, we think it may be a path. + raise DecryptionFailure, "Error decrypting data bag value: '#{e.message}'. Most likely the provided key is incorrect. #{ @key.length < 255 and @key.include?('/') ? 'You may need to use --secret-file rather than --secret.' : '' }" end end @@ -142,7 +143,8 @@ class Chef::EncryptedDataBagItem plaintext = openssl_decryptor.update(encrypted_bytes) plaintext << openssl_decryptor.final rescue OpenSSL::Cipher::CipherError => e - raise DecryptionFailure, "Error decrypting data bag value: '#{e.message}'. Most likely the provided key is incorrect" + # if the key length is less than 150 characters, and it contains slashes, we think it may be a path. + raise DecryptionFailure, "Error decrypting data bag value: '#{e.message}'. Most likely the provided key is incorrect. #{ @key.length < 255 and @key.include?('/') ? 'You may need to use --secret-file rather than --secret.' : '' }" end end diff --git a/lib/chef/knife/cookbook_show.rb b/lib/chef/knife/cookbook_show.rb index 20013cea4b..5fab7c303f 100644 --- a/lib/chef/knife/cookbook_show.rb +++ b/lib/chef/knife/cookbook_show.rb @@ -69,7 +69,7 @@ class Chef cookbook = rest.get("cookbooks/#{cookbook_name}/#{cookbook_version}") manifest_entry = cookbook.preferred_manifest_record(node, segment, filename) - temp_file = rest.get(manifest_entry[:url], true) + temp_file = rest.streaming_request(manifest_entry[:url]) # the temp file is cleaned up elsewhere temp_file.open if temp_file.closed? diff --git a/lib/chef/knife/cookbook_site_download.rb b/lib/chef/knife/cookbook_site_download.rb index 7e4eda015f..2bdeea9781 100644 --- a/lib/chef/knife/cookbook_site_download.rb +++ b/lib/chef/knife/cookbook_site_download.rb @@ -86,8 +86,7 @@ class Chef def download_cookbook ui.info "Downloading #{@name_args[0]} from Supermarket at version #{version} to #{download_location}" - noauth_rest.sign_on_redirect = false - tf = noauth_rest.get desired_cookbook_data["file"], true + tf = noauth_rest.streaming_request(desired_cookbook_data["file"]) ::FileUtils.cp tf.path, download_location ui.info "Cookbook saved: #{download_location}" diff --git a/lib/chef/version.rb b/lib/chef/version.rb index d74aeeda56..166ecf33d1 100644 --- a/lib/chef/version.rb +++ b/lib/chef/version.rb @@ -21,7 +21,7 @@ class Chef CHEF_ROOT = File.dirname(File.expand_path(File.dirname(__FILE__))) - VERSION = "12.7.0" + VERSION = "12.7.1" end # diff --git a/omnibus/resources/chef/msi/localization-en-us.wxl.erb b/omnibus/resources/chef/msi/localization-en-us.wxl.erb index 767f615bb7..62c27b99f6 100644 --- a/omnibus/resources/chef/msi/localization-en-us.wxl.erb +++ b/omnibus/resources/chef/msi/localization-en-us.wxl.erb @@ -3,7 +3,7 @@ <!-- http://wix.codeplex.com/SourceControl/changeset/view/792e101c5cf7#src%2fext%2fUIExtension%2fwixlib%2fWixUI_en-us.wxl --> <String Id="LANG">1033</String> <String Id="ProductName"><%= friendly_name %></String> - <String Id="ManufacturerName"><%= maintainer.encode(:xml => :attr) %></String> + <String Id="ManufacturerName">Chef Software, Inc.</String> <String Id="WelcomeDlgTitle">{\WixUI_Font_Bigger}Welcome to the [ProductName] Setup Wizard</String> <String Id="LicenseAgreementDlgTitle">{\WixUI_Font_Title_White}End-User License Agreement</String> diff --git a/spec/unit/knife/cookbook_show_spec.rb b/spec/unit/knife/cookbook_show_spec.rb index de6d569e1d..0183577ec1 100644 --- a/spec/unit/knife/cookbook_show_spec.rb +++ b/spec/unit/knife/cookbook_show_spec.rb @@ -126,7 +126,7 @@ describe Chef::Knife::CookbookShow do it "should print the raw result of the request (likely a file!)" do expect(@rest).to receive(:get).with("cookbooks/cookbook_name/0.1.0").and_return(@cookbook_response) - expect(@rest).to receive(:get).with("http://example.org/files/default.rb", true).and_return(StringIO.new(@response)) + expect(@rest).to receive(:streaming_request).with("http://example.org/files/default.rb").and_return(StringIO.new(@response)) expect(@knife).to receive(:pretty_print).with(@response) @knife.run end @@ -178,7 +178,7 @@ describe Chef::Knife::CookbookShow do @knife.config[:platform_version] = "1.0" @knife.config[:fqdn] = "examplehost.example.org" expect(@rest).to receive(:get).with("cookbooks/cookbook_name/0.1.0").and_return(@cookbook_response) - expect(@rest).to receive(:get).with("http://example.org/files/1111", true).and_return(StringIO.new(@response)) + expect(@rest).to receive(:streaming_request).with("http://example.org/files/1111").and_return(StringIO.new(@response)) expect(@knife).to receive(:pretty_print).with(@response) @knife.run end @@ -190,7 +190,7 @@ describe Chef::Knife::CookbookShow do @knife.config[:platform_version] = "1.0" @knife.config[:fqdn] = "differenthost.example.org" expect(@rest).to receive(:get).with("cookbooks/cookbook_name/0.1.0").and_return(@cookbook_response) - expect(@rest).to receive(:get).with("http://example.org/files/3333", true).and_return(StringIO.new(@response)) + expect(@rest).to receive(:streaming_request).with("http://example.org/files/3333").and_return(StringIO.new(@response)) expect(@knife).to receive(:pretty_print).with(@response) @knife.run end @@ -202,7 +202,7 @@ describe Chef::Knife::CookbookShow do @knife.config[:platform_version] = "9.10" @knife.config[:fqdn] = "differenthost.example.org" expect(@rest).to receive(:get).with("cookbooks/cookbook_name/0.1.0").and_return(@cookbook_response) - expect(@rest).to receive(:get).with("http://example.org/files/2222", true).and_return(StringIO.new(@response)) + expect(@rest).to receive(:streaming_request).with("http://example.org/files/2222").and_return(StringIO.new(@response)) expect(@knife).to receive(:pretty_print).with(@response) @knife.run end @@ -211,7 +211,7 @@ describe Chef::Knife::CookbookShow do describe "with none of the arguments, it should use the default" do it "should pass them all" do expect(@rest).to receive(:get).with("cookbooks/cookbook_name/0.1.0").and_return(@cookbook_response) - expect(@rest).to receive(:get).with("http://example.org/files/4444", true).and_return(StringIO.new(@response)) + expect(@rest).to receive(:streaming_request).with("http://example.org/files/4444").and_return(StringIO.new(@response)) expect(@knife).to receive(:pretty_print).with(@response) @knife.run end diff --git a/spec/unit/knife/cookbook_site_download_spec.rb b/spec/unit/knife/cookbook_site_download_spec.rb index 663ad1af74..d7f26f2f2e 100644 --- a/spec/unit/knife/cookbook_site_download_spec.rb +++ b/spec/unit/knife/cookbook_site_download_spec.rb @@ -60,8 +60,6 @@ describe Chef::Knife::CookbookSiteDownload do "file" => "http://example.com/apache2_#{@version_us}.tgz" } @temp_file = double( :path => "/tmp/apache2_#{@version_us}.tgz" ) @file = File.join(Dir.pwd, "apache2-#{@version}.tar.gz") - - expect(@noauth_rest).to receive(:sign_on_redirect=).with(false) end context "downloading the latest version" do @@ -69,8 +67,8 @@ describe Chef::Knife::CookbookSiteDownload do expect(@noauth_rest).to receive(:get). with(@current_data["latest_version"]). and_return(@cookbook_data) - expect(@noauth_rest).to receive(:get). - with(@cookbook_data["file"], true). + expect(@noauth_rest).to receive(:streaming_request). + with(@cookbook_data["file"]). and_return(@temp_file) end @@ -134,8 +132,8 @@ describe Chef::Knife::CookbookSiteDownload do expect(@noauth_rest).to receive(:get). with("#{@cookbook_api_url}/apache2/versions/#{@version_us}"). and_return(@cookbook_data) - expect(@noauth_rest).to receive(:get). - with(@cookbook_data["file"], true). + expect(@noauth_rest).to receive(:streaming_request). + with(@cookbook_data["file"]). and_return(@temp_file) expect(FileUtils).to receive(:cp).with(@temp_file.path, @file) @knife.run |