diff options
-rw-r--r-- | .travis.yml | 72 | ||||
-rw-r--r-- | CHANGELOG.md | 13 | ||||
-rw-r--r-- | Gemfile.lock | 57 | ||||
-rw-r--r-- | VERSION | 2 | ||||
-rw-r--r-- | chef-config/lib/chef-config/version.rb | 2 | ||||
-rw-r--r-- | kitchen-tests/.kitchen.travis.yml | 21 | ||||
-rw-r--r-- | kitchen-tests/.kitchen.yml | 12 | ||||
-rw-r--r-- | kitchen-tests/Berksfile.lock | 21 | ||||
-rw-r--r-- | kitchen-tests/Gemfile.lock | 320 | ||||
-rw-r--r-- | kitchen-tests/cookbooks/audit_test/.gitignore | 15 | ||||
-rw-r--r-- | kitchen-tests/cookbooks/audit_test/chefignore | 95 | ||||
-rw-r--r-- | kitchen-tests/cookbooks/base/attributes/default.rb | 1 | ||||
-rw-r--r-- | lib/chef/node_map.rb | 2 | ||||
-rw-r--r-- | lib/chef/provider.rb | 12 | ||||
-rw-r--r-- | lib/chef/provider/systemd_unit.rb | 67 | ||||
-rw-r--r-- | lib/chef/provider/windows_path.rb | 10 | ||||
-rw-r--r-- | lib/chef/resource/systemd_unit.rb | 3 | ||||
-rw-r--r-- | lib/chef/version.rb | 2 | ||||
-rw-r--r-- | lib/chef/version/platform.rb | 18 | ||||
-rw-r--r-- | lib/chef/version_constraint/platform.rb | 2 | ||||
-rw-r--r-- | spec/integration/recipes/resource_converge_if_changed_spec.rb | 86 | ||||
-rw-r--r-- | spec/unit/node_map_spec.rb | 18 | ||||
-rw-r--r-- | spec/unit/resource/windows_path_spec.rb | 2 |
23 files changed, 491 insertions, 362 deletions
diff --git a/.travis.yml b/.travis.yml index 8e52f38611..a28873d849 100644 --- a/.travis.yml +++ b/.travis.yml @@ -103,6 +103,24 @@ matrix: - sudo iptables -L DOCKER || ( echo "DOCKER iptables chain missing" ; sudo iptables -N DOCKER ) - cd kitchen-tests script: + - bundle exec kitchen test base-amazonlinux + after_failure: + - cat .kitchen/logs/kitchen.log + env: + - AMAZON=LATEST + - KITCHEN_YAML=.kitchen.travis.yml + - rvm: 2.4.2 + services: docker + sudo: required + gemfile: kitchen-tests/Gemfile + before_install: + - gem update --system $(grep rubygems omnibus_overrides.rb | cut -d'"' -f2) + - gem install bundler -v $(grep bundler omnibus_overrides.rb | cut -d'"' -f2) + bundler_args: --without ci docgen guard integration maintenance omnibus_package --frozen + before_script: + - sudo iptables -L DOCKER || ( echo "DOCKER iptables chain missing" ; sudo iptables -N DOCKER ) + - cd kitchen-tests + script: - bundle exec kitchen test base-ubuntu-1404 after_failure: - cat .kitchen/logs/kitchen.log @@ -217,42 +235,24 @@ matrix: env: - CENTOS=7 - KITCHEN_YAML=.kitchen.travis.yml -# - rvm: 2.4.2 -# services: docker -# sudo: required -# gemfile: kitchen-tests/Gemfile -# before_install: -# - gem update --system $(grep rubygems omnibus_overrides.rb | cut -d'"' -f2) -# - gem install bundler -v $(grep bundler omnibus_overrides.rb | cut -d'"' -f2) -# bundler_args: --without ci docgen guard integration maintenance omnibus_package --frozen -# before_script: -# - sudo iptables -L DOCKER || ( echo "DOCKER iptables chain missing" ; sudo iptables -N DOCKER ) -# - cd kitchen-tests -# script: -# - bundle exec kitchen test base-fedora-latest -# after_failure: -# - cat .kitchen/logs/kitchen.log -# env: -# - FEDORA=latest -# - KITCHEN_YAML=.kitchen.travis.yml -# - rvm: 2.4.2 -# services: docker -# sudo: required -# gemfile: kitchen-tests/Gemfile -# before_install: -# - gem update --system $(grep rubygems omnibus_overrides.rb | cut -d'"' -f2) -# - gem install bundler -v $(grep bundler omnibus_overrides.rb | cut -d'"' -f2) -# bundler_args: --without ci docgen guard integration maintenance omnibus_package --frozen -# before_script: -# - sudo iptables -L DOCKER || ( echo "DOCKER iptables chain missing" ; sudo iptables -N DOCKER ) -# - cd kitchen-tests -# script: -# - travis_wait bundle exec kitchen test base-amazonlinux -# after_failure: -# - cat .kitchen/logs/kitchen.log -# env: -# - AMAZONLINUX=LATEST -# - KITCHEN_YAML=.kitchen.travis.yml + - rvm: 2.4.2 + services: docker + sudo: required + gemfile: kitchen-tests/Gemfile + before_install: + - gem update --system $(grep rubygems omnibus_overrides.rb | cut -d'"' -f2) + - gem install bundler -v $(grep bundler omnibus_overrides.rb | cut -d'"' -f2) + bundler_args: --without ci docgen guard integration maintenance omnibus_package --frozen + before_script: + - sudo iptables -L DOCKER || ( echo "DOCKER iptables chain missing" ; sudo iptables -N DOCKER ) + - cd kitchen-tests + script: + - bundle exec kitchen test base-fedora-latest + after_failure: + - cat .kitchen/logs/kitchen.log + env: + - FEDORA=latest + - KITCHEN_YAML=.kitchen.travis.yml # - rvm: 2.4.2 # services: docker # sudo: required diff --git a/CHANGELOG.md b/CHANGELOG.md index 8fd1bb1815..b504d9d675 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,15 +1,22 @@ <!-- usage documentation: http://expeditor-docs.es.chef.io/configuration/changelog/ --> -<!-- latest_release 13.6.17 --> -## [v13.6.17](https://github.com/chef/chef/tree/v13.6.17) (2017-11-27) +<!-- latest_release unreleased --> +## Unreleased #### Merged Pull Requests -- Only warn if a secret was actually given [#6605](https://github.com/chef/chef/pull/6605) ([coderanger](https://github.com/coderanger)) +- Add Amazon Linux testing to PRs in Travis [#6611](https://github.com/chef/chef/pull/6611) ([tas50](https://github.com/tas50)) <!-- latest_release --> <!-- release_rollup since=13.6.4 --> ### Changes since 13.6.4 release #### Merged Pull Requests +- Add Amazon Linux testing to PRs in Travis [#6611](https://github.com/chef/chef/pull/6611) ([tas50](https://github.com/tas50)) <!-- 13.6.23 --> +- Hide sensitive properties in converge_if_changed. [#6576](https://github.com/chef/chef/pull/6576) ([cma-arnold](https://github.com/cma-arnold)) <!-- 13.6.23 --> +- Bump dependencies to pick up InSpec v1.46.2 [#6609](https://github.com/chef/chef/pull/6609) ([adamleff](https://github.com/adamleff)) <!-- 13.6.22 --> +- Fix windows_path converging on every run [#6541](https://github.com/chef/chef/pull/6541) ([tas50](https://github.com/tas50)) <!-- 13.6.21 --> +- add unit_name name_property to systemd_unit (fixes #6542) [#6546](https://github.com/chef/chef/pull/6546) ([nathwill](https://github.com/nathwill)) <!-- 13.6.20 --> +- fix NodeMap to not throw exceptions on platform_versions [#6608](https://github.com/chef/chef/pull/6608) ([lamont-granquist](https://github.com/lamont-granquist)) <!-- 13.6.19 --> +- Enable Fedora integration testing in Travis [#6523](https://github.com/chef/chef/pull/6523) ([tas50](https://github.com/tas50)) <!-- 13.6.18 --> - Only warn if a secret was actually given [#6605](https://github.com/chef/chef/pull/6605) ([coderanger](https://github.com/coderanger)) <!-- 13.6.17 --> - Makes life easier for hook authors switching from the older report handler syntax [#6574](https://github.com/chef/chef/pull/6574) ([coderanger](https://github.com/coderanger)) <!-- 13.6.16 --> - [MSYS-688] Fixed invalid date and Invalid starttime error [#6544](https://github.com/chef/chef/pull/6544) ([NimishaS](https://github.com/NimishaS)) <!-- 13.6.15 --> diff --git a/Gemfile.lock b/Gemfile.lock index 6b32e1c93d..223620280e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -17,10 +17,10 @@ GIT PATH remote: . specs: - chef (13.6.17) + chef (13.6.23) addressable bundler (>= 1.10) - chef-config (= 13.6.17) + chef-config (= 13.6.23) chef-zero (>= 13.0) diff-lcs (~> 1.2, >= 1.2.4) erubis (~> 2.7) @@ -47,10 +47,10 @@ PATH specinfra (~> 2.10) syslog-logger (~> 1.6) uuidtools (~> 2.1.5) - chef (13.6.17-universal-mingw32) + chef (13.6.23-universal-mingw32) addressable bundler (>= 1.10) - chef-config (= 13.6.17) + chef-config (= 13.6.23) chef-zero (>= 13.0) diff-lcs (~> 1.2, >= 1.2.4) erubis (~> 2.7) @@ -92,7 +92,7 @@ PATH PATH remote: chef-config specs: - chef-config (13.6.17) + chef-config (13.6.23) addressable fuzzyurl mixlib-config (~> 2.0) @@ -104,12 +104,10 @@ GEM addressable (2.4.0) appbundler (0.10.0) mixlib-cli (~> 1.4) - mixlib-shellout (~> 2.0) ast (2.3.0) backports (3.10.3) - binding_of_caller (0.7.2) + binding_of_caller (0.7.3) debug_inspector (>= 0.0.1) - blankslate (2.1.2.4) builder (3.2.3) byebug (9.1.0) chef-vault (3.3.0) @@ -119,7 +117,7 @@ GEM mixlib-log (~> 1.3) rack (~> 2.0) uuidtools (~> 2.1) - cheffish (13.0.0) + cheffish (13.1.0) chef-zero (~> 13.0) net-ssh coderay (1.1.2) @@ -128,11 +126,11 @@ GEM debug_inspector (0.0.3) diff-lcs (1.3) docile (1.1.5) - docker-api (1.33.6) - excon (>= 0.38.0) - json + docker-api (1.34.0) + excon (>= 0.47.0) + multi_json erubis (2.7.0) - ethon (0.10.1) + ethon (0.11.0) ffi (>= 1.3.0) excon (0.59.0) faraday (0.13.1) @@ -164,7 +162,7 @@ GEM htmlentities (4.3.4) httpclient (2.8.3) iniparse (1.4.4) - inspec (1.42.3) + inspec (1.46.2) addressable (~> 2.4) faraday (>= 0.9.0) hashie (~> 3.4) @@ -182,8 +180,8 @@ GEM semverse sslshake (~> 1.2) thor (~> 0.19) - toml (~> 0.1) - train (~> 0.28) + tomlrb (~> 1.2) + train (~> 0.29, >= 0.29.2) ipaddress (0.8.3) iso8601 (0.9.1) json (2.1.0) @@ -237,17 +235,16 @@ GEM systemu (~> 2.6.4) wmi-lite (~> 1.0) parallel (1.12.0) - parser (2.4.0.0) - ast (~> 2.2) - parslet (1.5.0) - blankslate (~> 2.0) + parser (2.4.0.2) + ast (~> 2.3) + parslet (1.8.1) plist (3.3.0) powerpack (0.1.1) proxifier (1.0.3) - pry (0.11.2) + pry (0.11.3) coderay (~> 1.1.0) method_source (~> 0.9.0) - pry-byebug (3.5.0) + pry-byebug (3.5.1) byebug (~> 9.1) pry (~> 0.10) pry-remote (0.1.8) @@ -262,7 +259,7 @@ GEM rack (2.0.3) rainbow (2.2.2) rake - rake (12.1.0) + rake (12.3.0) rb-readline (0.5.5) rspec (3.7.0) rspec-core (~> 3.7.0) @@ -321,10 +318,8 @@ GEM syslog-logger (1.6.8) systemu (2.6.5) thor (0.20.0) - toml (0.1.2) - parslet (~> 1.5.0) - tomlrb (1.2.5) - train (0.28.0) + tomlrb (1.2.6) + train (0.29.2) docker-api (~> 1.26) json (>= 1.8, < 3.0) mixlib-shellout (~> 2.0) @@ -345,11 +340,11 @@ GEM ethon (>= 0.8.0) unicode-display_width (1.3.0) uuidtools (2.1.5) - webmock (3.1.0) + webmock (3.1.1) addressable (>= 2.3.6) crack (>= 0.3.2) hashdiff - websocket (1.2.4) + websocket (1.2.5) win32-api (1.5.3-universal-mingw32) win32-dir (0.5.1) ffi (>= 1.0.0) @@ -379,13 +374,13 @@ GEM logging (>= 1.6.1, < 3.0) nori (~> 2.0) rubyntlm (~> 0.6.0, >= 0.6.1) - winrm-fs (1.1.0) + winrm-fs (1.1.1) erubis (~> 2.7) logging (>= 1.6.1, < 3.0) rubyzip (~> 1.1) winrm (~> 2.0) wmi-lite (1.0.0) - yard (0.9.9) + yard (0.9.12) PLATFORMS ruby @@ -1 +1 @@ -13.6.17
\ No newline at end of file +13.6.23
\ No newline at end of file diff --git a/chef-config/lib/chef-config/version.rb b/chef-config/lib/chef-config/version.rb index d63d24efbf..431af35dc0 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 = "13.6.17" + VERSION = "13.6.23" end # diff --git a/kitchen-tests/.kitchen.travis.yml b/kitchen-tests/.kitchen.travis.yml index 720f034cb5..b8b4e4737b 100644 --- a/kitchen-tests/.kitchen.travis.yml +++ b/kitchen-tests/.kitchen.travis.yml @@ -29,6 +29,14 @@ verifier: format: progress platforms: +- name: amazonlinux + driver: + image: dokken/amazonlinux + pid_one_command: /sbin/init + intermediate_instructions: + - RUN yum -y install sudo + - RUN sed -i -e "s/Defaults.*requiretty.*/Defaults !requiretty/g" /etc/sudoers + - name: debian-7 driver: image: dokken/debian-7 @@ -57,13 +65,10 @@ platforms: - name: centos-6 driver: image: dokken/centos-6 - run_command: /sbin/init + pid_one_command: /sbin/init intermediate_instructions: - RUN yum -y install sudo - RUN sed -i -e "s/Defaults.*requiretty.*/Defaults !requiretty/g" /etc/sudoers - attributes: - chef_client: - init_style: init - name: centos-7 driver: @@ -102,14 +107,6 @@ platforms: image: dokken/opensuse-leap pid_one_command: /bin/systemd -- name: amazonlinux - driver: - image: dokken/amazonlinux - pid_one_command: /sbin/init - intermediate_instructions: - - RUN yum -y install sudo - - RUN sed -i -e "s/Defaults.*requiretty.*/Defaults !requiretty/g" /etc/sudoers - suites: - name: base run_list: diff --git a/kitchen-tests/.kitchen.yml b/kitchen-tests/.kitchen.yml index 4e570b125e..080cad85a9 100644 --- a/kitchen-tests/.kitchen.yml +++ b/kitchen-tests/.kitchen.yml @@ -17,15 +17,21 @@ provisioner: github_repo: "chef" ohai_refname: "master" refname: <%= %x(git rev-parse HEAD) %> - data_path: test/fixtures client_rb: diff_disabled: true platforms: + - name: amazonlinux + driver_config: + box: mvbcoding/awslinux + - name: centos-6 + - name: centos-7 + - name: debian-7 + - name: debian-8 + - name: debian-9 + - name: opensuse-leap-42 - name: ubuntu-14.04 - name: ubuntu-16.04 - - name: centos-7 - - name: centos-6 suites: - name: base diff --git a/kitchen-tests/Berksfile.lock b/kitchen-tests/Berksfile.lock index 6cd1308fcd..0f41f7bf5e 100644 --- a/kitchen-tests/Berksfile.lock +++ b/kitchen-tests/Berksfile.lock @@ -19,35 +19,34 @@ GRAPH sudo (>= 0.0.0) ubuntu (>= 0.0.0) users (>= 0.0.0) - build-essential (8.0.3) + build-essential (8.0.4) mingw (>= 1.1) seven_zip (>= 0.0.0) - chef-client (8.1.8) - cron (>= 2.0.0) + chef-client (9.0.2) + cron (>= 4.2.0) logrotate (>= 1.9.0) windows (>= 2.0.0) chef_hostname (0.6.1) compat_resource (12.19.0) - cron (4.1.3) - compat_resource (>= 0.0.0) - iptables (4.2.1) + cron (5.0.1) + iptables (4.3.1) logrotate (2.2.0) mingw (2.0.1) seven_zip (>= 0.0.0) multipackage (4.0.0) compat_resource (>= 0.0.0) nscd (5.0.0) - ntp (3.5.2) + ntp (3.5.4) ohai (5.2.0) - openssh (2.5.0) + openssh (2.6.1) iptables (>= 1.0) resolver (2.0.1) selinux (2.1.0) seven_zip (2.0.2) windows (>= 1.2.2) - sudo (3.5.3) + sudo (4.0.0) ubuntu (2.0.1) apt (>= 0.0.0) - users (5.1.0) - windows (3.1.2) + users (5.2.2) + windows (3.4.0) ohai (>= 4.0.0) diff --git a/kitchen-tests/Gemfile.lock b/kitchen-tests/Gemfile.lock index 8881c6b839..3dfae20dd8 100644 --- a/kitchen-tests/Gemfile.lock +++ b/kitchen-tests/Gemfile.lock @@ -1,38 +1,32 @@ GEM remote: https://rubygems.org/ specs: - addressable (2.5.1) - public_suffix (~> 2.0, >= 2.0.2) - artifactory (2.8.1) - aws-sdk (2.9.1) - aws-sdk-resources (= 2.9.1) - aws-sdk-core (2.9.1) + addressable (2.5.2) + public_suffix (>= 2.0.2, < 4.0) + aws-sdk (2.10.94) + aws-sdk-resources (= 2.10.94) + aws-sdk-core (2.10.94) aws-sigv4 (~> 1.0) jmespath (~> 1.0) - aws-sdk-resources (2.9.1) - aws-sdk-core (= 2.9.1) - aws-sigv4 (1.0.0) - berkshelf (5.6.4) - addressable (~> 2.3, >= 2.3.4) - berkshelf-api-client (>= 2.0.2, < 4.0) + aws-sdk-resources (2.10.94) + aws-sdk-core (= 2.10.94) + aws-sigv4 (1.0.2) + berkshelf (6.3.1) buff-config (~> 2.0) buff-extensions (~> 2.0) - buff-shell_out (~> 1.0) + chef (>= 12.7.2) cleanroom (~> 1.0) + concurrent-ruby (~> 1.0) faraday (~> 0.9) httpclient (~> 2.7) minitar (~> 0.5, >= 0.5.4) mixlib-archive (~> 0.4) + mixlib-shellout (~> 2.0) octokit (~> 4.0) retryable (~> 2.0) ridley (~> 5.0) - solve (> 2.0, < 4.0) + solve (~> 4.0) thor (~> 0.19, < 0.19.2) - berkshelf-api-client (3.0.0) - faraday (~> 0.9) - httpclient (~> 2.7) - ridley (>= 4.5, < 6.0) - blankslate (2.1.2.4) buff-config (2.0.0) buff-extensions (~> 2.0) varia_model (~> 0.6) @@ -47,119 +41,220 @@ GEM celluloid-io (0.16.2) celluloid (>= 0.16.0) nio4r (>= 1.1.0) - chef-config (12.19.36) + chef (12.21.26) + addressable + bundler (>= 1.10) + chef-config (= 12.21.26) + chef-zero (>= 4.8, < 13) + diff-lcs (~> 1.2, >= 1.2.4) + erubis (~> 2.7) + ffi-yajl (~> 2.2) + highline (~> 1.6, >= 1.6.9) + iniparse (~> 1.4) + mixlib-archive (~> 0.4) + mixlib-authentication (~> 1.4) + mixlib-cli (~> 1.7) + mixlib-log (~> 1.3) + mixlib-shellout (~> 2.0) + net-sftp (~> 2.1, >= 2.1.2) + net-ssh (>= 2.9, < 5.0) + net-ssh-multi (~> 1.2, >= 1.2.1) + ohai (>= 8.6.0.alpha.1, < 13) + plist (~> 3.2) + proxifier (~> 1.0) + rspec-core (~> 3.5) + rspec-expectations (~> 3.5) + rspec-mocks (~> 3.5) + rspec_junit_formatter (~> 0.2.0) + serverspec (~> 2.7) + specinfra (~> 2.10) + syslog-logger (~> 1.6) + uuidtools (~> 2.1.5) + chef (12.21.26-universal-mingw32) + addressable + bundler (>= 1.10) + chef-config (= 12.21.26) + chef-zero (>= 4.8, < 13) + diff-lcs (~> 1.2, >= 1.2.4) + erubis (~> 2.7) + ffi (~> 1.9) + ffi-yajl (~> 2.2) + highline (~> 1.6, >= 1.6.9) + iniparse (~> 1.4) + mixlib-archive (~> 0.4) + mixlib-authentication (~> 1.4) + mixlib-cli (~> 1.7) + mixlib-log (~> 1.3) + mixlib-shellout (~> 2.0) + net-sftp (~> 2.1, >= 2.1.2) + net-ssh (>= 2.9, < 5.0) + net-ssh-multi (~> 1.2, >= 1.2.1) + ohai (>= 8.6.0.alpha.1, < 13) + plist (~> 3.2) + proxifier (~> 1.0) + rspec-core (~> 3.5) + rspec-expectations (~> 3.5) + rspec-mocks (~> 3.5) + rspec_junit_formatter (~> 0.2.0) + serverspec (~> 2.7) + specinfra (~> 2.10) + syslog-logger (~> 1.6) + uuidtools (~> 2.1.5) + win32-api (~> 1.5.3) + win32-dir (~> 0.5.0) + win32-event (~> 0.6.1) + win32-eventlog (= 0.6.3) + win32-mmap (~> 0.4.1) + win32-mutex (~> 0.4.2) + win32-process (~> 0.8.2) + win32-service (~> 0.8.7) + windows-api (~> 0.4.4) + wmi-lite (~> 1.0) + chef-config (12.21.26) addressable fuzzyurl mixlib-config (~> 2.0) mixlib-shellout (~> 2.0) + chef-zero (5.3.2) + ffi-yajl (~> 2.2) + hashie (>= 2.0, < 4.0) + mixlib-log (~> 1.3) + rack (~> 2.0) + uuidtools (~> 2.1) cleanroom (1.0.0) - coderay (1.1.1) + coderay (1.1.2) + concurrent-ruby (1.0.5) diff-lcs (1.3) - docker-api (1.33.2) - excon (>= 0.38.0) - json + docker-api (1.34.0) + excon (>= 0.47.0) + multi_json erubis (2.7.0) - excon (0.55.0) - faraday (0.9.2) + excon (0.59.0) + faraday (0.13.1) multipart-post (>= 1.2, < 3) ffi (1.9.18) ffi (1.9.18-x86-mingw32) + ffi-win32-extensions (1.0.3) + ffi + ffi-yajl (2.3.1) + libyajl2 (~> 1.2) fuzzyurl (0.9.0) gssapi (1.2.0) ffi (>= 1.0.1) gyoku (1.3.1) builder (>= 2.1.2) - hashie (3.5.5) - hitimes (1.2.4) - hitimes (1.2.4-x86-mingw32) + hashie (3.5.6) + highline (1.7.10) + hitimes (1.2.6) + hitimes (1.2.6-x86-mingw32) + htmlentities (4.3.4) httpclient (2.8.3) - inspec (1.18.0) - addressable (~> 2.5) + iniparse (1.4.4) + inspec (1.46.2) + addressable (~> 2.4) faraday (>= 0.9.0) hashie (~> 3.4) + htmlentities json (>= 1.8, < 3.0) method_source (~> 0.8) mixlib-log - nokogiri (~> 1.6) parallel (~> 1.9) + parslet (~> 1.5) pry (~> 0) rainbow (~> 2) rspec (~> 3) rspec-its (~> 1.2) rubyzip (~> 1.1) - sslshake (~> 1) + semverse + sslshake (~> 1.2) thor (~> 0.19) - toml (~> 0.1) - train (>= 0.22.0, < 1.0) + tomlrb (~> 1.2) + train (~> 0.29, >= 0.29.2) + ipaddress (0.8.3) jmespath (1.3.1) - json (2.0.3) + json (2.1.0) kitchen-appbundle-updater (0.2.0) kitchen-dokken (1.1.0) docker-api (~> 1.33) test-kitchen (~> 1.13) - kitchen-ec2 (1.3.2) + kitchen-ec2 (1.4.0) aws-sdk (~> 2) excon multi_json retryable (~> 2.0) test-kitchen (~> 1.4, >= 1.4.1) - kitchen-inspec (0.17.0) + kitchen-inspec (0.20.0) hashie (~> 3.4) inspec (>= 0.34.0, < 2.0.0) test-kitchen (~> 1.6) - kitchen-vagrant (1.0.2) + kitchen-vagrant (1.2.1) test-kitchen (~> 1.4) + libyajl2 (1.2.0) little-plugger (1.1.4) - logging (2.2.0) + logging (2.2.2) little-plugger (~> 1.1) multi_json (~> 1.10) - method_source (0.8.2) - mini_portile (0.6.2) + method_source (0.9.0) minitar (0.6.1) mixlib-archive (0.4.1) mixlib-log - mixlib-authentication (1.4.1) - mixlib-log + mixlib-authentication (1.4.2) + mixlib-cli (1.7.0) mixlib-config (2.2.4) - mixlib-install (2.1.12) - artifactory + mixlib-install (3.8.0) mixlib-shellout mixlib-versioning thor mixlib-log (1.7.1) - mixlib-shellout (2.2.7) - mixlib-shellout (2.2.7-universal-mingw32) + mixlib-shellout (2.3.2) + mixlib-shellout (2.3.2-universal-mingw32) win32-process (~> 0.8.2) wmi-lite (~> 1.0) - mixlib-versioning (1.1.0) - molinillo (0.5.7) - multi_json (1.12.1) + mixlib-versioning (1.2.2) + molinillo (0.6.4) + multi_json (1.12.2) multipart-post (2.0.0) net-scp (1.2.1) net-ssh (>= 2.6.5) - net-ssh (4.1.0) + net-sftp (2.1.2) + net-ssh (>= 2.6.5) + net-ssh (4.2.0) net-ssh-gateway (1.3.0) net-ssh (>= 2.6.5) - nio4r (2.0.0) - nokogiri (1.6.6.4) - mini_portile (~> 0.6.0) - nokogiri (1.6.6.4-x86-mingw32) - mini_portile (~> 0.6.0) + net-ssh-multi (1.2.1) + net-ssh (>= 2.6.5) + net-ssh-gateway (>= 1.2.0) + net-telnet (0.1.1) + nio4r (2.1.0) nori (2.6.0) - octokit (4.6.2) + octokit (4.7.0) sawyer (~> 0.8.0, >= 0.5.3) - parallel (1.11.1) - parslet (1.5.0) - blankslate (~> 2.0) - pry (0.10.4) + ohai (8.25.1) + chef-config (>= 12.5.0.alpha.1, < 14) + ffi (~> 1.9) + ffi-yajl (~> 2.2) + ipaddress + mixlib-cli + mixlib-config (~> 2.0) + mixlib-log (>= 1.7.1, < 2.0) + mixlib-shellout (~> 2.0) + plist (~> 3.1) + systemu (~> 2.6.4) + wmi-lite (~> 1.0) + parallel (1.12.0) + parslet (1.8.1) + plist (3.3.0) + proxifier (1.0.3) + pry (0.11.3) coderay (~> 1.1.0) - method_source (~> 0.8.1) - slop (~> 3.4) - public_suffix (2.0.5) - rainbow (2.2.1) - rake (12.0.0) + method_source (~> 0.9.0) + public_suffix (3.0.1) + rack (2.0.3) + rainbow (2.2.2) + rake + rake (12.3.0) retryable (2.0.4) - ridley (5.1.0) + ridley (5.1.1) addressable buff-config (~> 2.0) buff-extensions (~> 2.0) @@ -169,7 +264,7 @@ GEM celluloid-io (~> 0.16.1) chef-config (>= 12.5.0) erubis - faraday (~> 0.9.0) + faraday (~> 0.9) hashie (>= 2.0.2, < 4.0.0) httpclient (~> 2.7) json (>= 1.7.7) @@ -177,48 +272,65 @@ GEM retryable (~> 2.0) semverse (~> 2.0) varia_model (~> 0.6) - rspec (3.5.0) - rspec-core (~> 3.5.0) - rspec-expectations (~> 3.5.0) - rspec-mocks (~> 3.5.0) - rspec-core (3.5.4) - rspec-support (~> 3.5.0) - rspec-expectations (3.5.0) + rspec (3.7.0) + rspec-core (~> 3.7.0) + rspec-expectations (~> 3.7.0) + rspec-mocks (~> 3.7.0) + rspec-core (3.7.0) + rspec-support (~> 3.7.0) + rspec-expectations (3.7.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.5.0) + rspec-support (~> 3.7.0) rspec-its (1.2.0) rspec-core (>= 3.0.0) rspec-expectations (>= 3.0.0) - rspec-mocks (3.5.0) + rspec-mocks (3.7.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.5.0) - rspec-support (3.5.0) - rubyntlm (0.6.1) + rspec-support (~> 3.7.0) + rspec-support (3.7.0) + rspec_junit_formatter (0.2.3) + builder (< 4) + rspec-core (>= 2, < 4, != 2.12.0) + rubyntlm (0.6.2) rubyzip (1.2.1) safe_yaml (1.0.4) sawyer (0.8.1) addressable (>= 2.3.5, < 2.6) faraday (~> 0.8, < 1.0) semverse (2.0.0) - slop (3.6.0) - solve (3.1.0) - molinillo (>= 0.5) + serverspec (2.41.3) + multi_json + rspec (~> 3.0) + rspec-its + specinfra (~> 2.72) + sfl (2.3) + solve (4.0.0) + molinillo (~> 0.6) semverse (>= 1.1, < 3.0) - sslshake (1.1.0) - test-kitchen (1.16.0) - mixlib-install (>= 1.2, < 3.0) + specinfra (2.72.1) + net-scp + net-ssh (>= 2.7, < 5.0) + net-telnet + sfl + sslshake (1.2.0) + syslog-logger (1.6.8) + systemu (2.6.5) + test-kitchen (1.19.2) + mixlib-install (~> 3.6) mixlib-shellout (>= 1.2, < 3.0) net-scp (~> 1.1) net-ssh (>= 2.9, < 5.0) net-ssh-gateway (~> 1.2) safe_yaml (~> 1.0) thor (~> 0.19, < 0.19.2) + winrm (~> 2.0) + winrm-elevated (~> 1.0) + winrm-fs (~> 1.1.0) thor (0.19.1) timers (4.0.4) hitimes - toml (0.1.2) - parslet (~> 1.5.0) - train (0.23.0) + tomlrb (1.2.6) + train (0.29.2) docker-api (~> 1.26) json (>= 1.8, < 3.0) mixlib-shellout (~> 2.0) @@ -226,13 +338,32 @@ GEM net-ssh (>= 2.9, < 5.0) winrm (~> 2.0) winrm-fs (~> 1.0) + uuidtools (2.1.5) vagrant-wrapper (2.0.3) varia_model (0.6.0) buff-extensions (~> 2.0) hashie (>= 2.0.2, < 4.0.0) + win32-api (1.5.3-universal-mingw32) + win32-dir (0.5.1) + ffi (>= 1.0.0) + win32-event (0.6.3) + win32-ipc (>= 0.6.0) + win32-eventlog (0.6.3) + ffi + win32-ipc (0.7.0) + ffi + win32-mmap (0.4.2) + ffi + win32-mutex (0.4.3) + win32-ipc (>= 0.6.0) win32-process (0.8.3) ffi (>= 1.0.0) - winrm (2.1.3) + win32-service (0.8.10) + ffi + ffi-win32-extensions + windows-api (0.4.4) + win32-api (>= 1.4.5) + winrm (2.2.3) builder (>= 2.1.2) erubis (~> 2.7) gssapi (~> 1.2) @@ -241,7 +372,10 @@ GEM logging (>= 1.6.1, < 3.0) nori (~> 2.0) rubyntlm (~> 0.6.0, >= 0.6.1) - winrm-fs (1.0.1) + winrm-elevated (1.1.0) + winrm (~> 2.0) + winrm-fs (~> 1.0) + winrm-fs (1.1.1) erubis (~> 2.7) logging (>= 1.6.1, < 3.0) rubyzip (~> 1.1) @@ -266,4 +400,4 @@ DEPENDENCIES vagrant-wrapper BUNDLED WITH - 1.14.6 + 1.16.0 diff --git a/kitchen-tests/cookbooks/audit_test/.gitignore b/kitchen-tests/cookbooks/audit_test/.gitignore deleted file mode 100644 index 1e074046f0..0000000000 --- a/kitchen-tests/cookbooks/audit_test/.gitignore +++ /dev/null @@ -1,15 +0,0 @@ -.vagrant -*~ -*# -.#* -\#*# -.*.sw[a-z] -*.un~ - -# Bundler -Gemfile.lock -bin/* -.bundle/* - -.kitchen/ -.kitchen.local.yml diff --git a/kitchen-tests/cookbooks/audit_test/chefignore b/kitchen-tests/cookbooks/audit_test/chefignore deleted file mode 100644 index 80dc2d20ef..0000000000 --- a/kitchen-tests/cookbooks/audit_test/chefignore +++ /dev/null @@ -1,95 +0,0 @@ -# Put files/directories that should be ignored in this file when uploading -# or sharing to the community site. -# Lines that start with '# ' are comments. - -# OS generated files # -###################### -.DS_Store -Icon? -nohup.out -ehthumbs.db -Thumbs.db - -# SASS # -######## -.sass-cache - -# EDITORS # -########### -\#* -.#* -*~ -*.sw[a-z] -*.bak -REVISION -TAGS* -tmtags -*_flymake.* -*_flymake -*.tmproj -.project -.settings -mkmf.log - -## COMPILED ## -############## -a.out -*.o -*.pyc -*.so -*.com -*.class -*.dll -*.exe -*/rdoc/ - -# Testing # -########### -.watchr -.rspec -spec/* -spec/fixtures/* -test/* -features/* -Guardfile -Procfile - -# SCM # -####### -.git -*/.git -.gitignore -.gitmodules -.gitconfig -.gitattributes -.svn -*/.bzr/* -*/.hg/* -*/.svn/* - -# Berkshelf # -############# -Berksfile -Berksfile.lock -cookbooks/* -tmp - -# Cookbooks # -############# -CONTRIBUTING - -# Strainer # -############ -Colanderfile -Strainerfile -.colander -.strainer - -# Vagrant # -########### -.vagrant -Vagrantfile - -# Travis # -########## -.travis.yml diff --git a/kitchen-tests/cookbooks/base/attributes/default.rb b/kitchen-tests/cookbooks/base/attributes/default.rb index 75e57cb27b..e22dfa9fae 100644 --- a/kitchen-tests/cookbooks/base/attributes/default.rb +++ b/kitchen-tests/cookbooks/base/attributes/default.rb @@ -43,7 +43,6 @@ default["openssh"]["server"]["challenge_response_authentication"] = "no" default["openssh"]["server"]["kerberos_authentication"] = "no" # tcp keepalives are useful to keep connections up through VPNs and firewalls default["openssh"]["server"]["tcp_keepalive"] = "yes" -default["openssh"]["server"]["use_privilege_separation"] = "yes" default["openssh"]["server"]["max_start_ups"] = "10" # PAM (i think) already prints the motd on login default["openssh"]["server"]["print_motd"] = "no" diff --git a/lib/chef/node_map.rb b/lib/chef/node_map.rb index 7a1a09ae24..25b1f57d44 100644 --- a/lib/chef/node_map.rb +++ b/lib/chef/node_map.rb @@ -143,7 +143,7 @@ class Chef filter_values.empty? || Array(filter_values).any? do |v| - Chef::VersionConstraint::Platform.new(v).include?(value) + Gem::Requirement.new(v).satisfied_by?(Gem::Version.new(value)) end end diff --git a/lib/chef/provider.rb b/lib/chef/provider.rb index 1ebdfa6feb..9e9013b24e 100644 --- a/lib/chef/provider.rb +++ b/lib/chef/provider.rb @@ -250,7 +250,13 @@ class Chef properties_str = if new_resource.sensitive specified_properties.join(", ") else - specified_properties.map { |p| "#{p}=#{new_resource.send(p).inspect}" }.join(", ") + specified_properties.map do |property| + "#{property}=" << if new_resource.class.properties[property].sensitive? + "(suppressed sensitive property)" + else + new_resource.send(property).inspect + end + end.join(", ") end Chef::Log.debug("Skipping update of #{new_resource}: has not changed any of the specified properties #{properties_str}.") return false @@ -259,7 +265,7 @@ class Chef # Print the pretty green text and run the block property_size = modified.map { |p| p.size }.max modified.map! do |p| - properties_str = if new_resource.sensitive + properties_str = if new_resource.sensitive || new_resource.class.properties[p].sensitive? "(suppressed sensitive property)" else "#{new_resource.send(p).inspect} (was #{current_resource.send(p).inspect})" @@ -274,7 +280,7 @@ class Chef property_size = properties.map { |p| p.size }.max created = properties.map do |property| default = " (default value)" unless new_resource.property_is_set?(property) - properties_str = if new_resource.sensitive + properties_str = if new_resource.sensitive || new_resource.class.properties[property].sensitive? "(suppressed sensitive property)" else new_resource.send(property).inspect diff --git a/lib/chef/provider/systemd_unit.rb b/lib/chef/provider/systemd_unit.rb index a2ef64044b..e1853bd984 100644 --- a/lib/chef/provider/systemd_unit.rb +++ b/lib/chef/provider/systemd_unit.rb @@ -35,6 +35,7 @@ class Chef def load_current_resource @current_resource = Chef::Resource::SystemdUnit.new(new_resource.name) + current_resource.unit_name(new_resource.unit_name) current_resource.content(::File.read(unit_path)) if ::File.exist?(unit_path) current_resource.user(new_resource.user) current_resource.enabled(enabled?) @@ -57,7 +58,7 @@ class Chef def action_create if current_resource.content != new_resource.to_ini - converge_by("creating unit: #{new_resource.name}") do + converge_by("creating unit: #{new_resource.unit_name}") do manage_unit_file(:create) daemon_reload if new_resource.triggers_reload end @@ -66,7 +67,7 @@ class Chef def action_delete if ::File.exist?(unit_path) - converge_by("deleting unit: #{new_resource.name}") do + converge_by("deleting unit: #{new_resource.unit_name}") do manage_unit_file(:delete) daemon_reload if new_resource.triggers_reload end @@ -75,117 +76,117 @@ class Chef def action_enable if current_resource.static - Chef::Log.debug("#{new_resource.name} is a static unit, enabling is a NOP.") + Chef::Log.debug("#{new_resource.unit_name} is a static unit, enabling is a NOP.") end unless current_resource.enabled || current_resource.static - converge_by("enabling unit: #{new_resource.name}") do - systemctl_execute!(:enable, new_resource.name) + converge_by("enabling unit: #{new_resource.unit_name}") do + systemctl_execute!(:enable, new_resource.unit_name) end end end def action_disable if current_resource.static - Chef::Log.debug("#{new_resource.name} is a static unit, disabling is a NOP.") + Chef::Log.debug("#{new_resource.unit_name} is a static unit, disabling is a NOP.") end if current_resource.enabled && !current_resource.static - converge_by("disabling unit: #{new_resource.name}") do - systemctl_execute!(:disable, new_resource.name) + converge_by("disabling unit: #{new_resource.unit_name}") do + systemctl_execute!(:disable, new_resource.unit_name) end end end def action_mask unless current_resource.masked - converge_by("masking unit: #{new_resource.name}") do - systemctl_execute!(:mask, new_resource.name) + converge_by("masking unit: #{new_resource.unit_name}") do + systemctl_execute!(:mask, new_resource.unit_name) end end end def action_unmask if current_resource.masked - converge_by("unmasking unit: #{new_resource.name}") do - systemctl_execute!(:unmask, new_resource.name) + converge_by("unmasking unit: #{new_resource.unit_name}") do + systemctl_execute!(:unmask, new_resource.unit_name) end end end def action_start unless current_resource.active - converge_by("starting unit: #{new_resource.name}") do - systemctl_execute!(:start, new_resource.name) + converge_by("starting unit: #{new_resource.unit_name}") do + systemctl_execute!(:start, new_resource.unit_name) end end end def action_stop if current_resource.active - converge_by("stopping unit: #{new_resource.name}") do - systemctl_execute!(:stop, new_resource.name) + converge_by("stopping unit: #{new_resource.unit_name}") do + systemctl_execute!(:stop, new_resource.unit_name) end end end def action_restart - converge_by("restarting unit: #{new_resource.name}") do - systemctl_execute!(:restart, new_resource.name) + converge_by("restarting unit: #{new_resource.unit_name}") do + systemctl_execute!(:restart, new_resource.unit_name) end end def action_reload if current_resource.active - converge_by("reloading unit: #{new_resource.name}") do - systemctl_execute!(:reload, new_resource.name) + converge_by("reloading unit: #{new_resource.unit_name}") do + systemctl_execute!(:reload, new_resource.unit_name) end else - Chef::Log.debug("#{new_resource.name} is not active, skipping reload.") + Chef::Log.debug("#{new_resource.unit_name} is not active, skipping reload.") end end def action_try_restart - converge_by("try-restarting unit: #{new_resource.name}") do - systemctl_execute!("try-restart", new_resource.name) + converge_by("try-restarting unit: #{new_resource.unit_name}") do + systemctl_execute!("try-restart", new_resource.unit_name) end end def action_reload_or_restart - converge_by("reload-or-restarting unit: #{new_resource.name}") do - systemctl_execute!("reload-or-restart", new_resource.name) + converge_by("reload-or-restarting unit: #{new_resource.unit_name}") do + systemctl_execute!("reload-or-restart", new_resource.unit_name) end end def action_reload_or_try_restart - converge_by("reload-or-try-restarting unit: #{new_resource.name}") do - systemctl_execute!("reload-or-try-restart", new_resource.name) + converge_by("reload-or-try-restarting unit: #{new_resource.unit_name}") do + systemctl_execute!("reload-or-try-restart", new_resource.unit_name) end end def active? - systemctl_execute("is-active", new_resource.name).exitstatus == 0 + systemctl_execute("is-active", new_resource.unit_name).exitstatus == 0 end def enabled? - systemctl_execute("is-enabled", new_resource.name).exitstatus == 0 + systemctl_execute("is-enabled", new_resource.unit_name).exitstatus == 0 end def masked? - systemctl_execute(:status, new_resource.name).stdout.include?("masked") + systemctl_execute(:status, new_resource.unit_name).stdout.include?("masked") end def static? - systemctl_execute("is-enabled", new_resource.name).stdout.include?("static") + systemctl_execute("is-enabled", new_resource.unit_name).stdout.include?("static") end private def unit_path if new_resource.user - "/etc/systemd/user/#{new_resource.name}" + "/etc/systemd/user/#{new_resource.unit_name}" else - "/etc/systemd/system/#{new_resource.name}" + "/etc/systemd/system/#{new_resource.unit_name}" end end diff --git a/lib/chef/provider/windows_path.rb b/lib/chef/provider/windows_path.rb index b31789b4b9..e31ecaf2a0 100644 --- a/lib/chef/provider/windows_path.rb +++ b/lib/chef/provider/windows_path.rb @@ -37,12 +37,10 @@ class Chef # the PATH environment variable. Ruby expects these to be expanded. # path = expand_path(new_resource.path) - converge_by "Adding #{new_resource.path} to path environment variable" do - declare_resource(:env, "path") do - action :modify - delim ::File::PATH_SEPARATOR - value path.tr("/", '\\') - end + declare_resource(:env, "path") do + action :modify + delim ::File::PATH_SEPARATOR + value path.tr("/", '\\') end end diff --git a/lib/chef/resource/systemd_unit.rb b/lib/chef/resource/systemd_unit.rb index 1a19a7d682..66c4e6f594 100644 --- a/lib/chef/resource/systemd_unit.rb +++ b/lib/chef/resource/systemd_unit.rb @@ -46,6 +46,9 @@ class Chef default: true, desired_state: false property :verify, [TrueClass, FalseClass], default: true, desired_state: false + property :unit_name, String, desired_state: false, + identity: true, + name_property: true def to_ini case content diff --git a/lib/chef/version.rb b/lib/chef/version.rb index 492da224c5..dad128d9cb 100644 --- a/lib/chef/version.rb +++ b/lib/chef/version.rb @@ -23,7 +23,7 @@ require "chef/version_string" class Chef CHEF_ROOT = File.expand_path("../..", __FILE__) - VERSION = Chef::VersionString.new("13.6.17") + VERSION = Chef::VersionString.new("13.6.23") end # diff --git a/lib/chef/version/platform.rb b/lib/chef/version/platform.rb index 07b1a17b11..6d8f4192fe 100644 --- a/lib/chef/version/platform.rb +++ b/lib/chef/version/platform.rb @@ -16,6 +16,24 @@ require "chef/version_class" +# NOTE: this is fairly badly broken for its purpose and should not be used +# unless it gets fixed. + +# this strictly wants x, x.y, or x.y.z version constraints in the target and +# will fail hard if it does not match. the semantics that we need here is that +# it must always do the best job that it can do and consume as much of the +# offered version as it can. since we accept arbitrarily parsed strings into +# node[:platform_version] out of dozens or potentially hundreds of operating +# systems this parsing code needs to be fixed to never raise. the Gem::Version +# class is a better model, and in fact it might be a substantially better approach +# to base this class on Gem::Version and then do pre-mangling of things like windows +# version strings via e.g. `.gsub(/R/, '.')`. the raising behavior of this parser +# however, breaks the ProviderResolver in a not just buggy but a "completely unfit +# for purpose" way. +# +# TL;DR: MUST follow the second part of "Be conservative in what you send, +# be liberal in what you accept" +# class Chef class Version class Platform < Chef::Version diff --git a/lib/chef/version_constraint/platform.rb b/lib/chef/version_constraint/platform.rb index 29f4678bb5..e39da194c6 100644 --- a/lib/chef/version_constraint/platform.rb +++ b/lib/chef/version_constraint/platform.rb @@ -16,6 +16,8 @@ require "chef/version_constraint" require "chef/version/platform" +# NOTE: this is fairly badly broken for its purpose and should not be used +# unless it gets fixed. see chef/version/platform. class Chef class VersionConstraint class Platform < Chef::VersionConstraint diff --git a/spec/integration/recipes/resource_converge_if_changed_spec.rb b/spec/integration/recipes/resource_converge_if_changed_spec.rb index 89d831ddec..f0ba4822a7 100644 --- a/spec/integration/recipes/resource_converge_if_changed_spec.rb +++ b/spec/integration/recipes/resource_converge_if_changed_spec.rb @@ -17,7 +17,7 @@ describe "Resource::ActionClass#converge_if_changed" do before { Namer.current_index += 1 } before { Namer.incrementing_value = 0 } - context "when the resource has identity, state and control properties" do + context "when the resource has identity, state, control, and sensitive properties" do let(:resource_name) { :"converge_if_changed_dsl#{Namer.current_index}" } let(:resource_class) do result = Class.new(Chef::Resource) do @@ -28,6 +28,7 @@ describe "Resource::ActionClass#converge_if_changed" do property :control1, desired_state: false, default: "default_control1" property :state1, default: "default_state1" property :state2, default: "default_state2" + property :sensitive1, default: "default_dontprintme", sensitive: true attr_accessor :converged def initialize(*args) super @@ -54,6 +55,7 @@ describe "Resource::ActionClass#converge_if_changed" do resource_class.load_current_value do state1 "current_state1" state2 "current_state2" + sensitive1 "current_dontprintme" end end @@ -134,6 +136,26 @@ EOM end end + context "and sensitive1 is set to a new value" do + let(:converge_recipe) do + <<-EOM + #{resource_name} 'blah' do + sensitive1 'new_dontprintme' + end + EOM + end + + it "the resource updates sensitive1" do + expect(resource.converged).to eq 1 + expect(resource.updated?).to be_truthy + expect(converged_recipe.stdout).to eq <<-EOM +* #{resource_name}[blah] action create + - update default_identity1 + - set sensitive1 to (suppressed sensitive property) +EOM + end + end + context "and state1 is set to its current value but state2 is set to a new value" do let(:converge_recipe) do <<-EOM @@ -244,19 +266,21 @@ EOM expect(converged_recipe.stdout).to eq <<-EOM * #{resource_name}[blah] action create - create default_identity1 - - set identity1 to "default_identity1" (default value) - - set state1 to "default_state1" (default value) - - set state2 to "default_state2" (default value) + - set identity1 to "default_identity1" (default value) + - set state1 to "default_state1" (default value) + - set state2 to "default_state2" (default value) + - set sensitive1 to (suppressed sensitive property) (default value) EOM end end - context "and state1 and state2 are set" do + context "and state1, state2, and sensitive1 are set" do let(:converge_recipe) do <<-EOM #{resource_name} 'blah' do state1 'new_state1' state2 'new_state2' + sensitive1 'new_dontprintme' end EOM end @@ -267,9 +291,10 @@ EOM expect(converged_recipe.stdout).to eq <<-EOM * #{resource_name}[blah] action create - create default_identity1 - - set identity1 to "default_identity1" (default value) - - set state1 to "new_state1" - - set state2 to "new_state2" + - set identity1 to "default_identity1" (default value) + - set state1 to "new_state1" + - set state2 to "new_state2" + - set sensitive1 to (suppressed sensitive property) EOM end end @@ -291,9 +316,10 @@ EOM expect(converged_recipe.stdout).to eq <<-EOM * #{resource_name}[blah] action create - create default_identity1 - - set identity1 to (suppressed sensitive property) (default value) - - set state1 to (suppressed sensitive property) - - set state2 to (suppressed sensitive property) + - set identity1 to (suppressed sensitive property) (default value) + - set state1 to (suppressed sensitive property) + - set state2 to (suppressed sensitive property) + - set sensitive1 to (suppressed sensitive property) (default value) EOM end end @@ -309,6 +335,9 @@ EOM converge_if_changed :state2 do new_resource.converged += 1 end + converge_if_changed :sensitive1 do + new_resource.converged += 1 + end end end @@ -415,6 +444,26 @@ EOM EOM end end + + context "and sensitive1 is set to a new value" do + let(:converge_recipe) do + <<-EOM + #{resource_name} 'blah' do + sensitive1 'new_dontprintme' + end + EOM + end + + it "the resource updates sensitive1" do + expect(resource.converged).to eq 1 + expect(resource.updated?).to be_truthy + expect(converged_recipe.stdout).to eq <<-EOM +* #{resource_name}[blah] action create + - update default_identity1 + - set sensitive1 to (suppressed sensitive property) +EOM + end + end end context "and no current_resource" do @@ -430,7 +479,7 @@ EOM end it "the resource is created" do - expect(resource.converged).to eq 2 + expect(resource.converged).to eq 3 expect(resource.updated?).to be_truthy expect(converged_recipe.stdout).to eq <<-EOM * #{resource_name}[blah] action create @@ -438,22 +487,25 @@ EOM - set state1 to "default_state1" (default value) - create default_identity1 - set state2 to "default_state2" (default value) + - create default_identity1 + - set sensitive1 to (suppressed sensitive property) (default value) EOM end end - context "and state1 and state2 are set to new values" do + context "and state1, state2, and sensitive1 are set to new values" do let(:converge_recipe) do <<-EOM #{resource_name} 'blah' do state1 'new_state1' state2 'new_state2' + sensitive1 'new_dontprintme' end EOM end it "the resource is created" do - expect(resource.converged).to eq 2 + expect(resource.converged).to eq 3 expect(resource.updated?).to be_truthy expect(converged_recipe.stdout).to eq <<-EOM * #{resource_name}[blah] action create @@ -461,6 +513,8 @@ EOM - set state1 to "new_state1" - create default_identity1 - set state2 to "new_state2" + - create default_identity1 + - set sensitive1 to (suppressed sensitive property) EOM end end @@ -477,7 +531,7 @@ EOM end it "the resource is created" do - expect(resource.converged).to eq 2 + expect(resource.converged).to eq 3 expect(resource.updated?).to be_truthy expect(converged_recipe.stdout).to eq <<-EOM * #{resource_name}[blah] action create @@ -485,6 +539,8 @@ EOM - set state1 to (suppressed sensitive property) - create default_identity1 - set state2 to (suppressed sensitive property) + - create default_identity1 + - set sensitive1 to (suppressed sensitive property) (default value) EOM end end diff --git a/spec/unit/node_map_spec.rb b/spec/unit/node_map_spec.rb index 822f689eab..64106323c2 100644 --- a/spec/unit/node_map_spec.rb +++ b/spec/unit/node_map_spec.rb @@ -101,6 +101,24 @@ describe Chef::NodeMap do end end + describe "platform version checks" do + before do + node_map.set(:thing, :foo, platform_family: "rhel", platform_version: ">= 7") + end + + it "handles non-x.y.z platform versions without throwing an exception" do + allow(node).to receive(:[]).with(:platform_family).and_return("rhel") + allow(node).to receive(:[]).with(:platform_version).and_return("7.19.2.2F") + expect(node_map.get(node, :thing)).to eql(:foo) + end + + it "handles non-x.y.z platform versions without throwing an exception when the match fails" do + allow(node).to receive(:[]).with(:platform_family).and_return("rhel") + allow(node).to receive(:[]).with(:platform_version).and_return("4.19.2.2F") + expect(node_map.get(node, :thing)).to eql(nil) + end + end + describe "with a block doing platform_version checks" do before do node_map.set(:thing, :foo, platform_family: "rhel") do |node| diff --git a/spec/unit/resource/windows_path_spec.rb b/spec/unit/resource/windows_path_spec.rb index aecea8ee6b..e48e9e14ae 100644 --- a/spec/unit/resource/windows_path_spec.rb +++ b/spec/unit/resource/windows_path_spec.rb @@ -28,7 +28,7 @@ describe Chef::Resource::WindowsPath do expect(subject.resource_name).to eql(:windows_path) end - it "sets the path as it's name" do + it "sets the path as its name" do expect(subject.path).to eql("some_path") end |