diff options
author | Noah Kantrowitz <noah@coderanger.net> | 2016-09-23 19:00:01 -0700 |
---|---|---|
committer | Noah Kantrowitz <noah@coderanger.net> | 2016-09-23 19:00:01 -0700 |
commit | 5f4f3b0e602514185d9867c50f325232a74dc502 (patch) | |
tree | 0b342b2286238814beb2f15c24b02aae98c3674c | |
parent | f57fc526f3c779d530170517dd2f08a50554b22d (diff) | |
parent | b8cca6c64761847c95a2860171fc5fd0d0221aa3 (diff) | |
download | chef-5f4f3b0e602514185d9867c50f325232a74dc502.tar.gz |
Merge branch 'master' into solaris-r
34 files changed, 378 insertions, 214 deletions
diff --git a/.gitignore b/.gitignore index 1e60843467..be88d2c809 100644 --- a/.gitignore +++ b/.gitignore @@ -43,3 +43,6 @@ kitchen-tests/nodes/* # Temporary files present during spec runs spec/data/test-dir /config/ + +# acceptance binstubs +acceptance/bin/* diff --git a/.travis.yml b/.travis.yml index 95b69ed215..3fb6461607 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,7 +21,6 @@ before_script: branches: only: - master - - 10-stable - 11-stable env: diff --git a/CHANGELOG.md b/CHANGELOG.md index 931c2a76b5..0ddd22612a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,15 @@ # Change Log +## [v12.14.89](https://github.com/chef/chef/tree/v12.14.89) (2016-09-22) +[Full Changelog](https://github.com/chef/chef/compare/v12.14.77...v12.14.89) + +**Fixed Bugs:** + +- Revert "Verify systemd\_unit file during create" [\#5326](https://github.com/chef/chef/pull/5326) ([mwrock](https://github.com/mwrock)) +- Fix method\_access and array handling in node presenter [\#5351](https://github.com/chef/chef/pull/5351) ([lamont-granquist](https://github.com/lamont-granquist)) +- Fixed undefined short\_cksum method issue and checksum in uppercase issue for windows\_package resource. [\#5332](https://github.com/chef/chef/pull/5332) ([Aliasgar16](https://github.com/Aliasgar16)) +- Fix makecache action name in yum\_repository [\#5348](https://github.com/chef/chef/pull/5348) ([tas50](https://github.com/tas50)) + ## [v12.14.77](https://github.com/chef/chef/tree/v12.14.77) (2016-09-19) [Full Changelog](https://github.com/chef/chef/compare/v12.14.60...v12.14.77) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 4f9f527381..49f244ff9d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,11 +1,16 @@ -# Contributing to Chef +# Contributing to Chef Projects -We are glad you want to contribute to Chef! +We're glad you want to contribute to a Chef project! This document should help answer common questions you may have during your first contribution. -We utilize **Github Issues** for issue tracking and contributions. You can contribute in two ways: +## Submitting Issues -1. Reporting an issue or making a feature request [here](#issues). -2. Adding features or fixing bugs yourself and contributing your code to Chef. +Not every contribution comes in the form of code. Submitting, confirming, and triaging issues is an important task for any project. At Chef we use Github to track all project issues. + +If you are familiar with Chef and know the component that is causing you a problem you can file an issue in the corresponding Github project. All of our Open Source Software can be found in our [Github organization](https://github.com/chef/). All projects include Github issue templates to help gather information needed for a thorough review. + +We do ask that you not submit security concerns via Github. For details on submitting potential security issues please see <https://www.chef.io/security/> + +In addition to Github issues we also utilize a feedback site that helps our product team track and rank feature requests. If you have a feature request this is an excellent place to start <https://feedback.chef.io> ## Contribution Process @@ -77,25 +82,6 @@ Date: Wed Sep 18 11:44:40 2013 -0700 ------------------------------------------------------------------------ ``` -## Chef Issue Tracking - -Chef Issue Tracking is handled using Github Issues. - -If you are familiar with Chef and know the component that is causing you a problem or if you have a feature request on a specific component you can file an issue in the corresponding Github project. All of our Open Source Software can be found in our [Github organization](https://github.com/chef/). - -There is also a listing of the various Chef products and where to file issues that can be found in the Chef docs in the [community contributions section](https://docs.chef.io/community_contributions.html#issues-and-bug-reports). - -Otherwise you can file your issue in the [Chef project](https://github.com/chef/chef/issues) and we will make sure it gets filed against the appropriate project. - -### Useful Github Queries - -Contributions go through a review process to improve code quality and avoid regressions. Managing a large number of contributions requires a workflow to provide queues for work such as triage, code review, and merging. A semi-formal process has evolved over the life of the project. Chef maintains this process pending community development and acceptance of an [RFC](https://github.com/chef/chef-rfc). These queries will help track contributions through this process: - -- [Issues that are not assigned to a team](https://github.com/chef/chef/issues?q=is%3Aopen+-label%3AAIX+-label%3ABSD+-label%3Awindows+-label%3A%22Chef+Core%22++-label%3A%22Dev+Tools%22+-label%3AUbuntu+-label%3A%22Enterprise+Linux%22+-label%3A%22Ready+For+Merge%22+-label%3AMac+-label%3ASolaris+) -- [Untriaged Issues](https://github.com/chef/chef/issues?q=is%3Aopen+is%3Aissue+-label%3ABug+-label%3AEnhancement+-label%3A%22Tech+Cleanup%22+-label%3A%22Ready+For+Merge%22) -- [PRs to be Reviewed](https://github.com/chef/chef/labels/Pending%20Maintainer%20Review) -- [Suitable for First Contribution](https://github.com/chef/chef/labels/Easy) - ## Chef Release Cycles Our primary shipping vehicle is operating system specific packages that includes all the requirements of Chef. We call these [Omnibus packages](https://github.com/chef/omnibus) @@ -108,7 +94,7 @@ Our version numbering roughly follows [Semantic Versioning](http://semver.org/) - Y is a minor release, which adds both new features and bug fixes - Z is a patch release, which adds just bug fixes -After shipping a release of Chef we bump the `Minor` version by one to start development of the next minor releaae. All merges to master trigger an increment of the `Patch` version, and a build through our internal testing pipeline. We do a `Minor` release approximately every month, which consist of shipping one of the already auto-incremented and tested `Patch` versions. For example after shiping 12.10.24, we incremented Chef to 12.11.0\. From there 18 commits where merged bringing the version to 12.11.18, which we shipped as an omnibus package. +After shipping a release of Chef we bump the `Minor` version by one to start development of the next minor release. All merges to master trigger an increment of the `Patch` version, and a build through our internal testing pipeline. We do a `Minor` release approximately every month, which consist of shipping one of the already auto-incremented and tested `Patch` versions. For example after shiping 12.10.24, we incremented Chef to 12.11.0\. From there 18 commits where merged bringing the version to 12.11.18, which we shipped as an omnibus package. Announcements of releases are made to the [chef mailing list](https://discourse.chef.io/c/chef-release) when they are available. diff --git a/Gemfile.lock b/Gemfile.lock index a9d65b3687..ebb74c2dac 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,9 +1,9 @@ GIT remote: https://github.com/chef/chef-server - revision: 8165dfd0524ee6076eda32727cbd0005c9348150 + revision: ba0ec88f6800215c574d1d41c4b8bcc86d6f25b0 specs: oc-chef-pedant (2.2.0) - activesupport (~> 5.0) + activesupport (>= 4.2.7.1, < 6.0) erubis (~> 2.7) mixlib-authentication (~> 1.4) mixlib-config (~> 2.0) @@ -66,10 +66,10 @@ GIT PATH remote: . specs: - chef (12.14.78) + chef (12.14.95) addressable bundler (>= 1.10) - chef-config (= 12.14.78) + chef-config (= 12.14.95) chef-zero (>= 4.8) diff-lcs (~> 1.2, >= 1.2.4) erubis (~> 2.7) @@ -95,10 +95,10 @@ PATH specinfra (~> 2.10) syslog-logger (~> 1.6) uuidtools (~> 2.1.5) - chef (12.14.78-universal-mingw32) + chef (12.14.95-universal-mingw32) addressable bundler (>= 1.10) - chef-config (= 12.14.78) + chef-config (= 12.14.95) chef-zero (>= 4.8) diff-lcs (~> 1.2, >= 1.2.4) erubis (~> 2.7) @@ -139,7 +139,7 @@ PATH PATH remote: chef-config specs: - chef-config (12.14.78) + chef-config (12.14.95) addressable fuzzyurl mixlib-config (~> 2.0) @@ -156,14 +156,14 @@ GEM addressable (2.4.0) appbundler (0.9.0) mixlib-cli (~> 1.4) - artifactory (2.3.3) + artifactory (2.5.0) ast (2.3.0) - aws-sdk (2.5.11) - aws-sdk-resources (= 2.5.11) - aws-sdk-core (2.5.11) + aws-sdk (2.6.2) + aws-sdk-resources (= 2.6.2) + aws-sdk-core (2.6.2) jmespath (~> 1.0) - aws-sdk-resources (2.5.11) - aws-sdk-core (= 2.5.11) + aws-sdk-resources (2.6.2) + aws-sdk-core (= 2.6.2) aws-sdk-v1 (1.66.0) json (~> 1.4) nokogiri (>= 1.4.4) @@ -200,7 +200,7 @@ GEM cheffish (4.0.0) chef-zero (~> 5.0) net-ssh - chefspec (5.0.0) + chefspec (5.2.0) chef (>= 12.0) fauxhai (~> 3.6) rspec (~> 3.0) @@ -232,14 +232,14 @@ GEM domain_name (0.5.20160826) unf (>= 0.0.5, < 1.0.0) erubis (2.7.0) - ethon (0.9.0) + ethon (0.9.1) ffi (>= 1.3.0) excon (0.52.0) faraday (0.9.2) multipart-post (>= 1.2, < 3) faraday_middleware (0.10.0) faraday (>= 0.7.4, < 0.10) - fauxhai (3.8.0) + fauxhai (3.9.0) net-ssh ffi (1.9.14) ffi (1.9.14-x86-mingw32) @@ -287,7 +287,7 @@ GEM chef (~> 12.0) stove (~> 4.0) thor - hashie (3.4.4) + hashie (3.4.6) highline (1.7.8) http-cookie (1.0.2) domain_name (~> 0.5) @@ -298,10 +298,10 @@ GEM ipaddress (0.8.3) jmespath (1.3.1) json (1.8.3) - jwt (1.5.4) - kitchen-docker (2.6.0.rc.0) + jwt (1.5.6) + kitchen-docker (2.6.0) test-kitchen (>= 1.0.0) - kitchen-ec2 (1.1.0) + kitchen-ec2 (1.2.0) aws-sdk (~> 2) excon multi_json @@ -334,7 +334,7 @@ GEM mixlib-log mixlib-cli (1.7.0) mixlib-config (2.2.4) - mixlib-install (1.1.0) + mixlib-install (1.2.2) artifactory mixlib-shellout mixlib-versioning @@ -390,7 +390,7 @@ GEM plist (~> 3.1) systemu (~> 2.6.4) wmi-lite (~> 1.0) - parser (2.3.1.2) + parser (2.3.1.4) ast (~> 2.2) pkg-config (1.1.7) plist (3.2.0) @@ -419,7 +419,7 @@ GEM websocket (~> 1.0) rack (2.0.1) rainbow (2.1.0) - rake (11.2.2) + rake (11.3.0) rb-readline (0.5.3) rest-client (2.0.0) http-cookie (>= 1.0.2, < 2.0) @@ -461,7 +461,7 @@ GEM ruby-prof (0.16.2) ruby-progressbar (1.8.1) ruby-shadow (2.5.0) - rubyntlm (0.6.0) + rubyntlm (0.6.1) rubyzip (1.2.0) rufus-lru (1.1.0) safe_yaml (1.0.4) @@ -480,7 +480,7 @@ GEM simplecov-html (~> 0.10.0) simplecov-html (0.10.0) slop (3.6.0) - specinfra (2.61.3) + specinfra (2.63.1) net-scp net-ssh (>= 2.7, < 4.0) net-telnet @@ -490,8 +490,8 @@ GEM logify (~> 0.2) syslog-logger (1.6.8) systemu (2.6.5) - test-kitchen (1.12.0) - mixlib-install (~> 1.0, >= 1.0.4) + test-kitchen (1.13.0) + mixlib-install (~> 1.2) mixlib-shellout (>= 1.2, < 3.0) net-scp (~> 1.1) net-ssh (>= 2.9, < 4.0) @@ -546,7 +546,7 @@ GEM ffi-win32-extensions windows-api (0.4.4) win32-api (>= 1.4.5) - winrm (2.0.1) + winrm (2.0.2) builder (>= 2.1.2) erubis (~> 2.7) gssapi (~> 1.2) @@ -554,7 +554,7 @@ GEM httpclient (~> 2.2, >= 2.2.0.2) logging (>= 1.6.1, < 3.0) nori (~> 2.0) - rubyntlm (~> 0.6.0) + rubyntlm (~> 0.6.0, >= 0.6.1) winrm-elevated (1.0.0) winrm (~> 2.0) winrm-fs (~> 1.0) diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 8010770e04..b652d7e837 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -1,5 +1,5 @@ *This file holds "in progress" release notes for the current release under development and is intended for consumption by the Chef Documentation team. -Please see `https://docs.chef.io/release/<major>-<minor>/release_notes.html` for the official Chef release notes.* +Please see [https://docs.chef.io/release_notes.html](https://docs.chef.io/release_notes.html) for the official Chef release notes.* # Chef Client Release Notes 12.14: @@ -1 +1 @@ -12.14.78
\ No newline at end of file +12.14.95
\ No newline at end of file diff --git a/acceptance/Gemfile.lock b/acceptance/Gemfile.lock index 265f8eebf8..8ec07d1c80 100644 --- a/acceptance/Gemfile.lock +++ b/acceptance/Gemfile.lock @@ -11,12 +11,12 @@ GEM specs: addressable (2.4.0) artifactory (2.5.0) - aws-sdk (2.6.1) - aws-sdk-resources (= 2.6.1) - aws-sdk-core (2.6.1) + aws-sdk (2.6.2) + aws-sdk-resources (= 2.6.2) + aws-sdk-core (2.6.2) jmespath (~> 1.0) - aws-sdk-resources (2.6.1) - aws-sdk-core (= 2.6.1) + aws-sdk-resources (2.6.2) + aws-sdk-core (= 2.6.2) berkshelf (4.3.5) addressable (~> 2.3, >= 2.3.4) berkshelf-api-client (~> 2.0, >= 2.0.2) @@ -53,7 +53,7 @@ GEM celluloid-io (0.16.2) celluloid (>= 0.16.0) nio4r (>= 1.1.0) - chef-config (12.14.60) + chef-config (12.14.77) addressable fuzzyurl mixlib-config (~> 2.0) @@ -77,7 +77,7 @@ GEM hashie (3.4.6) hitimes (1.2.4) httpclient (2.7.2) - inspec (0.34.1) + inspec (0.35.0) hashie (~> 3.4) json (>= 1.8, < 3.0) method_source (~> 0.8) @@ -115,7 +115,7 @@ GEM mixlib-authentication (1.4.1) mixlib-log mixlib-config (2.2.4) - mixlib-install (1.2.0) + mixlib-install (1.2.2) artifactory mixlib-shellout mixlib-versioning @@ -198,7 +198,7 @@ GEM thor (0.19.1) timers (4.0.4) hitimes - train (0.19.1) + train (0.20.0) docker-api (~> 1.26) json (>= 1.8, < 3.0) mixlib-shellout (~> 2.0) diff --git a/acceptance/README.md b/acceptance/README.md index fa4bab2806..992129bf2b 100644 --- a/acceptance/README.md +++ b/acceptance/README.md @@ -1,15 +1,16 @@ # Acceptance Testing for Chef Client -This folder contains acceptance tests that are required for Chef client -release readiness. + +This folder contains acceptance tests that are required for Chef client release readiness. ## Getting started -The tests use the _chef-acceptance_ gem as the high level framework. -All the gems needed to run these tests can be installed with Bundler. + +The tests use the _chef-acceptance_ gem as the high level framework. All the gems needed to run these tests can be installed with Bundler from this directory. ### Important Note! -Before running chef-acceptance, you *MUST* do the following on your current session: -``` +Before running chef-acceptance, you _MUST_ do the following on your current session: + +```shell export APPBUNDLER_ALLOW_RVM=true ``` @@ -17,14 +18,14 @@ export APPBUNDLER_ALLOW_RVM=true ### Set up for local VM (Vagrant) -If you intend to run the acceptance tests on a local VM, the supported solution is to use Vagrant. -Ensure that Vagrant is installed on the machine that tests will run from, along with a -virtualization driver (E.g.: VirtualBox). +If you intend to run the acceptance tests on a local VM, the supported solution is to use Vagrant. Ensure that Vagrant is installed on the machine that tests will run from, along with a virtualization driver (E.g.: VirtualBox). -Set up the KITCHEN_DRIVER environment variable appropriately (value should be "vagrant"). E.g.: -``` +Set up the KITCHEN_DRIVER environment variable appropriately (value should be "vagrant"). E.g.: + +```shell export KITCHEN_DRIVER=vagrant ``` + Add this to your shell profile or startup script as needed. ### Set up for cloud VM (EC2) @@ -34,44 +35,59 @@ If you intend to run the acceptance tests on a cloud VM, the supported solution The steps you will need to do are: 1. Add your AWS credentials to the machine - e.g., to the ~/.aws/credentials directory. - - The easiest way to do this is to download the aws command line (`brew install awscli` on OS/X) and run `aws configure`. + + - The easiest way to do this is to download the aws command line (`brew install awscli` on OS/X) and run `aws configure`. + 2. Create or import a SSH key to AWS. (If you already have one, you can skip the import/create) - - In the AWS console, click Key Pairs, then Create Key Pair or Import Key Pair. + + - In the AWS console, click Key Pairs, then Create Key Pair or Import Key Pair. + 3. Copy or move the private key file (USERNAME.pem) to the SSH folder (e.g. `~/.ssh/USERNAME.pem`). - - If you Created a key pair in step 2, download the private key and move it to `~/.ssh`. - - If you Importd a key pair in step 2, just ensure your private key is in `~/.ssh` and has the same name as the key pair (`~/.ssh/USERNAME` or `~/.ssh/USERNAME.pem`). + + - If you Created a key pair in step 2, download the private key and move it to `~/.ssh`. + - If you Importd a key pair in step 2, just ensure your private key is in `~/.ssh` and has the same name as the key pair (`~/.ssh/USERNAME` or `~/.ssh/USERNAME.pem`). + 4. Set AWS_SSH_KEY_ID to the SSH key name. - - This is **optional** if your AWS SSH key name is your local username. - - You may want to set this in your shell `.profile`. - ```shell - export AWS_SSH_KEY_ID=name-of-private-key - ``` + - This is **optional** if your AWS SSH key name is your local username. + - You may want to set this in your shell `.profile`. + + ```shell + export AWS_SSH_KEY_ID=name-of-private-key + ``` + 5. Set the private key to only be readable by root - ```shell - chmod 0400 ~/.ssh/USERNAME.pem - ``` + ```shell + chmod 0400 ~/.ssh/USERNAME.pem + ``` + 6. Set up the KITCHEN_DRIVER environment variable appropriately (value should be "ec2"). (This is optional, as ec2 is the default.) E.g.: - ```shell - export KITCHEN_DRIVER=ec2 - ``` - Add this to your shell profile or startup script as needed. + ```shell + export KITCHEN_DRIVER=ec2 + ``` + + Add this to your shell profile or startup script as needed. + 7. **Connect to Chef VPN**. The instances you create will not have public IPs! ## Setting up and running a test suite + To get started, do a bundle install from the acceptance directory: + ```shell chef/acceptance$ bundle install --binstubs ``` To get some basic info and ensure chef-acceptance can be run, do: + ```shell chef/acceptance$ bin/chef-acceptance info ``` To run a particular test suite, do the following: + ```shell chef/acceptance$ bin/chef-acceptance test TEST_SUITE ``` @@ -83,26 +99,20 @@ chef/acceptance$ export KITCHEN_INSTANCES=*-ubuntu-1404 chef/acceptance$ bin/chef-acceptance test cookbook-git ``` -If KITCHEN_INSTANCES is not specified, the default instances are default-ubuntu-1404 and default-windows-windows-2012r2. All selected instances will be run in *parallel* if the driver supports it (ec2 does, vagrant doesn't). +If KITCHEN_INSTANCES is not specified, the default instances are default-ubuntu-1404 and default-windows-windows-2012r2\. All selected instances will be run in _parallel_ if the driver supports it (ec2 does, vagrant doesn't). ## Optional Settings -In addition to the environment settings above, there are a number of -key values that are available to set for changing the way the acceptance -tests are run. +In addition to the environment settings above, there are a number of key values that are available to set for changing the way the acceptance tests are run. ### KITCHEN_CHEF_CHANNEL -Use this setting to specify which channel we will pull the chef build from. -The default is to use the "current" channel, unless the ARTIFACTORY_USERNAME is set -(which normally happens when running under Jenkins), in which case the default is -changed to "unstable". +Use this setting to specify which channel we will pull the chef build from. The default is to use the "current" channel, unless the ARTIFACTORY_USERNAME is set (which normally happens when running under Jenkins), in which case the default is changed to "unstable". ```shell export KITCHEN_CHEF_CHANNEL=name-of-channel ``` - ### KITCHEN_CHEF_VERSION Use this setting to override the version of the Chef client that is installed. The default is to get the latest version in the desired channel. @@ -122,11 +132,6 @@ export ARTIFACTORY_PASSWORD=password ## Future Work -Currently, there is no simple mechanism for chef-acceptance -to build an Omnibus package of the developers local chef -instance and run acceptance tests on it - the only packages -that can be exercised are ones that come from one of the -pipeline channels (unstable, current or stable). +Currently, there is no simple mechanism for chef-acceptance to build an Omnibus package of the developers local chef instance and run acceptance tests on it - the only packages that can be exercised are ones that come from one of the pipeline channels (unstable, current or stable). -This is not an issue when adding acceptance tests for pre-existing functionality (as that functionality is presumed -to already be in a build in one of the pipeline channels). +This is not an issue when adding acceptance tests for pre-existing functionality (as that functionality is presumed to already be in a build in one of the pipeline channels). diff --git a/chef-config/lib/chef-config/version.rb b/chef-config/lib/chef-config/version.rb index 7405f30f3f..287c7c184c 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.expand_path("../..", __FILE__) - VERSION = "12.14.78" + VERSION = "12.14.95" end # diff --git a/kitchen-tests/Berksfile.lock b/kitchen-tests/Berksfile.lock index 16d32a31d9..8efea70082 100644 --- a/kitchen-tests/Berksfile.lock +++ b/kitchen-tests/Berksfile.lock @@ -12,8 +12,8 @@ GRAPH apache2 (3.2.2) apt (4.0.2) compat_resource (>= 12.10) - aws (3.4.1) - ohai (>= 2.1.0) + aws (4.1.1) + ohai (>= 4.0) base (0.1.0) apt (>= 0.0.0) build-essential (>= 0.0.0) @@ -29,7 +29,7 @@ GRAPH sudo (>= 0.0.0) ubuntu (>= 0.0.0) users (>= 0.0.0) - build-essential (6.0.5) + build-essential (6.0.6) compat_resource (>= 12.14) mingw (>= 1.1) seven_zip (>= 0.0.0) @@ -38,10 +38,10 @@ GRAPH logrotate (>= 1.9.0) windows (>= 1.42.0) chef-sugar (3.4.0) - chef_hostname (0.4.1) + chef_hostname (0.4.2) compat_resource (>= 0.0.0) - compat_resource (12.14.2) - cron (1.7.6) + compat_resource (12.14.6) + cron (2.0.0) database (2.3.1) aws (>= 0.0.0) mysql (~> 5.0) @@ -50,7 +50,8 @@ GRAPH xfs (>= 0.0.0) iis (5.0.0) windows (>= 1.34.6) - iptables (2.2.0) + iptables (3.0.0) + compat_resource (>= 12.14.3) logrotate (2.1.0) compat_resource (>= 0.0.0) mingw (1.2.4) @@ -65,11 +66,10 @@ GRAPH mysql (>= 0.0.0) nscd (4.1.0) compat_resource (>= 0.0.0) - ntp (3.0.0) - windows (>= 1.38.0) - ohai (4.2.1) + ntp (3.1.0) + ohai (4.2.2) compat_resource (>= 12.14) - openssh (2.0.0) + openssh (2.1.0) iptables (>= 1.0) openssl (4.4.0) chef-sugar (>= 3.1.1) @@ -91,7 +91,7 @@ GRAPH sudo (3.0.0) ubuntu (2.0.0) apt (>= 0.0.0) - users (3.0.0) + users (4.0.1) webapp (0.1.0) apache2 (~> 3.2.2) database (~> 2.3.1) diff --git a/kitchen-tests/Gemfile.lock b/kitchen-tests/Gemfile.lock index 36571ec015..da74e2c35e 100644 --- a/kitchen-tests/Gemfile.lock +++ b/kitchen-tests/Gemfile.lock @@ -2,19 +2,19 @@ GEM remote: https://rubygems.org/ specs: addressable (2.4.0) - artifactory (2.3.3) - aws-sdk (2.5.11) - aws-sdk-resources (= 2.5.11) - aws-sdk-core (2.5.11) + artifactory (2.5.0) + aws-sdk (2.6.2) + aws-sdk-resources (= 2.6.2) + aws-sdk-core (2.6.2) jmespath (~> 1.0) - aws-sdk-resources (2.5.11) - aws-sdk-core (= 2.5.11) - berkshelf (5.0.0) + aws-sdk-resources (2.6.2) + aws-sdk-core (= 2.6.2) + berkshelf (5.1.0) addressable (~> 2.3, >= 2.3.4) berkshelf-api-client (>= 2.0.2, < 4.0) buff-config (~> 2.0) buff-extensions (~> 2.0) - buff-shell_out (~> 0.1) + buff-shell_out (~> 1.0) cleanroom (~> 1.0) faraday (~> 0.9) httpclient (~> 2.7) @@ -34,16 +34,17 @@ GEM varia_model (~> 0.6) buff-extensions (2.0.0) buff-ignore (1.2.0) - buff-ruby_engine (0.1.0) - buff-shell_out (0.2.0) - buff-ruby_engine (~> 0.1.0) + buff-ruby_engine (1.0.0) + buff-shell_out (1.1.0) + buff-ruby_engine (~> 1.0) builder (3.2.2) celluloid (0.16.0) timers (~> 4.0.0) celluloid-io (0.16.2) celluloid (>= 0.16.0) nio4r (>= 1.1.0) - chef-config (12.13.37) + chef-config (12.14.77) + addressable fuzzyurl mixlib-config (~> 2.0) mixlib-shellout (~> 2.0) @@ -64,11 +65,11 @@ GEM ffi (>= 1.0.1) gyoku (1.3.1) builder (>= 2.1.2) - hashie (3.4.4) + hashie (3.4.6) hitimes (1.2.4) hitimes (1.2.4-x86-mingw32) httpclient (2.8.2.4) - inspec (0.34.0) + inspec (0.35.0) hashie (~> 3.4) json (>= 1.8, < 3.0) method_source (~> 0.8) @@ -88,7 +89,7 @@ GEM kitchen-dokken (1.0.0) docker-api (~> 1.29) test-kitchen (~> 1.5) - kitchen-ec2 (1.1.0) + kitchen-ec2 (1.2.0) aws-sdk (~> 2) excon multi_json @@ -110,7 +111,7 @@ GEM mixlib-authentication (1.4.1) mixlib-log mixlib-config (2.2.4) - mixlib-install (1.1.0) + mixlib-install (1.2.2) artifactory mixlib-shellout mixlib-versioning @@ -120,7 +121,7 @@ GEM win32-process (~> 0.8.2) wmi-lite (~> 1.0) mixlib-versioning (1.1.0) - molinillo (0.5.0) + molinillo (0.5.1) multi_json (1.12.1) multipart-post (2.0.0) net-scp (1.2.1) @@ -139,12 +140,12 @@ GEM slop (~> 3.4) rainbow (2.1.0) retryable (2.0.4) - ridley (5.0.0) + ridley (5.1.0) addressable buff-config (~> 2.0) buff-extensions (~> 2.0) buff-ignore (~> 1.2) - buff-shell_out (~> 0.1) + buff-shell_out (~> 1.0) celluloid (~> 0.16.0) celluloid-io (~> 0.16.1) chef-config (>= 12.5.0) @@ -173,7 +174,7 @@ GEM diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.5.0) rspec-support (3.5.0) - rubyntlm (0.6.0) + rubyntlm (0.6.1) rubyzip (1.2.0) safe_yaml (1.0.4) sawyer (0.7.0) @@ -185,8 +186,8 @@ GEM molinillo (~> 0.4) semverse (>= 1.1, < 3.0) sslshake (1.0.12) - test-kitchen (1.12.0) - mixlib-install (~> 1.0, >= 1.0.4) + test-kitchen (1.13.0) + mixlib-install (~> 1.2) mixlib-shellout (>= 1.2, < 3.0) net-scp (~> 1.1) net-ssh (>= 2.9, < 4.0) @@ -196,7 +197,7 @@ GEM thor (0.19.1) timers (4.0.4) hitimes - train (0.19.0) + train (0.20.0) docker-api (~> 1.26) json (>= 1.8, < 3.0) mixlib-shellout (~> 2.0) @@ -210,7 +211,7 @@ GEM hashie (>= 2.0.2, < 4.0.0) win32-process (0.8.3) ffi (>= 1.0.0) - winrm (2.0.1) + winrm (2.0.2) builder (>= 2.1.2) erubis (~> 2.7) gssapi (~> 1.2) @@ -218,7 +219,7 @@ GEM httpclient (~> 2.2, >= 2.2.0.2) logging (>= 1.6.1, < 3.0) nori (~> 2.0) - rubyntlm (~> 0.6.0) + rubyntlm (~> 0.6.0, >= 0.6.1) winrm-fs (1.0.0) erubis (~> 2.7) logging (>= 1.6.1, < 3.0) diff --git a/lib/chef/cookbook/metadata.rb b/lib/chef/cookbook/metadata.rb index ab83da9e55..02f9831d70 100644 --- a/lib/chef/cookbook/metadata.rb +++ b/lib/chef/cookbook/metadata.rb @@ -722,6 +722,14 @@ class Chef end end + def method_missing(method, *args, &block) + if block_given? + super + else + Chef::Log.debug "ignoring method #{method} on cookbook with name #{name}, possible typo or future metadata?" + end + end + private # Helper to match a gem style version (ohai_version/chef_version) against a set of diff --git a/lib/chef/knife/core/generic_presenter.rb b/lib/chef/knife/core/generic_presenter.rb index f273cb5bca..3f5c0712d0 100644 --- a/lib/chef/knife/core/generic_presenter.rb +++ b/lib/chef/knife/core/generic_presenter.rb @@ -175,23 +175,19 @@ class Chef def extract_nested_value(data, nested_value_spec) nested_value_spec.split(".").each do |attr| - if data.nil? - nil # don't get no method error on nil - # Must check :[] before attr because spec can include - # `keys` - want the key named `keys`, not a list of - # available keys. - elsif data.respond_to?(:[]) && data.has_key?(attr) - data = data[attr] - elsif data.respond_to?(attr.to_sym) - data = data.send(attr.to_sym) - else - data = begin - data.send(attr.to_sym) - rescue NoMethodError - nil - end - end + data = + if data.is_a?(Array) + data[attr.to_i] + elsif data.respond_to?(:[], false) && data.key?(attr) + data[attr] + elsif data.respond_to?(attr.to_sym, false) + # handles -a chef_environment and other things that hang of the node and aren't really attributes + data.public_send(attr.to_sym) + else + nil + end end + # necessary (?) for coercing objects (the run_list object?) to hashes ( !data.kind_of?(Array) && data.respond_to?(:to_hash) ) ? data.to_hash : data end diff --git a/lib/chef/mixin/checksum.rb b/lib/chef/mixin/checksum.rb index f223894c39..2888b205a9 100644 --- a/lib/chef/mixin/checksum.rb +++ b/lib/chef/mixin/checksum.rb @@ -27,6 +27,11 @@ class Chef Chef::Digester.checksum_for_file(file) end + def short_cksum(checksum) + return "none" if checksum.nil? + checksum.slice(0, 6) + end + end end end diff --git a/lib/chef/node/attribute.rb b/lib/chef/node/attribute.rb index 95b3b09f7e..a4a07275c0 100644 --- a/lib/chef/node/attribute.rb +++ b/lib/chef/node/attribute.rb @@ -452,9 +452,7 @@ class Chef # def merged_attributes(*path) - # immutablize( - merge_all(path) - # ) + immutablize(merge_all(path)) end def combined_override(*path) diff --git a/lib/chef/node/attribute_collections.rb b/lib/chef/node/attribute_collections.rb index b739ea8490..1bd31bceb0 100644 --- a/lib/chef/node/attribute_collections.rb +++ b/lib/chef/node/attribute_collections.rb @@ -73,6 +73,7 @@ class Chef def initialize(root, data) @root = root super(data) + map! { |e| convert_value(e) } end # For elements like Fixnums, true, nil... @@ -86,6 +87,23 @@ class Chef Array.new(map { |e| safe_dup(e) }) end + private + + def convert_value(value) + case value + when VividMash + value + when AttrArray + value + when Hash + VividMash.new(root, value) + when Array + AttrArray.new(root, value) + else + value + end + end + end # == VividMash @@ -184,6 +202,8 @@ class Chef case value when VividMash value + when AttrArray + value when Hash VividMash.new(root, value) when Array diff --git a/lib/chef/provider/file.rb b/lib/chef/provider/file.rb index 7f85085eeb..84bb4d1c94 100644 --- a/lib/chef/provider/file.rb +++ b/lib/chef/provider/file.rb @@ -344,7 +344,7 @@ class Chef end def do_validate_content - if new_resource.checksum && tempfile && ( new_resource.checksum != tempfile_checksum ) + if new_resource.checksum && tempfile && ( new_resource.checksum.downcase != tempfile_checksum ) raise Chef::Exceptions::ChecksumMismatch.new(short_cksum(new_resource.checksum), short_cksum(tempfile_checksum)) end @@ -462,11 +462,6 @@ class Chef @tempfile ||= content.tempfile end - def short_cksum(checksum) - return "none" if checksum.nil? - checksum.slice(0, 6) - end - def load_resource_attributes_from_file(resource) if Chef::Platform.windows? # This is a work around for CHEF-3554. diff --git a/lib/chef/provider/package/windows.rb b/lib/chef/provider/package/windows.rb index 753d3c279e..b11bcf5192 100644 --- a/lib/chef/provider/package/windows.rb +++ b/lib/chef/provider/package/windows.rb @@ -250,7 +250,7 @@ class Chef def validate_content! if new_resource.checksum source_checksum = checksum(source_location) - if new_resource.checksum != source_checksum + if new_resource.checksum.downcase != source_checksum raise Chef::Exceptions::ChecksumMismatch.new(short_cksum(new_resource.checksum), short_cksum(source_checksum)) end end diff --git a/lib/chef/provider/remote_file/content.rb b/lib/chef/provider/remote_file/content.rb index e44096428b..983285307a 100644 --- a/lib/chef/provider/remote_file/content.rb +++ b/lib/chef/provider/remote_file/content.rb @@ -54,7 +54,7 @@ class Chef as_uri(source) end raw_file = grab_file_from_uri(uri) - rescue SocketError, Errno::ECONNREFUSED, Errno::ENOENT, Errno::EACCES, Timeout::Error, Net::HTTPServerException, Net::HTTPFatalError, Net::FTPError => e + rescue SocketError, Errno::ECONNREFUSED, Errno::ENOENT, Errno::EACCES, Timeout::Error, Net::HTTPServerException, Net::HTTPFatalError, Net::FTPError, Errno::ETIMEDOUT => e Chef::Log.warn("#{@new_resource} cannot be downloaded from #{source}: #{e}") if source = sources.shift Chef::Log.info("#{@new_resource} trying to download from another mirror") diff --git a/lib/chef/provider/systemd_unit.rb b/lib/chef/provider/systemd_unit.rb index 4aa4cd0aa2..a656fbbf80 100644 --- a/lib/chef/provider/systemd_unit.rb +++ b/lib/chef/provider/systemd_unit.rb @@ -193,7 +193,6 @@ class Chef f.group "root" f.mode "0644" f.content new_resource.to_ini - f.verify systemd_analyze_cmd if systemd_analyze_path end.run_action(action) end @@ -234,14 +233,6 @@ class Chef {} end end - - def systemd_analyze_cmd - @systemd_analyze_cmd ||= "#{systemd_analyze_path} verify %{path}" - end - - def systemd_analyze_path - @systemd_analyze_path ||= which("systemd-analyze") - end end end end diff --git a/lib/chef/resource/yum_repository.rb b/lib/chef/resource/yum_repository.rb index 3633f4421b..2989f1bf87 100644 --- a/lib/chef/resource/yum_repository.rb +++ b/lib/chef/resource/yum_repository.rb @@ -69,7 +69,7 @@ class Chef property :options, Hash default_action :create - allowed_actions :create, :remove, :make_cache, :add, :delete + allowed_actions :create, :remove, :makecache, :add, :delete # provide compatibility with the yum cookbook < 3.0 properties alias_method :url, :baseurl diff --git a/lib/chef/version.rb b/lib/chef/version.rb index a7a9df0d20..7429120273 100644 --- a/lib/chef/version.rb +++ b/lib/chef/version.rb @@ -21,7 +21,7 @@ class Chef CHEF_ROOT = File.expand_path("../..", __FILE__) - VERSION = "12.14.78" + VERSION = "12.14.95" end # diff --git a/omnibus/Gemfile b/omnibus/Gemfile index 6e9e9cce71..45cad13e4f 100644 --- a/omnibus/Gemfile +++ b/omnibus/Gemfile @@ -4,9 +4,7 @@ gem "omnibus", github: "chef/omnibus", branch: "rhass/COOL-502_with_gcc_investig gem "omnibus-software", github: "chef/omnibus-software", branch: "lcg/ruby23" gem "license_scout", github: "chef/license_scout" -# pedump pessimistically pins multipart-post to a version from 2013 which makes -# bundler very unhappy. Remove this when upstream has merged zed-0xff/pedump#6 . -gem "pedump", git: "https://github.com/ksubrama/pedump.git", branch: "patch-1" +gem "pedump" # This development group is installed by default when you run `bundle install`, # but if you are using Omnibus in a CI-based infrastructure, you do not need diff --git a/omnibus/Gemfile.lock b/omnibus/Gemfile.lock index 1512f36319..6e4c00897c 100644 --- a/omnibus/Gemfile.lock +++ b/omnibus/Gemfile.lock @@ -1,6 +1,6 @@ GIT remote: git://github.com/chef/license_scout.git - revision: dbd17c0a99a12e16dd7af27798df863366efc289 + revision: 81f1e5c0afc76bd86132464c8ad2b94d884a4845 specs: license_scout (0.1.2) ffi-yajl (~> 2.2) @@ -32,30 +32,18 @@ GIT ruby-progressbar (~> 1.7) thor (~> 0.18) -GIT - remote: https://github.com/ksubrama/pedump.git - revision: b4319556e18c80d2cba064ffe57fe0dea549dfe2 - branch: patch-1 - specs: - pedump (0.5.0) - awesome_print - iostruct (>= 0.0.4) - multipart-post (~> 1.2) - progressbar - zhexdump (>= 0.0.2) - GEM remote: https://rubygems.org/ specs: addressable (2.4.0) artifactory (2.5.0) awesome_print (1.7.0) - aws-sdk (2.6.1) - aws-sdk-resources (= 2.6.1) - aws-sdk-core (2.6.1) + aws-sdk (2.6.2) + aws-sdk-resources (= 2.6.2) + aws-sdk-core (2.6.2) jmespath (~> 1.0) - aws-sdk-resources (2.6.1) - aws-sdk-core (= 2.6.1) + aws-sdk-resources (2.6.2) + aws-sdk-core (= 2.6.2) berkshelf (4.3.5) addressable (~> 2.3, >= 2.3.4) berkshelf-api-client (~> 2.0, >= 2.0.2) @@ -95,7 +83,7 @@ GEM celluloid-io (0.16.2) celluloid (>= 0.16.0) nio4r (>= 1.1.0) - chef-config (12.14.60) + chef-config (12.14.77) addressable fuzzyurl mixlib-config (~> 2.0) @@ -139,7 +127,7 @@ GEM mixlib-log mixlib-cli (1.7.0) mixlib-config (2.2.4) - mixlib-install (1.2.0) + mixlib-install (1.2.2) artifactory mixlib-shellout mixlib-versioning @@ -151,7 +139,7 @@ GEM mixlib-versioning (1.1.0) molinillo (0.4.5) multi_json (1.12.1) - multipart-post (1.2.0) + multipart-post (2.0.0) net-scp (1.2.1) net-ssh (>= 2.6.5) net-ssh (3.2.0) @@ -173,6 +161,12 @@ GEM plist (~> 3.1) systemu (~> 2.6.4) wmi-lite (~> 1.0) + pedump (0.5.2) + awesome_print + iostruct (>= 0.0.4) + multipart-post (~> 2.0.0) + progressbar + zhexdump (>= 0.0.2) plist (3.2.0) progressbar (0.21.0) pry (0.10.4) @@ -260,7 +254,7 @@ DEPENDENCIES license_scout! omnibus! omnibus-software! - pedump! + pedump pry pry-byebug pry-stack_explorer diff --git a/spec/functional/resource/ifconfig_spec.rb b/spec/functional/resource/ifconfig_spec.rb index a30dcff641..0298dbcf45 100644 --- a/spec/functional/resource/ifconfig_spec.rb +++ b/spec/functional/resource/ifconfig_spec.rb @@ -51,11 +51,17 @@ describe Chef::Resource::Ifconfig, :requires_root, :skip_travis, :external => in end end + def fetch_first_interface_name + shell_out("ifconfig | grep Ethernet | head -1 | cut -d' ' -f1").stdout.strip + end + # **Caution: any updates to core interfaces can be risky. def en0_interface_for_test case ohai[:platform] when "aix" "en0" + when "ubuntu" + fetch_first_interface_name else "eth0" end diff --git a/spec/integration/solo/solo_spec.rb b/spec/integration/solo/solo_spec.rb index bfcb74b45c..e4228a7559 100644 --- a/spec/integration/solo/solo_spec.rb +++ b/spec/integration/solo/solo_spec.rb @@ -113,7 +113,7 @@ EOM ruby_block "sleeping" do block do retries = 200 - while IO.read(Chef::Config[:log_location]) !~ /Chef client [0-9]+ is running, will wait for it to finish and then run./ + while IO.read(Chef::Config[:log_location]) !~ /Chef client .* is running, will wait for it to finish and then run./ sleep 0.1 raise "we ran out of retries" if ( retries -= 1 ) <= 0 end @@ -157,7 +157,7 @@ EOM run_log = File.read(path_to("logs/runs.log")) # second run should have a message which indicates it's waiting for the first run - expect(run_log).to match(/Chef client [0-9]+ is running, will wait for it to finish and then run./) + expect(run_log).to match(/Chef client .* is running, will wait for it to finish and then run./) # both of the runs should succeed expect(run_log.lines.reject { |l| !l.include? "INFO: Chef Run complete in" }.length).to eq(2) diff --git a/spec/unit/cookbook/metadata_spec.rb b/spec/unit/cookbook/metadata_spec.rb index 27666eb338..389f02501a 100644 --- a/spec/unit/cookbook/metadata_spec.rb +++ b/spec/unit/cookbook/metadata_spec.rb @@ -948,5 +948,24 @@ describe Chef::Cookbook::Metadata do end end + describe "from_file" do + it "ignores unknown metadata fields in metadata.rb files" do + expect(Chef::Log).to receive(:debug).with(/ignoring method some_spiffy_new_metadata_field/) + Tempfile.open("metadata.rb") do |f| + f.write <<-EOF + some_spiffy_new_metadata_field "stuff its set to" + EOF + f.close + metadata.from_file(f.path) + end + end + end + + describe "from_json" do + it "ignores unknown metadata fields in metdata.json files" do + json = %q{{ "some_spiffy_new_metadata_field": "stuff its set to" }} + metadata.from_json(json) + end + end end end diff --git a/spec/unit/knife/core/ui_spec.rb b/spec/unit/knife/core/ui_spec.rb index 9f525f22f0..be77fd8501 100644 --- a/spec/unit/knife/core/ui_spec.rb +++ b/spec/unit/knife/core/ui_spec.rb @@ -377,12 +377,33 @@ EOM end it "should return the name attribute" do - allow_any_instance_of(Chef::Node).to receive(:name).and_return("chef.localdomain") input = Chef::Node.new + input.name("chef.localdomain") @ui.config[:attribute] = "name" expect(@ui.format_for_display(input)).to eq( { "chef.localdomain" => { "name" => "chef.localdomain" } }) end + it "should return a 'class' attribute and not the node.class" do + input = Chef::Node.new + input.default["class"] = "classy!" + @ui.config[:attribute] = "class" + expect(@ui.format_for_display(input)).to eq( { nil => { "class" => "classy!" } } ) + end + + it "should return the chef_environment attribute" do + input = Chef::Node.new + input.chef_environment = "production-partner-load-integration-preview-testing" + @ui.config[:attribute] = "chef_environment" + expect(@ui.format_for_display(input)).to eq( { nil => { "chef_environment" => "production-partner-load-integration-preview-testing" } } ) + end + + it "works with arrays" do + input = Chef::Node.new + input.default["array"] = %w{zero one two} + @ui.config[:attribute] = "array.1" + expect(@ui.format_for_display(input)).to eq( { nil => { "array.1" => "one" } } ) + end + it "returns nil when given an attribute path that isn't a name or attribute" do input = { "keys" => { "keys" => "values" }, "hi" => "ho", "id" => "sample-data-bag-item" } non_existing_path = "nope.nada.nothingtoseehere" diff --git a/spec/unit/mixin/checksum_spec.rb b/spec/unit/mixin/checksum_spec.rb index 997dcd523e..801c8820d2 100644 --- a/spec/unit/mixin/checksum_spec.rb +++ b/spec/unit/mixin/checksum_spec.rb @@ -37,4 +37,18 @@ describe Chef::Mixin::Checksum do expect(@checksum_user.checksum(@file)).to eq("09ee9c8cc70501763563bcf9c218d71b2fbf4186bf8e1e0da07f0f42c80a3394") end + describe "short_cksum" do + context "nil provided for checksum" do + it "returns none" do + expect(@checksum_user.short_cksum(nil)).to eq("none") + end + end + + context "non-nil provided for checksum" do + it "returns the short checksum" do + expect(@checksum_user.short_cksum("u7ghbxikk3i9blsimmy2y2ionmxx")).to eq("u7ghbx") + end + end + end + end diff --git a/spec/unit/node/attribute_spec.rb b/spec/unit/node/attribute_spec.rb index e40f454c0b..00081a9fd9 100644 --- a/spec/unit/node/attribute_spec.rb +++ b/spec/unit/node/attribute_spec.rb @@ -1171,7 +1171,29 @@ describe Chef::Node::Attribute do Chef::Config[:treat_deprecation_warnings_as_errors] = false expect { @attributes.new_key = "new value" }.to raise_error(Chef::Exceptions::ImmutableAttributeModification) end - end + describe "deeply converting values" do + it "converts values through an array" do + @attributes.default[:foo] = [ { bar: true } ] + expect(@attributes["foo"].class).to eql(Chef::Node::ImmutableArray) + expect(@attributes["foo"][0].class).to eql(Chef::Node::ImmutableMash) + expect(@attributes["foo"][0]["bar"]).to be true + end + + it "converts values through nested arrays" do + @attributes.default[:foo] = [ [ { bar: true } ] ] + expect(@attributes["foo"].class).to eql(Chef::Node::ImmutableArray) + expect(@attributes["foo"][0].class).to eql(Chef::Node::ImmutableArray) + expect(@attributes["foo"][0][0].class).to eql(Chef::Node::ImmutableMash) + expect(@attributes["foo"][0][0]["bar"]).to be true + end + + it "converts values through nested hashes" do + @attributes.default[:foo] = { baz: { bar: true } } + expect(@attributes["foo"].class).to eql(Chef::Node::ImmutableMash) + expect(@attributes["foo"]["baz"].class).to eql(Chef::Node::ImmutableMash) + expect(@attributes["foo"]["baz"]["bar"]).to be true + end + end end diff --git a/spec/unit/node/vivid_mash_spec.rb b/spec/unit/node/vivid_mash_spec.rb index 5319ba4a35..206b15ef6c 100644 --- a/spec/unit/node/vivid_mash_spec.rb +++ b/spec/unit/node/vivid_mash_spec.rb @@ -37,6 +37,33 @@ describe Chef::Node::VividMash do expect(root).to receive(:top_level_breadcrumb=).with(key).at_least(:once).and_call_original end + context "#[]=" do + it "deep converts values through arrays" do + allow(root).to receive(:reset_cache) + vivid[:foo] = [ { :bar => true } ] + expect(vivid["foo"].class).to eql(Chef::Node::AttrArray) + expect(vivid["foo"][0].class).to eql(Chef::Node::VividMash) + expect(vivid["foo"][0]["bar"]).to be true + end + + it "deep converts values through nested arrays" do + allow(root).to receive(:reset_cache) + vivid[:foo] = [ [ { :bar => true } ] ] + expect(vivid["foo"].class).to eql(Chef::Node::AttrArray) + expect(vivid["foo"][0].class).to eql(Chef::Node::AttrArray) + expect(vivid["foo"][0][0].class).to eql(Chef::Node::VividMash) + expect(vivid["foo"][0][0]["bar"]).to be true + end + + it "deep converts values through hashes" do + allow(root).to receive(:reset_cache) + vivid[:foo] = { baz: { :bar => true } } + expect(vivid["foo"]).to be_an_instance_of(Chef::Node::VividMash) + expect(vivid["foo"]["baz"]).to be_an_instance_of(Chef::Node::VividMash) + expect(vivid["foo"]["baz"]["bar"]).to be true + end + end + context "#read" do before do # vivify the vividmash, then we're read-only so the cache should never be cleared afterwards diff --git a/spec/unit/provider/package/windows_spec.rb b/spec/unit/provider/package/windows_spec.rb index e26662ac75..d1d717bdbe 100644 --- a/spec/unit/provider/package/windows_spec.rb +++ b/spec/unit/provider/package/windows_spec.rb @@ -394,4 +394,49 @@ describe Chef::Provider::Package::Windows, :windows_only do end end end + + shared_context "valid checksum" do + context "checksum is valid" do + before do + allow(provider).to receive(:checksum).and_return("jiie00u3bbs92vsbhvgvklb2lasgh20ah") + end + + it "does not raise the checksum mismatch exception" do + expect { provider.send(:validate_content!) }.to_not raise_error + end + end + end + + shared_context "invalid checksum" do + context "checksum is invalid" do + before do + allow(provider).to receive(:checksum).and_return("kiie30u3bbs92vsbhvgvklb2lasgh20ah") + end + + it "raises the checksum mismatch exception" do + expect { provider.send(:validate_content!) }.to raise_error( + Chef::Exceptions::ChecksumMismatch) + end + end + end + + describe "validate_content!" do + before(:each) do + new_resource.checksum("jiie00u3bbs92vsbhvgvklb2lasgh20ah") + end + + context "checksum is in lowercase" do + include_context "valid checksum" + include_context "invalid checksum" + end + + context "checksum is in uppercase" do + before do + new_resource.checksum = new_resource.checksum.upcase + end + + include_context "valid checksum" + include_context "invalid checksum" + end + end end diff --git a/spec/unit/provider/remote_file/content_spec.rb b/spec/unit/provider/remote_file/content_spec.rb index c6a560b123..db9a75458d 100644 --- a/spec/unit/provider/remote_file/content_spec.rb +++ b/spec/unit/provider/remote_file/content_spec.rb @@ -180,6 +180,7 @@ describe Chef::Provider::RemoteFile::Content do Net::HTTPServerException, Net::HTTPFatalError, Net::FTPError, + Errno::ETIMEDOUT, ].each do |exception| describe "with an exception of #{exception}" do before do |