summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/ISSUE_TEMPLATE.md2
-rw-r--r--.travis.yml6
-rw-r--r--CHANGELOG.md28
-rw-r--r--Dockerfile2
-rw-r--r--Gemfile.lock78
-rw-r--r--MAINTAINERS.md1
-rw-r--r--MAINTAINERS.toml5
-rw-r--r--RELEASE_NOTES.md9
-rw-r--r--VERSION2
-rw-r--r--acceptance/Gemfile5
-rw-r--r--acceptance/Gemfile.lock43
-rw-r--r--appveyor.yml7
-rw-r--r--chef-config/lib/chef-config/version.rb2
-rw-r--r--chef.gemspec3
-rw-r--r--kitchen-tests/Berksfile.lock48
-rw-r--r--kitchen-tests/Gemfile1
-rw-r--r--kitchen-tests/Gemfile.lock73
-rw-r--r--lib/chef/chef_class.rb1
-rw-r--r--lib/chef/deprecated.rb20
-rw-r--r--lib/chef/exceptions.rb3
-rw-r--r--lib/chef/knife/ssh.rb61
-rw-r--r--lib/chef/property.rb31
-rw-r--r--lib/chef/provider/directory.rb2
-rw-r--r--lib/chef/provider/dsc_resource.rb18
-rw-r--r--lib/chef/provider/file.rb2
-rw-r--r--lib/chef/provider/launchd.rb2
-rw-r--r--lib/chef/resource/apt_repository.rb1
-rw-r--r--lib/chef/resource/dsc_resource.rb8
-rw-r--r--lib/chef/resource/launchd.rb14
-rw-r--r--lib/chef/resource/yum_repository.rb1
-rw-r--r--lib/chef/version.rb2
-rw-r--r--lib/chef/win32/security.rb4
-rw-r--r--omnibus/Gemfile.lock70
-rw-r--r--omnibus/config/projects/chef.rb5
-rw-r--r--omnibus/config/software/chef-gem-bcrypt_pbkdf-ruby.rb10
-rw-r--r--omnibus/config/software/chef-gem-rbnacl-libsodium.rb10
-rw-r--r--omnibus/config/software/chef.rb4
-rw-r--r--omnibus/omnibus.rb1
-rw-r--r--omnibus_overrides.rb3
-rw-r--r--spec/functional/knife/ssh_spec.rb10
-rw-r--r--spec/support/shared/unit/provider/file.rb10
-rw-r--r--spec/unit/knife/ssh_spec.rb68
-rw-r--r--spec/unit/provider/directory_spec.rb10
-rw-r--r--spec/unit/provider/dsc_resource_spec.rb175
-rw-r--r--spec/unit/provider/launchd_spec.rb4
-rw-r--r--spec/unit/resource/dsc_resource_spec.rb6
-rw-r--r--spec/unit/win32/error_spec.rb67
-rw-r--r--spec/unit/win32/security_spec.rb66
-rw-r--r--version_policy.rb1
49 files changed, 728 insertions, 277 deletions
diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md
index 562e43e797..dad3fc315f 100644
--- a/.github/ISSUE_TEMPLATE.md
+++ b/.github/ISSUE_TEMPLATE.md
@@ -30,6 +30,6 @@ Please include the stacktrace.out output or link to a gist of it, if there is on
This issue tracker is for the code contained within this repo -- `chef-client`, base `knife` functionality (not
plugins), `chef-apply`, `chef-solo`, `chef-client -z`, etc.
-* [Server issues](https://github.com/chef/chef-server/issues/new)
+* [Chef Server issues](https://github.com/chef/chef-server/issues/new)
* [ChefDK issues](https://github.com/chef/chef-dk/issues/new)
* Cookbook Issues (see the https://github.com/chef-cookbooks repos or search [Supermarket](https://supermarket.chef.io) or GitHub/Google)
diff --git a/.travis.yml b/.travis.yml
index 5460516710..ed7fffc22b 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -5,7 +5,11 @@ cache: bundler
# Early warning system to catch if Rubygems breaks something
before_install:
- gem update --system $(grep rubygems omnibus_overrides.rb | cut -d'"' -f2)
+ - gem --version
+ - gem uninstall bundler -a -x
+ - rvm @global do gem uninstall bundler -a -x
- gem install bundler -v $(grep bundler omnibus_overrides.rb | cut -d'"' -f2)
+ - bundle --version
- rm -f .bundle/config
bundler_args: --without changelog development docgen guard maintenance omnibus_package tools aix bsd mac_os_x solaris windows --frozen
@@ -81,6 +85,8 @@ matrix:
# The chefspec tests + bundler cache + "gem update --system" interact badly :/
# (Cucumber doesn't start.)
before_install:
+ - gem uninstall bundler -a -x
+ - rvm @global do gem uninstall bundler -a -x
- gem install bundler -v $(grep bundler omnibus_overrides.rb | cut -d'"' -f2)
- bundle config --local without server:docgen:maintenance:omnibus_package:development:ruby_prof:pry
script: tasks/bin/run_external_test $TEST_GEM rake
diff --git a/CHANGELOG.md b/CHANGELOG.md
index ba549822fb..9ee97ad885 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,30 +1,20 @@
This changelog reflects the current state of chef's master branch on github and may not reflect the current released version of chef, which is [![Gem Version](https://badge.fury.io/rb/chef.svg)](https://badge.fury.io/rb/chef).
-## [v12.18.37](https://github.com/chef/chef/tree/v12.18.37) (2017-01-17)
-[Full Changelog](https://github.com/chef/chef/compare/v12.17.44...v12.18.37)
+## [v12.18.50](https://github.com/chef/chef/tree/v12.18.50) (2017-01-24)
+[Full Changelog](https://github.com/chef/chef/compare/v12.18.31...v12.18.50)
**Implemented enhancements:**
-- yum\_repository: Allow baseurl to be an array & allow fastestmirror\_enabled false [\#5708](https://github.com/chef/chef/pull/5708) ([tas50](https://github.com/tas50))
-- Adding returns property to chocolatey\_package resource [\#5688](https://github.com/chef/chef/pull/5688) ([Vasu1105](https://github.com/Vasu1105))
-- Code cleanup in the user provider [\#5674](https://github.com/chef/chef/pull/5674) ([lamont-granquist](https://github.com/lamont-granquist))
-- Code cleanup in the group provider [\#5673](https://github.com/chef/chef/pull/5673) ([lamont-granquist](https://github.com/lamont-granquist))
-- Core: Formally deprecate run\_command [\#5666](https://github.com/chef/chef/pull/5666) ([lamont-granquist](https://github.com/lamont-granquist))
-- Set MSI Scheduled Task name to match chef-client cookbook managed name [\#5657](https://github.com/chef/chef/pull/5657) ([mwrock](https://github.com/mwrock))
-- remove Chef::Platform::HandlerMap [\#5636](https://github.com/chef/chef/pull/5636) ([lamont-granquist](https://github.com/lamont-granquist))
-- Core: Properly deprecate old Chef::Platform methods [\#5631](https://github.com/chef/chef/pull/5631) ([lamont-granquist](https://github.com/lamont-granquist))
+- Raise NamedSecurityInfo related exception using HR result. [\#5727](https://github.com/chef/chef/pull/5727) ([Aliasgar16](https://github.com/Aliasgar16))
+- Added module\_version attribute for dsc\_resource for SxS support [\#5701](https://github.com/chef/chef/pull/5701) ([Aliasgar16](https://github.com/Aliasgar16))
+- Bump net-ssh to v4, add dependencies for ed25519 support [\#5687](https://github.com/chef/chef/pull/5687) ([onlyhavecans](https://github.com/onlyhavecans))
+- Initial habitat plan for chef-client [\#5677](https://github.com/chef/chef/pull/5677) ([adamhjk](https://github.com/adamhjk))
**Fixed bugs:**
-- Fix error thrown by solo when run on Windows as SYSTEM [\#5693](https://github.com/chef/chef/pull/5693) ([scottopherson](https://github.com/scottopherson))
-- Report a blank resource if sensitive is enabled [\#5668](https://github.com/chef/chef/pull/5668) ([afiune](https://github.com/afiune))
-- Ensure node.docker? returns boolean [\#5645](https://github.com/chef/chef/pull/5645) ([andrewjamesbrown](https://github.com/andrewjamesbrown))
-- Fix Data Collector organization parsing regex [\#5630](https://github.com/chef/chef/pull/5630) ([adamleff](https://github.com/adamleff))
-- Core: Use object ID when detected unprocessed Resources [\#5604](https://github.com/chef/chef/pull/5604) ([adamleff](https://github.com/adamleff))
-
-**Merged pull requests:**
-
-- Core: fix node attribute "unless" API methods [\#5717](https://github.com/chef/chef/pull/5717) ([lamont-granquist](https://github.com/lamont-granquist))
+- Ensure ssh search paginates correctly [\#5744](https://github.com/chef/chef/pull/5744) ([thommay](https://github.com/thommay))
+- Do not modify File's new\_resource during why-run [\#5742](https://github.com/chef/chef/pull/5742) ([scottopherson](https://github.com/scottopherson))
+- Add gems for ECC algorithm support to omnibus. [\#5736](https://github.com/chef/chef/pull/5736) ([rhass](https://github.com/rhass))
## [v12.17.44](https://github.com/chef/chef/tree/v12.17.44) (2016-12-07)
[Full Changelog](https://github.com/chef/chef/compare/v12.16.42...v12.17.44)
diff --git a/Dockerfile b/Dockerfile
index e3dea91a71..ea79037581 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -2,7 +2,7 @@ FROM busybox
MAINTAINER Chef Software, Inc. <docker@chef.io>
ARG CHANNEL=stable
-ARG VERSION=12.17.44
+ARG VERSION=12.18.31
RUN wget "http://packages.chef.io/files/${CHANNEL}/chef/${VERSION}/el/5/chef-${VERSION}-1.el5.x86_64.rpm" -O /tmp/chef-client.rpm && \
rpm2cpio /tmp/chef-client.rpm | cpio -idmv && \
diff --git a/Gemfile.lock b/Gemfile.lock
index cd47dfbba7..e699704793 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -1,6 +1,6 @@
GIT
remote: https://github.com/chef/chef-server
- revision: 2d06ce7ef5976e2a410906f60152142bf90a17fb
+ revision: 6309e94fe200090acbde23e5ab70bdcbf8f31410
specs:
oc-chef-pedant (2.2.0)
activesupport (>= 4.2.7.1, < 6.0)
@@ -47,11 +47,10 @@ GIT
PATH
remote: .
specs:
- chef (12.18.37)
+ chef (12.18.50)
addressable
- bcrypt_pbkdf (~> 1.0.0)
bundler (>= 1.10)
- chef-config (= 12.18.37)
+ chef-config (= 12.18.50)
chef-zero (>= 4.8)
diff-lcs (~> 1.2, >= 1.2.4)
erubis (~> 2.7)
@@ -69,8 +68,6 @@ PATH
ohai (>= 8.6.0.alpha.1, < 9)
plist (~> 3.2)
proxifier (~> 1.0)
- rbnacl (~> 4.0.0)
- rbnacl-libsodium (~> 1.0.0)
rspec-core (~> 3.5)
rspec-expectations (~> 3.5)
rspec-mocks (~> 3.5)
@@ -79,11 +76,10 @@ PATH
specinfra (~> 2.10)
syslog-logger (~> 1.6)
uuidtools (~> 2.1.5)
- chef (12.18.37-universal-mingw32)
+ chef (12.18.50-universal-mingw32)
addressable
- bcrypt_pbkdf (~> 1.0.0)
bundler (>= 1.10)
- chef-config (= 12.18.37)
+ chef-config (= 12.18.50)
chef-zero (>= 4.8)
diff-lcs (~> 1.2, >= 1.2.4)
erubis (~> 2.7)
@@ -102,8 +98,6 @@ PATH
ohai (>= 8.6.0.alpha.1, < 9)
plist (~> 3.2)
proxifier (~> 1.0)
- rbnacl (~> 4.0.0)
- rbnacl-libsodium (~> 1.0.0)
rspec-core (~> 3.5)
rspec-expectations (~> 3.5)
rspec-mocks (~> 3.5)
@@ -126,7 +120,7 @@ PATH
PATH
remote: chef-config
specs:
- chef-config (12.18.37)
+ chef-config (12.18.50)
addressable
fuzzyurl
mixlib-config (~> 2.0)
@@ -145,20 +139,18 @@ GEM
mixlib-cli (~> 1.4)
artifactory (2.5.1)
ast (2.3.0)
- aws-sdk (2.6.44)
- aws-sdk-resources (= 2.6.44)
- aws-sdk-core (2.6.44)
+ aws-sdk (2.7.0)
+ aws-sdk-resources (= 2.7.0)
+ aws-sdk-core (2.7.0)
aws-sigv4 (~> 1.0)
jmespath (~> 1.0)
- aws-sdk-resources (2.6.44)
- aws-sdk-core (= 2.6.44)
+ aws-sdk-resources (2.7.0)
+ aws-sdk-core (= 2.7.0)
aws-sigv4 (1.0.0)
backports (3.6.8)
- bcrypt_pbkdf (1.0.0)
- bcrypt_pbkdf (1.0.0-x86-mingw32)
binding_of_caller (0.7.2)
debug_inspector (>= 0.0.1)
- builder (3.2.2)
+ builder (3.2.3)
byebug (9.0.6)
chef-api (0.7.0)
logify (~> 0.1)
@@ -172,13 +164,13 @@ GEM
net-ssh-gateway (~> 1.2)
winrm-fs (~> 1.0)
chef-sugar (3.4.0)
- chef-zero (5.1.1)
+ chef-zero (5.2.0)
ffi-yajl (~> 2.2)
hashie (>= 2.0, < 4.0)
mixlib-log (~> 1.3)
rack (~> 2.0)
uuidtools (~> 2.1)
- cheffish (4.0.0)
+ cheffish (4.1.0)
chef-zero (~> 5.0)
net-ssh
chefspec (5.3.0)
@@ -205,7 +197,7 @@ GEM
gherkin (~> 4.0)
cucumber-wire (0.0.1)
debug_inspector (0.0.2)
- diff-lcs (1.2.5)
+ diff-lcs (1.3)
docile (1.1.5)
domain_name (0.5.20161129)
unf (>= 0.0.5, < 1.0.0)
@@ -213,16 +205,16 @@ GEM
ethon (0.10.1)
ffi (>= 1.3.0)
excon (0.54.0)
- faraday (0.10.1)
+ faraday (0.11.0)
multipart-post (>= 1.2, < 3)
faraday-http-cache (2.0.0)
faraday (~> 0.8)
- faraday_middleware (0.10.1)
+ faraday_middleware (0.11.0.1)
faraday (>= 0.7.4, < 1.0)
fauxhai (3.10.0)
net-ssh
- ffi (1.9.14)
- ffi (1.9.14-x86-mingw32)
+ ffi (1.9.17)
+ ffi (1.9.17-x86-mingw32)
ffi-win32-extensions (1.0.3)
ffi
ffi-yajl (2.3.0)
@@ -276,10 +268,10 @@ GEM
multi_json
retryable (~> 2.0)
test-kitchen (~> 1.4, >= 1.4.1)
- kitchen-sync (2.1.1)
+ kitchen-sync (2.1.2)
net-sftp
test-kitchen (>= 1.0.0)
- kitchen-vagrant (0.21.1)
+ kitchen-vagrant (1.0.0)
test-kitchen (~> 1.4)
knife-windows (1.8.0)
winrm (~> 2.1)
@@ -298,13 +290,13 @@ GEM
mime-types-data (3.2016.0521)
mini_portile2 (2.1.0)
minitest (5.10.1)
- mixlib-archive (0.2.0)
+ mixlib-archive (0.3.0)
mixlib-log
mixlib-authentication (1.4.1)
mixlib-log
mixlib-cli (1.7.0)
mixlib-config (2.2.4)
- mixlib-install (2.1.9)
+ mixlib-install (2.1.10)
artifactory
mixlib-shellout
mixlib-versioning
@@ -325,7 +317,7 @@ GEM
net-ssh (>= 2.6.5)
net-sftp (2.1.2)
net-ssh (>= 2.6.5)
- net-ssh (3.2.0)
+ net-ssh (4.0.1)
net-ssh-gateway (1.2.0)
net-ssh (>= 2.6.5)
net-ssh-multi (1.2.1)
@@ -410,10 +402,6 @@ GEM
rainbow (2.2.1)
rake (11.3.0)
rb-readline (0.5.3)
- rbnacl (4.0.1)
- ffi
- rbnacl-libsodium (1.0.11)
- rbnacl (>= 3.0.1)
rest-client (2.0.0)
http-cookie (>= 1.0.2, < 2.0)
mime-types (>= 1.16, < 4.0)
@@ -462,7 +450,7 @@ GEM
sawyer (0.8.1)
addressable (>= 2.3.5, < 2.6)
faraday (~> 0.8, < 1.0)
- serverspec (2.37.2)
+ serverspec (2.38.0)
multi_json
rspec (~> 3.0)
rspec-its
@@ -474,9 +462,9 @@ GEM
simplecov-html (~> 0.10.0)
simplecov-html (0.10.0)
slop (3.6.0)
- specinfra (2.66.3)
+ specinfra (2.66.5)
net-scp
- net-ssh (>= 2.7, < 4.0)
+ net-ssh (>= 2.7, < 5.0)
net-telnet
sfl
stove (4.1.1)
@@ -484,12 +472,12 @@ GEM
logify (~> 0.2)
syslog-logger (1.6.8)
systemu (2.6.5)
- test-kitchen (1.14.2)
+ test-kitchen (1.15.0)
mixlib-install (>= 1.2, < 3.0)
mixlib-shellout (>= 1.2, < 3.0)
net-scp (~> 1.1)
- net-ssh (>= 2.9, < 4.0)
- net-ssh-gateway (~> 1.2.0)
+ net-ssh (>= 2.9, < 5.0)
+ net-ssh-gateway (~> 1.2)
safe_yaml (~> 1.0)
thor (~> 0.18)
thor (0.19.4)
@@ -514,7 +502,7 @@ GEM
unf_ext
unf_ext (0.0.7.2)
unf_ext (0.0.7.2-x86-mingw32)
- unicode-display_width (1.1.2)
+ unicode-display_width (1.1.3)
url (0.3.2)
uuidtools (2.1.5)
vagrant-wrapper (2.0.3)
@@ -539,7 +527,7 @@ GEM
ffi-win32-extensions
windows-api (0.4.4)
win32-api (>= 1.4.5)
- winrm (2.1.1)
+ winrm (2.1.2)
builder (>= 2.1.2)
erubis (~> 2.7)
gssapi (~> 1.2)
@@ -558,7 +546,7 @@ GEM
winrm (~> 2.0)
wmi-lite (1.0.0)
yajl-ruby (1.3.0)
- yard (0.9.7)
+ yard (0.9.8)
yard-classmethods (1.0.0)
yard
diff --git a/MAINTAINERS.md b/MAINTAINERS.md
index 87f92de274..0034f46adc 100644
--- a/MAINTAINERS.md
+++ b/MAINTAINERS.md
@@ -44,6 +44,7 @@ To mention the team, use @chef/client-core
* [Steven Murawski](https://github.com/smurawski)
* [Steven Danna](https://github.com/stevendanna)
* [Tim Smith](https://github.com/tas50)
+* [Tom Duffield](https://github.com/tduffield)
* [Tyler Ball](https://github.com/tyler-ball)
## Chef Provisioning
diff --git a/MAINTAINERS.toml b/MAINTAINERS.toml
index 1f577b4a24..a46953aac1 100644
--- a/MAINTAINERS.toml
+++ b/MAINTAINERS.toml
@@ -50,6 +50,7 @@ Maintainers for the Chef client, Ohai, mixlibs, ChefDK, ChefSpec, Foodcritic, ch
"smurawski",
"stevendanna",
"tas50",
+ "tduffield",
"tyler-ball"
]
@@ -378,3 +379,7 @@ The specific components of Chef related to a given platform - including (but not
[people.thehar]
Name = "Harley Alaniz"
GitHub = "thehar"
+
+ [people.tduffield]
+ Name = "Tom Duffield"
+ GitHub = "tduffield"
diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md
index e3c12dc72f..d9c33dc769 100644
--- a/RELEASE_NOTES.md
+++ b/RELEASE_NOTES.md
@@ -6,16 +6,13 @@ _This file holds "in progress" release notes for the current release under devel
- You can now specify the acceptable return codes from the chocolatey_package resource using the returns property.
- You can now enable chef-client to run as a scheduled task directly from the client MSI on Windows hosts.
+- The package provider now supports DNF packages for Fedora and upcoming RHEL releases
## Highlighted bug fixes for this release:
-- Fixed exposure of sensitive data of resources marked as sensitive inside Reporting. Before you
- were able to see the sensitive data on the Run History tab in the Chef Manage Console. Now we
- are sending a new blank resource if the resource is marked as sensitive, this way we will not
- compromise any sensitive data.
+- Fixed exposure of sensitive data of resources marked as sensitive inside Reporting. Before you were able to see the sensitive data on the Run History tab in the Chef Manage Console. Now we are sending a new blank resource if the resource is marked as sensitive, this way we will not compromise any sensitive data.
- _Note: Old data that was already sent to Reporting marked as sensitive will continue to be
- displayed. Apologies._
+ _Note: Old data that was already sent to Reporting marked as sensitive will continue to be displayed. Apologies._
## New deprecations introduced in this release:
diff --git a/VERSION b/VERSION
index f11f797420..6edd5932b7 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-12.18.37 \ No newline at end of file
+12.18.50 \ No newline at end of file
diff --git a/acceptance/Gemfile b/acceptance/Gemfile
index 59f232fcd3..77b45e733d 100644
--- a/acceptance/Gemfile
+++ b/acceptance/Gemfile
@@ -14,3 +14,8 @@ gem "berkshelf", "4.3.5"
# until 2.0.0 is fixed for unstable packages
gem "mixlib-install", "1.2.3"
+
+# nio4r 2.x was throwing a "could not install" error because of a Ruby version
+# conflict (that didn't actually exist). Since the only gem that really needs
+# it is celluloid, let's just pin it until it becomes a bigger problem.
+gem "nio4r", ">= 1.1.0", "< 2.0.0"
diff --git a/acceptance/Gemfile.lock b/acceptance/Gemfile.lock
index 7fa47ed3dd..b52a1c7a29 100644
--- a/acceptance/Gemfile.lock
+++ b/acceptance/Gemfile.lock
@@ -12,13 +12,13 @@ GEM
addressable (2.5.0)
public_suffix (~> 2.0, >= 2.0.2)
artifactory (2.5.1)
- aws-sdk (2.6.44)
- aws-sdk-resources (= 2.6.44)
- aws-sdk-core (2.6.44)
+ aws-sdk (2.7.0)
+ aws-sdk-resources (= 2.7.0)
+ aws-sdk-core (2.7.0)
aws-sigv4 (~> 1.0)
jmespath (~> 1.0)
- aws-sdk-resources (2.6.44)
- aws-sdk-core (= 2.6.44)
+ aws-sdk-resources (2.7.0)
+ aws-sdk-core (= 2.7.0)
aws-sigv4 (1.0.0)
berkshelf (4.3.5)
addressable (~> 2.3, >= 2.3.4)
@@ -50,20 +50,20 @@ GEM
buff-ruby_engine (0.1.0)
buff-shell_out (0.2.0)
buff-ruby_engine (~> 0.1.0)
- builder (3.2.2)
+ builder (3.2.3)
celluloid (0.16.0)
timers (~> 4.0.0)
celluloid-io (0.16.2)
celluloid (>= 0.16.0)
nio4r (>= 1.1.0)
- chef-config (12.17.44)
+ chef-config (12.18.31)
addressable
fuzzyurl
mixlib-config (~> 2.0)
mixlib-shellout (~> 2.0)
cleanroom (1.0.0)
coderay (1.1.1)
- diff-lcs (1.2.5)
+ diff-lcs (1.3)
docker-api (1.33.1)
excon (>= 0.38.0)
json
@@ -71,7 +71,7 @@ GEM
excon (0.54.0)
faraday (0.9.2)
multipart-post (>= 1.2, < 3)
- ffi (1.9.14)
+ ffi (1.9.17)
fuzzyurl (0.9.0)
gssapi (1.2.0)
ffi (>= 1.0.1)
@@ -80,7 +80,7 @@ GEM
hashie (3.4.6)
hitimes (1.2.4)
httpclient (2.7.2)
- inspec (1.8.0)
+ inspec (1.9.0)
hashie (~> 3.4)
json (>= 1.8, < 3.0)
method_source (~> 0.8)
@@ -96,7 +96,7 @@ GEM
thor (~> 0.19)
train (>= 0.22.0, < 1.0)
jmespath (1.3.1)
- json (2.0.2)
+ json (2.0.3)
kitchen-ec2 (1.2.0)
aws-sdk (~> 2)
excon
@@ -107,7 +107,7 @@ GEM
hashie (~> 3.4)
inspec (>= 0.34.0, < 2.0.0)
test-kitchen (~> 1.6)
- kitchen-vagrant (0.21.1)
+ kitchen-vagrant (1.0.0)
test-kitchen (~> 1.4)
little-plugger (1.1.4)
logging (2.1.0)
@@ -115,7 +115,7 @@ GEM
multi_json (~> 1.10)
method_source (0.8.2)
minitar (0.5.4)
- mixlib-archive (0.2.0)
+ mixlib-archive (0.3.0)
mixlib-log
mixlib-authentication (1.4.1)
mixlib-log
@@ -132,7 +132,7 @@ GEM
multipart-post (2.0.0)
net-scp (1.2.1)
net-ssh (>= 2.6.5)
- net-ssh (3.2.0)
+ net-ssh (4.0.1)
net-ssh-gateway (1.2.0)
net-ssh (>= 2.6.5)
nio4r (1.2.1)
@@ -196,23 +196,23 @@ GEM
molinillo (~> 0.4.2)
semverse (~> 1.1)
sslshake (1.0.13)
- test-kitchen (1.14.2)
+ test-kitchen (1.15.0)
mixlib-install (>= 1.2, < 3.0)
mixlib-shellout (>= 1.2, < 3.0)
net-scp (~> 1.1)
- net-ssh (>= 2.9, < 4.0)
- net-ssh-gateway (~> 1.2.0)
+ net-ssh (>= 2.9, < 5.0)
+ net-ssh-gateway (~> 1.2)
safe_yaml (~> 1.0)
thor (~> 0.18)
thor (0.19.4)
timers (4.0.4)
hitimes
- train (0.22.0)
+ train (0.22.1)
docker-api (~> 1.26)
json (>= 1.8, < 3.0)
mixlib-shellout (~> 2.0)
net-scp (~> 1.2)
- net-ssh (>= 2.9, < 4.0)
+ net-ssh (>= 2.9, < 5.0)
winrm (~> 2.0)
winrm-fs (~> 1.0)
varia_model (0.4.1)
@@ -220,7 +220,7 @@ GEM
hashie (>= 2.0.2, < 4.0.0)
windows_chef_zero (2.0.0)
test-kitchen (>= 1.2.1)
- winrm (2.1.1)
+ winrm (2.1.2)
builder (>= 2.1.2)
erubis (~> 2.7)
gssapi (~> 1.2)
@@ -249,9 +249,10 @@ DEPENDENCIES
kitchen-inspec
kitchen-vagrant
mixlib-install (= 1.2.3)
+ nio4r (>= 1.1.0, < 2.0.0)
test-kitchen
windows_chef_zero
winrm-elevated
BUNDLED WITH
- 1.13.6
+ 1.12.5
diff --git a/appveyor.yml b/appveyor.yml
index 08756d98ad..e3bf174e01 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -20,11 +20,12 @@ install:
- systeminfo
- winrm quickconfig -q
- SET PATH=C:\Ruby%ruby_version%\bin;%PATH%
+ - ps: $env:RUBYGEMS_VERSION=$(findstr rubygems omnibus_overrides.rb | %{ $_.split(" ")[3] })
+ - ps: $env:BUNDLER_VERSION=$(findstr bundler omnibus_overrides.rb | %{ $_.split(" ")[3] })
- echo %PATH%
- ruby --version
- - gem update --system || gem update --system || gem update --system
- - gem install bundler --quiet --no-ri --no-rdoc || gem install bundler --quiet --no-ri --no-rdoc || gem install bundler --quiet --no-ri --no-rdoc
- - update_rubygems
+ - gem update --system %RUBYGEMS_VERSION% || gem update --system %RUBYGEMS_VERSION% || gem update --system %RUBYGEMS_VERSION%
+ - gem install bundler -v %BUNDLER_VERSION% --quiet --no-ri --no-rdoc || gem install bundler -v %BUNDLER_VERSION% --quiet --no-ri --no-rdoc || gem install bundler -v %BUNDLER_VERSION% --quiet --no-ri --no-rdoc
- gem --version
- bundler --version
- SET BUNDLE_IGNORE_CONFIG=true
diff --git a/chef-config/lib/chef-config/version.rb b/chef-config/lib/chef-config/version.rb
index 092b1881eb..0561267e02 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.18.37"
+ VERSION = "12.18.50"
end
#
diff --git a/chef.gemspec b/chef.gemspec
index e7f0cd122b..2d5544aa4f 100644
--- a/chef.gemspec
+++ b/chef.gemspec
@@ -26,9 +26,6 @@ Gem::Specification.new do |s|
s.add_dependency "ffi-yajl", "~> 2.2"
s.add_dependency "net-ssh", ">= 2.9", "< 5.0"
- s.add_dependency "rbnacl-libsodium", "~> 1.0.0"
- s.add_dependency "rbnacl", "~> 4.0.0"
- s.add_dependency "bcrypt_pbkdf", "~> 1.0.0"
s.add_dependency "net-ssh-multi", "~> 1.1"
s.add_dependency "net-sftp", "~> 2.1", ">= 2.1.2"
s.add_dependency "highline", "~> 1.6", ">= 1.6.9"
diff --git a/kitchen-tests/Berksfile.lock b/kitchen-tests/Berksfile.lock
index bf6b9f2c95..6d8f40436a 100644
--- a/kitchen-tests/Berksfile.lock
+++ b/kitchen-tests/Berksfile.lock
@@ -1,12 +1,12 @@
DEPENDENCIES
awesome_customers_rhel
git: https://github.com/learn-chef/awesome_customers_rhel.git
- revision: 1ac86593829610c0eab7a45d9c63c09a9cea1754
+ revision: b576fcf2988e2cdf156e7ba6ff59a94d556e16f1
awesome_customers_rhel_wrapper
path: cookbooks/awesome_customers_rhel_wrapper
awesome_customers_ubuntu
git: https://github.com/learn-chef/awesome_customers_ubuntu.git
- revision: 71927c094d570e6fd0f8bfbcc02ebe3556af2a16
+ revision: fea174c5855266f28218f76f00f6eff69e850244
awesome_customers_ubuntu_wrapper
path: cookbooks/awesome_customers_ubuntu_wrapper
base
@@ -52,18 +52,18 @@ GRAPH
sudo (>= 0.0.0)
ubuntu (>= 0.0.0)
users (>= 0.0.0)
- build-essential (7.0.2)
- compat_resource (>= 12.14)
+ build-essential (7.0.3)
+ compat_resource (>= 12.16.3)
mingw (>= 1.1)
seven_zip (>= 0.0.0)
- chef-client (7.0.1)
+ chef-client (7.1.0)
cron (>= 1.7.0)
logrotate (>= 1.9.0)
windows (>= 1.42.0)
chef-sugar (3.4.0)
chef_hostname (0.4.2)
compat_resource (>= 0.0.0)
- compat_resource (12.16.2)
+ compat_resource (12.16.3)
cron (3.0.0)
database (6.1.1)
postgresql (>= 1.0.0)
@@ -73,18 +73,18 @@ GRAPH
compat_resource (>= 12.14.6)
iis (5.0.5)
windows (>= 1.34.6)
- iptables (3.0.1)
+ iptables (3.1.0)
compat_resource (>= 12.14.3)
logrotate (2.1.0)
compat_resource (>= 0.0.0)
- mariadb (0.3.3)
+ mariadb (1.0.1)
apt (>= 0.0.0)
yum (>= 0.0.0)
yum-epel (>= 0.0.0)
- mingw (1.2.4)
- compat_resource (>= 0.0.0)
+ mingw (1.2.5)
+ compat_resource (>= 12.16.3)
seven_zip (>= 0.0.0)
- multipackage (3.0.28)
+ multipackage (4.0.0)
compat_resource (>= 0.0.0)
mysql (7.2.0)
smf (>= 0.0.0)
@@ -95,12 +95,12 @@ GRAPH
mysql (>= 6.0)
nscd (4.1.0)
compat_resource (>= 0.0.0)
- ntp (3.2.0)
- ohai (4.2.2)
- compat_resource (>= 12.14)
- openssh (2.1.0)
+ ntp (3.3.1)
+ ohai (4.2.3)
+ compat_resource (>= 12.14.7)
+ openssh (2.1.1)
iptables (>= 1.0)
- openssl (6.0.0)
+ openssl (6.1.1)
php (1.5.0)
build-essential (>= 0.0.0)
iis (>= 0.0.0)
@@ -108,9 +108,9 @@ GRAPH
windows (>= 0.0.0)
xml (>= 0.0.0)
yum-epel (>= 0.0.0)
- postgresql (5.1.0)
- apt (>= 1.9.0)
+ postgresql (6.0.1)
build-essential (>= 2.0.0)
+ compat_resource (>= 12.16.3)
openssl (>= 4.0)
rbac (1.0.3)
resolver (1.3.1)
@@ -119,16 +119,16 @@ GRAPH
windows (>= 1.2.2)
smf (2.2.8)
rbac (>= 1.0.1)
- sudo (3.1.0)
+ sudo (3.3.1)
ubuntu (2.0.0)
apt (>= 0.0.0)
users (4.0.3)
windows (2.1.1)
ohai (>= 4.0.0)
- xml (3.0.0)
+ xml (3.1.1)
build-essential (>= 0.0.0)
yum (4.1.0)
- yum-epel (2.0.0)
- compat_resource (>= 12.14.6)
- yum-mysql-community (2.0.2)
- compat_resource (>= 12.14.7)
+ yum-epel (2.1.1)
+ compat_resource (>= 12.16.3)
+ yum-mysql-community (2.0.3)
+ compat_resource (>= 12.16.3)
diff --git a/kitchen-tests/Gemfile b/kitchen-tests/Gemfile
index ad89269a75..4b6b595d1f 100644
--- a/kitchen-tests/Gemfile
+++ b/kitchen-tests/Gemfile
@@ -9,3 +9,4 @@ gem "kitchen-vagrant"
gem "ridley"
gem "test-kitchen"
gem "vagrant-wrapper"
+gem "rainbow", ">= 2.1.0", "< 2.2"
diff --git a/kitchen-tests/Gemfile.lock b/kitchen-tests/Gemfile.lock
index 957b478396..ec235ebcb8 100644
--- a/kitchen-tests/Gemfile.lock
+++ b/kitchen-tests/Gemfile.lock
@@ -4,15 +4,15 @@ GEM
addressable (2.5.0)
public_suffix (~> 2.0, >= 2.0.2)
artifactory (2.5.1)
- aws-sdk (2.6.32)
- aws-sdk-resources (= 2.6.32)
- aws-sdk-core (2.6.32)
+ aws-sdk (2.7.0)
+ aws-sdk-resources (= 2.7.0)
+ aws-sdk-core (2.7.0)
aws-sigv4 (~> 1.0)
jmespath (~> 1.0)
- aws-sdk-resources (2.6.32)
- aws-sdk-core (= 2.6.32)
+ aws-sdk-resources (2.7.0)
+ aws-sdk-core (= 2.7.0)
aws-sigv4 (1.0.0)
- berkshelf (5.2.0)
+ berkshelf (5.4.0)
addressable (~> 2.3, >= 2.3.4)
berkshelf-api-client (>= 2.0.2, < 4.0)
buff-config (~> 2.0)
@@ -27,7 +27,7 @@ GEM
retryable (~> 2.0)
ridley (~> 5.0)
solve (> 2.0, < 4.0)
- thor (~> 0.19)
+ thor (~> 0.19, < 0.19.2)
berkshelf-api-client (3.0.0)
faraday (~> 0.9)
httpclient (~> 2.7)
@@ -40,29 +40,29 @@ GEM
buff-ruby_engine (1.0.0)
buff-shell_out (1.1.0)
buff-ruby_engine (~> 1.0)
- builder (3.2.2)
+ builder (3.2.3)
celluloid (0.16.0)
timers (~> 4.0.0)
celluloid-io (0.16.2)
celluloid (>= 0.16.0)
nio4r (>= 1.1.0)
- chef-config (12.16.42)
+ chef-config (12.18.31)
addressable
fuzzyurl
mixlib-config (~> 2.0)
mixlib-shellout (~> 2.0)
cleanroom (1.0.0)
coderay (1.1.1)
- diff-lcs (1.2.5)
- docker-api (1.33.0)
+ diff-lcs (1.3)
+ docker-api (1.33.1)
excon (>= 0.38.0)
json
erubis (2.7.0)
excon (0.54.0)
faraday (0.9.2)
multipart-post (>= 1.2, < 3)
- ffi (1.9.14)
- ffi (1.9.14-x86-mingw32)
+ ffi (1.9.17)
+ ffi (1.9.17-x86-mingw32)
fuzzyurl (0.9.0)
gssapi (1.2.0)
ffi (>= 1.0.1)
@@ -71,8 +71,8 @@ GEM
hashie (3.4.6)
hitimes (1.2.4)
hitimes (1.2.4-x86-mingw32)
- httpclient (2.8.2.4)
- inspec (1.7.0)
+ httpclient (2.8.3)
+ inspec (1.9.0)
hashie (~> 3.4)
json (>= 1.8, < 3.0)
method_source (~> 0.8)
@@ -86,12 +86,12 @@ GEM
rubyzip (~> 1.1)
sslshake (~> 1)
thor (~> 0.19)
- train (>= 0.20.1, < 1.0)
+ train (>= 0.22.0, < 1.0)
jmespath (1.3.1)
- json (2.0.2)
+ json (2.0.3)
kitchen-appbundle-updater (0.1.2)
- kitchen-dokken (1.0.7)
- docker-api (~> 1.32)
+ kitchen-dokken (1.1.0)
+ docker-api (~> 1.33)
test-kitchen (~> 1.13)
kitchen-ec2 (1.2.0)
aws-sdk (~> 2)
@@ -99,11 +99,11 @@ GEM
multi_json
retryable (~> 2.0)
test-kitchen (~> 1.4, >= 1.4.1)
- kitchen-inspec (0.16.1)
+ kitchen-inspec (0.17.0)
hashie (~> 3.4)
inspec (>= 0.34.0, < 2.0.0)
test-kitchen (~> 1.6)
- kitchen-vagrant (0.21.0)
+ kitchen-vagrant (1.0.0)
test-kitchen (~> 1.4)
little-plugger (1.1.4)
logging (2.1.0)
@@ -111,12 +111,12 @@ GEM
multi_json (~> 1.10)
method_source (0.8.2)
minitar (0.5.4)
- mixlib-archive (0.2.0)
+ mixlib-archive (0.3.0)
mixlib-log
mixlib-authentication (1.4.1)
mixlib-log
mixlib-config (2.2.4)
- mixlib-install (2.1.7)
+ mixlib-install (2.1.10)
artifactory
mixlib-shellout
mixlib-versioning
@@ -127,15 +127,15 @@ GEM
win32-process (~> 0.8.2)
wmi-lite (~> 1.0)
mixlib-versioning (1.1.0)
- molinillo (0.5.4)
+ molinillo (0.5.5)
multi_json (1.12.1)
multipart-post (2.0.0)
net-scp (1.2.1)
net-ssh (>= 2.6.5)
- net-ssh (3.2.0)
+ net-ssh (4.0.1)
net-ssh-gateway (1.2.0)
net-ssh (>= 2.6.5)
- nio4r (1.2.1)
+ nio4r (2.0.0)
nori (2.6.0)
octokit (4.6.2)
sawyer (~> 0.8.0, >= 0.5.3)
@@ -144,7 +144,7 @@ GEM
coderay (~> 1.1.0)
method_source (~> 0.8.1)
slop (~> 3.4)
- public_suffix (2.0.4)
+ public_suffix (2.0.5)
rainbow (2.1.0)
retryable (2.0.4)
ridley (5.1.0)
@@ -196,23 +196,23 @@ GEM
molinillo (>= 0.5)
semverse (>= 1.1, < 3.0)
sslshake (1.0.13)
- test-kitchen (1.14.0)
+ test-kitchen (1.15.0)
mixlib-install (>= 1.2, < 3.0)
mixlib-shellout (>= 1.2, < 3.0)
net-scp (~> 1.1)
- net-ssh (>= 2.9, < 4.0)
- net-ssh-gateway (~> 1.2.0)
+ net-ssh (>= 2.9, < 5.0)
+ net-ssh-gateway (~> 1.2)
safe_yaml (~> 1.0)
thor (~> 0.18)
- thor (0.19.4)
+ thor (0.19.1)
timers (4.0.4)
hitimes
- train (0.22.0)
+ train (0.22.1)
docker-api (~> 1.26)
json (>= 1.8, < 3.0)
mixlib-shellout (~> 2.0)
net-scp (~> 1.2)
- net-ssh (>= 2.9, < 4.0)
+ net-ssh (>= 2.9, < 5.0)
winrm (~> 2.0)
winrm-fs (~> 1.0)
vagrant-wrapper (2.0.3)
@@ -221,7 +221,7 @@ GEM
hashie (>= 2.0.2, < 4.0.0)
win32-process (0.8.3)
ffi (>= 1.0.0)
- winrm (2.1.0)
+ winrm (2.1.2)
builder (>= 2.1.2)
erubis (~> 2.7)
gssapi (~> 1.2)
@@ -230,7 +230,7 @@ GEM
logging (>= 1.6.1, < 3.0)
nori (~> 2.0)
rubyntlm (~> 0.6.0, >= 0.6.1)
- winrm-fs (1.0.0)
+ winrm-fs (1.0.1)
erubis (~> 2.7)
logging (>= 1.6.1, < 3.0)
rubyzip (~> 1.1)
@@ -248,9 +248,10 @@ DEPENDENCIES
kitchen-ec2
kitchen-inspec
kitchen-vagrant
+ rainbow (>= 2.1.0, < 2.2)
ridley
test-kitchen
vagrant-wrapper
BUNDLED WITH
- 1.13.6
+ 1.12.5
diff --git a/lib/chef/chef_class.rb b/lib/chef/chef_class.rb
index 3a395d979d..e61fd5e1d2 100644
--- a/lib/chef/chef_class.rb
+++ b/lib/chef/chef_class.rb
@@ -30,6 +30,7 @@ require "chef/platform/provider_priority_map"
require "chef/platform/resource_priority_map"
require "chef/platform/provider_handler_map"
require "chef/platform/resource_handler_map"
+require "chef/deprecated"
require "chef/event_dispatch/dsl"
require "chef/deprecated"
diff --git a/lib/chef/deprecated.rb b/lib/chef/deprecated.rb
index 1cadacec98..76f66f723b 100644
--- a/lib/chef/deprecated.rb
+++ b/lib/chef/deprecated.rb
@@ -156,6 +156,26 @@ class Chef
end
end
+ class PropertyNameCollision < Base
+ def id
+ 11
+ end
+
+ def target
+ "property_name_collision.html"
+ end
+ end
+
+ class LaunchdHashProperty < Base
+ def id
+ 12
+ end
+
+ def target
+ "launchd_hash_property.html"
+ end
+ end
+
class ChefPlatformMethods < Base
def id
13
diff --git a/lib/chef/exceptions.rb b/lib/chef/exceptions.rb
index 2d6dcef17e..864268a85e 100644
--- a/lib/chef/exceptions.rb
+++ b/lib/chef/exceptions.rb
@@ -525,5 +525,8 @@ This error is most often caused by network issues (proxies, etc) outside of chef
super "Found multiple matching resources. #{matches_info.join("\n")}"
end
end
+
+ # exception specific to invalid usage of 'dsc_resource' resource
+ class DSCModuleNameMissing < ArgumentError; end
end
end
diff --git a/lib/chef/knife/ssh.rb b/lib/chef/knife/ssh.rb
index 53801afffd..6797f6cab2 100644
--- a/lib/chef/knife/ssh.rb
+++ b/lib/chef/knife/ssh.rb
@@ -166,10 +166,10 @@ class Chef
def configure_session
list = config[:manual] ? @name_args[0].split(" ") : search_nodes
if list.length == 0
- if @action_nodes.length == 0
+ if @search_count == 0
ui.fatal("No nodes returned from search")
else
- ui.fatal("#{@action_nodes.length} #{@action_nodes.length > 1 ? "nodes" : "node"} found, " +
+ ui.fatal("#{@search_count} #{@search_count > 1 ? "nodes" : "node"} found, " +
"but does not have the required attribute to establish the connection. " +
"Try setting another attribute to open the connection using --attribute.")
end
@@ -184,41 +184,56 @@ class Chef
# 2) configuration file
# 3) cloud attribute
# 4) fqdn
- if config[:attribute]
- Chef::Log.debug("Using node attribute '#{config[:attribute]}' as the ssh target")
- attribute = config[:attribute]
+ if node["config"]
+ Chef::Log.debug("Using node attribute '#{config[:attribute]}' as the ssh target: #{node["config"]}")
+ node["config"]
elsif Chef::Config[:knife][:ssh_attribute]
- Chef::Log.debug("Using node attribute #{Chef::Config[:knife][:ssh_attribute]}")
- attribute = Chef::Config[:knife][:ssh_attribute]
- elsif node[:cloud] &&
- node[:cloud][:public_hostname] &&
- !node[:cloud][:public_hostname].empty?
- Chef::Log.debug("Using node attribute 'cloud[:public_hostname]' automatically as the ssh target")
- attribute = "cloud.public_hostname"
+ Chef::Log.debug("Using node attribute #{Chef::Config[:knife][:ssh_attribute]}: #{node["knife_config"]}")
+ node["knife_config"]
+ elsif node["cloud"] &&
+ node["cloud"]["public_hostname"] &&
+ !node["cloud"]["public_hostname"].empty?
+ Chef::Log.debug("Using node attribute 'cloud[:public_hostname]' automatically as the ssh target: #{node["cloud"]["public_hostname"]}")
+ node["cloud"]["public_hostname"]
else
# falling back to default of fqdn
- Chef::Log.debug("Using node attribute 'fqdn' as the ssh target")
- attribute = "fqdn"
+ Chef::Log.debug("Using node attribute 'fqdn' as the ssh target: #{node["fqdn"]}")
+ node["fqdn"]
end
- attribute
end
def search_nodes
list = Array.new
query = Chef::Search::Query.new
- @action_nodes = query.search(:node, @name_args[0])[0]
- @action_nodes.each do |item|
+ required_attributes = { fqdn: ["fqdn"], cloud: ["cloud"] }
+
+ separator = ui.presenter.attribute_field_separator
+
+ # if we've set an attribute to use on the command line
+ if config[:attribute]
+ required_attributes[:config] = config[:attribute].split(separator)
+ end
+
+ # if we've configured an attribute in our config
+ if Chef::Config[:knife][:ssh_attribute]
+ required_attributes[:knife_config] = Chef::Config[:knife][:ssh_attribute].split(separator)
+ end
+
+ @search_count = 0
+ query.search(:node, @name_args[0], filter_result: required_attributes) do |item|
+ @search_count += 1
# we should skip the loop to next iteration if the item
# returned by the search is nil
next if item.nil?
# next if we couldn't find the specified attribute in the
# returned node object
- host = extract_nested_value(item, get_ssh_attribute(item))
+ host = get_ssh_attribute(item)
next if host.nil?
ssh_port = item[:cloud].nil? ? nil : item[:cloud][:public_ssh_port]
srv = [host, ssh_port]
list.push(srv)
end
+
list
end
@@ -309,9 +324,9 @@ class Chef
subsession ||= session
command = fixup_sudo(command)
command.force_encoding("binary") if command.respond_to?(:force_encoding)
- subsession.open_channel do |ch|
- ch.request_pty
- ch.exec command do |ch, success|
+ subsession.open_channel do |chan|
+ chan.request_pty
+ chan.exec command do |ch, success|
raise ArgumentError, "Cannot execute #{command}" unless success
ch.on_data do |ichannel, data|
print_data(ichannel[:host], data)
@@ -532,10 +547,6 @@ class Chef
config[:ssh_identity_file] = get_stripped_unfrozen_value(config[:ssh_identity_file] || config[:identity_file] || Chef::Config[:knife][:ssh_identity_file])
end
- def extract_nested_value(data_structure, path_spec)
- ui.presenter.extract_nested_value(data_structure, path_spec)
- end
-
def run
@longest = 0
diff --git a/lib/chef/property.rb b/lib/chef/property.rb
index 8d8ed352b3..8fa290251a 100644
--- a/lib/chef/property.rb
+++ b/lib/chef/property.rb
@@ -518,6 +518,13 @@ class Chef
# be using the existing getter/setter to manipulate it instead.
return if !instance_variable_name
+ # We deprecate any attempt to create a property that already exists as a
+ # method in some Classes that we know would cause our users problems.
+ # For example, creating a `hash` property could cause issues when adding
+ # a Chef::Resource instance to an data structure that expects to be able
+ # to call the `#hash` method and get back an appropriate Fixnum.
+ emit_property_redefinition_deprecations
+
# We prefer this form because the property name won't show up in the
# stack trace if you use `define_method`.
declared_in.class_eval <<-EOM, __FILE__, __LINE__ + 1
@@ -632,6 +639,30 @@ class Chef
private
+ def emit_property_redefinition_deprecations
+ # We only emit deprecations if this property already exists as an instance method.
+ # Weeding out class methods avoids unnecessary deprecations such Chef::Resource
+ # defining a `name` property when there's an already-existing `name` method
+ # for a Module.
+ return unless declared_in.instance_methods.include?(name)
+
+ # Only emit deprecations for some well-known classes. This will still
+ # allow more advanced users to subclass their own custom resources and
+ # override their own properties.
+ return unless [ Object, BasicObject, Kernel, Chef::Resource ].include?(declared_in.instance_method(name).owner)
+
+ # Allow top-level Chef::Resource proprties, such as `name`, to be overridden.
+ # As of this writing, `name` is the only Chef::Resource property created with the
+ # `property` definition, but this will allow for future properties to be extended
+ # as needed.
+ return if Chef::Resource.properties.keys.include?(name)
+
+ # Emit the deprecation.
+ resource_name = declared_in.respond_to?(:resource_name) ? declared_in.resource_name : declared_in
+ Chef.deprecated(:property_name_collision, "Property `#{name}` of resource `#{resource_name}` overwrites an existing method. " \
+ "Please use a different property name. This will raise an exception in Chef 13.")
+ end
+
def exec_in_resource(resource, proc, *args)
if resource
if proc.arity > args.size
diff --git a/lib/chef/provider/directory.rb b/lib/chef/provider/directory.rb
index 619ab5d8b6..1cacc3fcb9 100644
--- a/lib/chef/provider/directory.rb
+++ b/lib/chef/provider/directory.rb
@@ -138,7 +138,7 @@ class Chef
end
do_acl_changes
do_selinux(true)
- load_resource_attributes_from_file(@new_resource)
+ load_resource_attributes_from_file(@new_resource) unless Chef::Config[:why_run]
end
def action_delete
diff --git a/lib/chef/provider/dsc_resource.rb b/lib/chef/provider/dsc_resource.rb
index 0f25065925..026d2ef104 100644
--- a/lib/chef/provider/dsc_resource.rb
+++ b/lib/chef/provider/dsc_resource.rb
@@ -29,6 +29,7 @@ class Chef
super
@new_resource = new_resource
@module_name = new_resource.module_name
+ @module_version = new_resource.module_version
@reboot_resource = nil
end
@@ -65,6 +66,13 @@ class Chef
a.whyrun err + ["Assuming a previous resource sets the RefreshMode."]
a.block_action!
end
+ requirements.assert(:run) do |a|
+ a.assertion { module_usage_valid? }
+ err = ["module_name must be supplied along with module_version."]
+ a.failure_message Chef::Exceptions::DSCModuleNameMissing,
+ err
+ a.block_action!
+ end
end
protected
@@ -92,6 +100,10 @@ class Chef
Chef::Platform.supports_refresh_mode_enabled?(node)
end
+ def module_usage_valid?
+ !(!@module_name && @module_version)
+ end
+
def generate_description
@converge_description
end
@@ -148,10 +160,14 @@ class Chef
end
end
+ def module_info_object
+ @module_version.nil? ? module_name : "@{ModuleName='#{module_name}';ModuleVersion='#{@module_version}'}"
+ end
+
def invoke_resource(method, output_format = :object)
properties = translate_type(@new_resource.properties)
switches = "-Method #{method} -Name #{@new_resource.resource}"\
- " -Property #{properties} -Module #{module_name} -Verbose"
+ " -Property #{properties} -Module #{module_info_object} -Verbose"
cmdlet = Chef::Util::Powershell::Cmdlet.new(
node,
"Invoke-DscResource #{switches}",
diff --git a/lib/chef/provider/file.rb b/lib/chef/provider/file.rb
index 84bb4d1c94..f77986fa03 100644
--- a/lib/chef/provider/file.rb
+++ b/lib/chef/provider/file.rb
@@ -154,7 +154,7 @@ class Chef
do_contents_changes
do_acl_changes
do_selinux
- load_resource_attributes_from_file(@new_resource)
+ load_resource_attributes_from_file(@new_resource) unless Chef::Config[:why_run]
end
def action_create_if_missing
diff --git a/lib/chef/provider/launchd.rb b/lib/chef/provider/launchd.rb
index 0ec8d0cfe1..f3e0a00758 100644
--- a/lib/chef/provider/launchd.rb
+++ b/lib/chef/provider/launchd.rb
@@ -150,7 +150,7 @@ class Chef
end
def content
- plist_hash = new_resource.hash || gen_hash
+ plist_hash = new_resource.plist_hash || gen_hash
Plist::Emit.dump(plist_hash) unless plist_hash.nil?
end
diff --git a/lib/chef/resource/apt_repository.rb b/lib/chef/resource/apt_repository.rb
index 8b87371824..b38bd1c8ec 100644
--- a/lib/chef/resource/apt_repository.rb
+++ b/lib/chef/resource/apt_repository.rb
@@ -38,7 +38,6 @@ class Chef
property :cookbook, [String, nil, false], default: nil, desired_state: false, nillable: true, coerce: proc { |x| x ? x : nil }
property :cache_rebuild, [TrueClass, FalseClass], default: true, desired_state: false
- property :sensitive, [TrueClass, FalseClass], default: false, desired_state: false
default_action :add
allowed_actions :add, :remove
diff --git a/lib/chef/resource/dsc_resource.rb b/lib/chef/resource/dsc_resource.rb
index 58594cce7b..f55f8d2c8c 100644
--- a/lib/chef/resource/dsc_resource.rb
+++ b/lib/chef/resource/dsc_resource.rb
@@ -68,6 +68,14 @@ class Chef
end
end
+ def module_version(arg = nil)
+ set_or_return(
+ :module_version,
+ arg,
+ :kind_of => [ String ]
+ )
+ end
+
def property(property_name, value = nil)
if not property_name.is_a?(Symbol)
raise TypeError, "A property name of type Symbol must be specified, '#{property_name}' of type #{property_name.class} was given"
diff --git a/lib/chef/resource/launchd.rb b/lib/chef/resource/launchd.rb
index 6427b13f84..c78ffa3f0e 100644
--- a/lib/chef/resource/launchd.rb
+++ b/lib/chef/resource/launchd.rb
@@ -33,7 +33,7 @@ class Chef
property :backup, [Integer, FalseClass]
property :cookbook, String
property :group, [String, Integer]
- property :hash, Hash
+ property :plist_hash, Hash
property :mode, [String, Integer]
property :owner, [String, Integer]
property :path, String
@@ -139,6 +139,18 @@ class Chef
property :wait_for_debugger, [ TrueClass, FalseClass ]
property :watch_paths, Array
property :working_directory, String
+
+ # hash is an instance method on Object and needs to return a Fixnum.
+ def hash(arg = nil)
+ Chef.deprecated(:launchd_hash_property, "Property `hash` on the `launchd` resource has changed to `plist_hash`." \
+ "Please use `plist_hash` instead. This will raise an exception in Chef 13.")
+
+ set_or_return(
+ :plist_hash,
+ arg,
+ :kind_of => Hash
+ )
+ end
end
end
end
diff --git a/lib/chef/resource/yum_repository.rb b/lib/chef/resource/yum_repository.rb
index 0d6c3472c0..f59ad56d16 100644
--- a/lib/chef/resource/yum_repository.rb
+++ b/lib/chef/resource/yum_repository.rb
@@ -58,7 +58,6 @@ class Chef
property :repo_gpgcheck, [TrueClass, FalseClass]
property :report_instanceid, [TrueClass, FalseClass]
property :repositoryid, String, regex: /.*/, name_property: true
- property :sensitive, [TrueClass, FalseClass], default: false
property :skip_if_unavailable, [TrueClass, FalseClass]
property :source, String, regex: /.*/
property :sslcacert, String, regex: /.*/
diff --git a/lib/chef/version.rb b/lib/chef/version.rb
index 284665a668..25d07088e2 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.18.37"
+ VERSION = "12.18.50"
end
#
diff --git a/lib/chef/win32/security.rb b/lib/chef/win32/security.rb
index 8bf2bfa762..c7d3f55a40 100644
--- a/lib/chef/win32/security.rb
+++ b/lib/chef/win32/security.rb
@@ -239,7 +239,7 @@ class Chef
security_descriptor = FFI::MemoryPointer.new :pointer
hr = GetNamedSecurityInfoW(path.to_wstring, type, info, nil, nil, nil, nil, security_descriptor)
if hr != ERROR_SUCCESS
- Chef::ReservedNames::Win32::Error.raise!("get_named_security_info(#{path}, #{type}, #{info})")
+ Chef::ReservedNames::Win32::Error.raise!("get_named_security_info(#{path}, #{type}, #{info})", hr)
end
result_pointer = security_descriptor.read_pointer
@@ -538,7 +538,7 @@ class Chef
hr = SetNamedSecurityInfoW(path.to_wstring, type, security_information, owner, group, dacl, sacl)
if hr != ERROR_SUCCESS
- Chef::ReservedNames::Win32::Error.raise!
+ Chef::ReservedNames::Win32::Error.raise! nil, hr
end
end
diff --git a/omnibus/Gemfile.lock b/omnibus/Gemfile.lock
index e64c4659b4..a60b85d84a 100644
--- a/omnibus/Gemfile.lock
+++ b/omnibus/Gemfile.lock
@@ -1,6 +1,6 @@
GIT
remote: git://github.com/chef/license_scout.git
- revision: 95a308e01848e7843c84fa9be6214fa06e30f436
+ revision: 383ad28edeea0f587aee57b969c77a21b7909e77
specs:
license_scout (0.1.2)
ffi-yajl (~> 2.2)
@@ -8,7 +8,7 @@ GIT
GIT
remote: git://github.com/chef/omnibus-software.git
- revision: cd69f8563fa8875c82a4e44652ffbfdac7ef201d
+ revision: 086710002ec0054b3d240d14ca04d11163f528aa
branch: shain/ruby_windows_monster
specs:
omnibus-software (4.0.0)
@@ -17,7 +17,7 @@ GIT
GIT
remote: git://github.com/chef/omnibus.git
- revision: 0612bf6333b2a7b125e599228ec6c46cbaa3ed3d
+ revision: dce5283a85a44484a66a8a84991beba92e46fd12
branch: rhass/COOL-502_with_gcc_investigate
specs:
omnibus (5.5.0)
@@ -35,15 +35,18 @@ GIT
GEM
remote: https://rubygems.org/
specs:
- addressable (2.4.0)
- artifactory (2.5.0)
+ addressable (2.5.0)
+ public_suffix (~> 2.0, >= 2.0.2)
+ artifactory (2.5.1)
awesome_print (1.7.0)
- aws-sdk (2.6.18)
- aws-sdk-resources (= 2.6.18)
- aws-sdk-core (2.6.18)
+ aws-sdk (2.7.0)
+ aws-sdk-resources (= 2.7.0)
+ aws-sdk-core (2.7.0)
+ aws-sigv4 (~> 1.0)
jmespath (~> 1.0)
- aws-sdk-resources (2.6.18)
- aws-sdk-core (= 2.6.18)
+ aws-sdk-resources (2.7.0)
+ aws-sdk-core (= 2.7.0)
+ aws-sigv4 (1.0.0)
berkshelf (4.3.5)
addressable (~> 2.3, >= 2.3.4)
berkshelf-api-client (~> 2.0, >= 2.0.2)
@@ -76,14 +79,14 @@ GEM
buff-ruby_engine (0.1.0)
buff-shell_out (0.2.0)
buff-ruby_engine (~> 0.1.0)
- builder (3.2.2)
+ builder (3.2.3)
byebug (9.0.6)
celluloid (0.16.0)
timers (~> 4.0.0)
celluloid-io (0.16.2)
celluloid (>= 0.16.0)
nio4r (>= 1.1.0)
- chef-config (12.15.19)
+ chef-config (12.18.31)
addressable
fuzzyurl
mixlib-config (~> 2.0)
@@ -95,8 +98,8 @@ GEM
erubis (2.7.0)
faraday (0.9.2)
multipart-post (>= 1.2, < 3)
- ffi (1.9.14)
- ffi (1.9.14-x86-mingw32)
+ ffi (1.9.17)
+ ffi (1.9.17-x86-mingw32)
ffi-yajl (2.3.0)
libyajl2 (~> 1.2)
fuzzyurl (0.9.0)
@@ -111,7 +114,7 @@ GEM
iostruct (0.0.4)
ipaddress (0.8.3)
jmespath (1.3.1)
- json (2.0.2)
+ json (2.0.3)
kitchen-vagrant (0.19.0)
test-kitchen (~> 1.4)
libyajl2 (1.2.0)
@@ -121,13 +124,13 @@ GEM
multi_json (~> 1.10)
method_source (0.8.2)
minitar (0.5.4)
- mixlib-archive (0.2.0)
+ mixlib-archive (0.3.0)
mixlib-log
mixlib-authentication (1.4.1)
mixlib-log
mixlib-cli (1.7.0)
mixlib-config (2.2.4)
- mixlib-install (2.1.6)
+ mixlib-install (2.1.10)
artifactory
mixlib-shellout
mixlib-versioning
@@ -143,14 +146,14 @@ GEM
multipart-post (2.0.0)
net-scp (1.2.1)
net-ssh (>= 2.6.5)
- net-ssh (3.2.0)
+ net-ssh (4.0.1)
net-ssh-gateway (1.2.0)
net-ssh (>= 2.6.5)
- nio4r (1.2.1)
+ nio4r (2.0.0)
nori (2.6.0)
- octokit (4.4.1)
- sawyer (~> 0.7.0, >= 0.5.3)
- ohai (8.21.0)
+ octokit (4.6.2)
+ sawyer (~> 0.8.0, >= 0.5.3)
+ ohai (8.22.1)
chef-config (>= 12.5.0.alpha.1, < 13)
ffi (~> 1.9)
ffi-yajl (~> 2.2)
@@ -169,17 +172,18 @@ GEM
progressbar
zhexdump (>= 0.0.2)
plist (3.2.0)
- progressbar (0.21.0)
+ progressbar (1.8.2)
pry (0.10.4)
coderay (~> 1.1.0)
method_source (~> 0.8.1)
slop (~> 3.4)
- pry-byebug (3.4.0)
+ pry-byebug (3.4.2)
byebug (~> 9.0)
pry (~> 0.10)
pry-stack_explorer (0.4.9.2)
binding_of_caller (>= 0.7)
pry (>= 0.9.11)
+ public_suffix (2.0.5)
retryable (2.0.4)
ridley (4.6.1)
addressable
@@ -203,24 +207,24 @@ GEM
rubyntlm (0.6.1)
rubyzip (1.2.0)
safe_yaml (1.0.4)
- sawyer (0.7.0)
- addressable (>= 2.3.5, < 2.5)
- faraday (~> 0.8, < 0.10)
+ sawyer (0.8.1)
+ addressable (>= 2.3.5, < 2.6)
+ faraday (~> 0.8, < 1.0)
semverse (1.2.1)
slop (3.6.0)
solve (2.0.3)
molinillo (~> 0.4.2)
semverse (~> 1.1)
systemu (2.6.5)
- test-kitchen (1.13.2)
+ test-kitchen (1.15.0)
mixlib-install (>= 1.2, < 3.0)
mixlib-shellout (>= 1.2, < 3.0)
net-scp (~> 1.1)
- net-ssh (>= 2.9, < 4.0)
- net-ssh-gateway (~> 1.2.0)
+ net-ssh (>= 2.9, < 5.0)
+ net-ssh-gateway (~> 1.2)
safe_yaml (~> 1.0)
thor (~> 0.18)
- thor (0.19.1)
+ thor (0.19.4)
timers (4.0.4)
hitimes
varia_model (0.4.1)
@@ -228,7 +232,7 @@ GEM
hashie (>= 2.0.2, < 4.0.0)
win32-process (0.8.3)
ffi (>= 1.0.0)
- winrm (2.1.0)
+ winrm (2.1.2)
builder (>= 2.1.2)
erubis (~> 2.7)
gssapi (~> 1.2)
@@ -237,7 +241,7 @@ GEM
logging (>= 1.6.1, < 3.0)
nori (~> 2.0)
rubyntlm (~> 0.6.0, >= 0.6.1)
- winrm-fs (1.0.0)
+ winrm-fs (1.0.1)
erubis (~> 2.7)
logging (>= 1.6.1, < 3.0)
rubyzip (~> 1.1)
diff --git a/omnibus/config/projects/chef.rb b/omnibus/config/projects/chef.rb
index 3d92d290a0..a0e490ceab 100644
--- a/omnibus/config/projects/chef.rb
+++ b/omnibus/config/projects/chef.rb
@@ -39,11 +39,6 @@ else
install_dir "#{default_root}/#{name}"
end
-# Global FIPS override flag.
-if windows? || rhel?
- override :fips, enabled: true
-end
-
# Load dynamically updated overrides
overrides_path = File.expand_path("../../../../omnibus_overrides.rb", current_file)
instance_eval(IO.read(overrides_path), overrides_path)
diff --git a/omnibus/config/software/chef-gem-bcrypt_pbkdf-ruby.rb b/omnibus/config/software/chef-gem-bcrypt_pbkdf-ruby.rb
new file mode 100644
index 0000000000..1f7f4d3207
--- /dev/null
+++ b/omnibus/config/software/chef-gem-bcrypt_pbkdf-ruby.rb
@@ -0,0 +1,10 @@
+# gem installs this gem from the version specified in chef's Gemfile.lock
+# so we can take advantage of omnibus's caching. Just duplicate this file and
+# add the new software def to chef software def if you want to separate
+# another gem's installation.
+require_relative "../../files/chef-gem/build-chef-gem/gem-install-software-def"
+BuildChefGem::GemInstallSoftwareDef.define(self, __FILE__)
+
+license "MIT"
+license_file "https://raw.githubusercontent.com/mfazekas/bcrypt_pbkdf-ruby/master/COPYING"
+skip_transitive_dependency_licensing true
diff --git a/omnibus/config/software/chef-gem-rbnacl-libsodium.rb b/omnibus/config/software/chef-gem-rbnacl-libsodium.rb
new file mode 100644
index 0000000000..90bbc69dfb
--- /dev/null
+++ b/omnibus/config/software/chef-gem-rbnacl-libsodium.rb
@@ -0,0 +1,10 @@
+# gem installs this gem from the version specified in chef's Gemfile.lock
+# so we can take advantage of omnibus's caching. Just duplicate this file and
+# add the new software def to chef software def if you want to separate
+# another gem's installation.
+require_relative "../../files/chef-gem/build-chef-gem/gem-install-software-def"
+BuildChefGem::GemInstallSoftwareDef.define(self, __FILE__)
+
+license "MIT"
+license_file "https://raw.githubusercontent.com/cryptosphere/rbnacl-libsodium/master/LICENSE"
+skip_transitive_dependency_licensing true
diff --git a/omnibus/config/software/chef.rb b/omnibus/config/software/chef.rb
index c6ced7e566..c53a2339ae 100644
--- a/omnibus/config/software/chef.rb
+++ b/omnibus/config/software/chef.rb
@@ -44,6 +44,10 @@ dependency "chef-gem-ruby-prof"
dependency "chef-gem-byebug"
dependency "chef-gem-debug_inspector"
dependency "chef-gem-binding_of_caller"
+unless ios_xr? || solaris?
+ dependency "chef-gem-rbnacl-libsodium"
+ dependency "chef-gem-bcrypt_pbkdf-ruby"
+end
# Now everyone else, in alphabetical order because we don't care THAT much
Dir.entries(File.dirname(__FILE__)).sort.each do |gem_software|
diff --git a/omnibus/omnibus.rb b/omnibus/omnibus.rb
index c6f883adbc..dfbd2bc338 100644
--- a/omnibus/omnibus.rb
+++ b/omnibus/omnibus.rb
@@ -52,3 +52,4 @@ fetcher_read_timeout 120
# local_software_dirs ['/path/to/local/software']
fatal_transitive_dependency_licensing_warnings true
+fips_mode (ENV["OMNIBUS_FIPS_MODE"] || "").casecmp("true") >= 0
diff --git a/omnibus_overrides.rb b/omnibus_overrides.rb
index 0d740ff046..69af8dbd44 100644
--- a/omnibus_overrides.rb
+++ b/omnibus_overrides.rb
@@ -1,6 +1,7 @@
# DO NOT EDIT. Generated by "rake dependencies". Edit version_policy.rb instead.
-override :rubygems, version: "2.6.8"
+override :rubygems, version: "2.6.10"
override :bundler, version: "1.12.5"
+override :rainbow, version: "2.1.0"
override "libffi", version: "3.2.1"
override "libiconv", version: "1.14"
override "liblzma", version: "5.2.2"
diff --git a/spec/functional/knife/ssh_spec.rb b/spec/functional/knife/ssh_spec.rb
index 065b646ac6..aea7585bb2 100644
--- a/spec/functional/knife/ssh_spec.rb
+++ b/spec/functional/knife/ssh_spec.rb
@@ -181,7 +181,7 @@ describe Chef::Knife::Ssh do
it "uses the ssh_attribute" do
@knife.run
- expect(@knife.get_ssh_attribute(Chef::Node.new)).to eq("ec2.public_hostname")
+ expect(@knife.get_ssh_attribute({ "knife_config" => "ec2.public_hostname" })).to eq("ec2.public_hostname")
end
end
@@ -193,11 +193,11 @@ describe Chef::Knife::Ssh do
it "uses the default" do
@knife.run
- expect(@knife.get_ssh_attribute(Chef::Node.new)).to eq("fqdn")
+ expect(@knife.get_ssh_attribute({ "fqdn" => "fqdn" })).to eq("fqdn")
end
end
- context "when -a ec2.public_ipv4 is provided" do
+ context "when -a ec2.public_public_hostname is provided" do
before do
setup_knife(["-a ec2.public_hostname", "*:*", "uptime"])
Chef::Config[:knife][:ssh_attribute] = nil
@@ -276,8 +276,8 @@ describe Chef::Knife::Ssh do
Chef::Config[:client_key] = nil
Chef::Config[:chef_server_url] = "http://localhost:9000"
- @api.get("/search/node?q=*:*&sort=X_CHEF_id_CHEF_X%20asc&start=0", 200) do
- %({"total":1, "start":0, "rows":[{"name":"i-xxxxxxxx", "json_class":"Chef::Node", "automatic":{"fqdn":"the.fqdn", "ec2":{"public_hostname":"the_public_hostname"}},"recipes":[]}]})
+ @api.post("/search/node?q=*:*&sort=X_CHEF_id_CHEF_X%20asc&start=0", 200) do
+ %({"total":1, "start":0, "rows":[{"data": {"fqdn":"the.fqdn", "config": "the_public_hostname", "knife_config": "the_public_hostname" }}]})
end
end
diff --git a/spec/support/shared/unit/provider/file.rb b/spec/support/shared/unit/provider/file.rb
index 394fdaa02f..b58159fcc9 100644
--- a/spec/support/shared/unit/provider/file.rb
+++ b/spec/support/shared/unit/provider/file.rb
@@ -683,6 +683,16 @@ shared_examples_for Chef::Provider::File do
end
end
+ context "in why run mode" do
+ before { Chef::Config[:why_run] = true }
+ after { Chef::Config[:why_run] = false }
+
+ it "does not modify new_resource" do
+ setup_missing_file
+ expect(provider).not_to receive(:load_resource_attributes_from_file).with(provider.new_resource)
+ provider.run_action(:create)
+ end
+ end
end
context "action delete" do
diff --git a/spec/unit/knife/ssh_spec.rb b/spec/unit/knife/ssh_spec.rb
index 9263a0b8e5..6141a8a6df 100644
--- a/spec/unit/knife/ssh_spec.rb
+++ b/spec/unit/knife/ssh_spec.rb
@@ -21,54 +21,53 @@ require "net/ssh"
require "net/ssh/multi"
describe Chef::Knife::Ssh do
- before(:each) do
- Chef::Config[:client_key] = CHEF_SPEC_DATA + "/ssl/private_key.pem"
- end
+ let(:query_result) { double("chef search results") }
before do
+ Chef::Config[:client_key] = CHEF_SPEC_DATA + "/ssl/private_key.pem"
@knife = Chef::Knife::Ssh.new
@knife.merge_configs
- @node_foo = Chef::Node.new
- @node_foo.automatic_attrs[:fqdn] = "foo.example.org"
- @node_foo.automatic_attrs[:ipaddress] = "10.0.0.1"
+ @node_foo = {}
+ @node_foo["fqdn"] = "foo.example.org"
+ @node_foo["ipaddress"] = "10.0.0.1"
+ @node_foo["cloud"] = {}
+
+ @node_bar = {}
+ @node_bar["fqdn"] = "bar.example.org"
+ @node_bar["ipaddress"] = "10.0.0.2"
+ @node_bar["cloud"] = {}
- @node_bar = Chef::Node.new
- @node_bar.automatic_attrs[:fqdn] = "bar.example.org"
- @node_bar.automatic_attrs[:ipaddress] = "10.0.0.2"
end
describe "#configure_session" do
context "manual is set to false (default)" do
before do
@knife.config[:manual] = false
- @query = Chef::Search::Query.new
- end
-
- def configure_query(node_array)
- allow(@query).to receive(:search).and_return([node_array])
- allow(Chef::Search::Query).to receive(:new).and_return(@query)
+ allow(query_result).to receive(:search).with(any_args).and_yield(@node_foo).and_yield(@node_bar)
+ allow(Chef::Search::Query).to receive(:new).and_return(query_result)
end
def self.should_return_specified_attributes
it "returns an array of the attributes specified on the command line OR config file, if only one is set" do
+ @node_bar["config"] = "10.0.0.2"
+ @node_foo["config"] = "10.0.0.1"
@knife.config[:attribute] = "ipaddress"
Chef::Config[:knife][:ssh_attribute] = "ipaddress" # this value will be in the config file
- configure_query([@node_foo, @node_bar])
expect(@knife).to receive(:session_from_list).with([["10.0.0.1", nil], ["10.0.0.2", nil]])
@knife.configure_session
end
it "returns an array of the attributes specified on the command line even when a config value is set" do
+ @node_bar["config"] = "10.0.0.2"
+ @node_foo["config"] = "10.0.0.1"
Chef::Config[:knife][:ssh_attribute] = "config_file" # this value will be in the config file
@knife.config[:attribute] = "ipaddress" # this is the value of the command line via #configure_attribute
- configure_query([@node_foo, @node_bar])
expect(@knife).to receive(:session_from_list).with([["10.0.0.1", nil], ["10.0.0.2", nil]])
@knife.configure_session
end
end
it "searchs for and returns an array of fqdns" do
- configure_query([@node_foo, @node_bar])
expect(@knife).to receive(:session_from_list).with([
["foo.example.org", nil],
["bar.example.org", nil],
@@ -80,11 +79,10 @@ describe Chef::Knife::Ssh do
context "when cloud hostnames are available" do
before do
- @node_foo.automatic_attrs[:cloud][:public_hostname] = "ec2-10-0-0-1.compute-1.amazonaws.com"
- @node_bar.automatic_attrs[:cloud][:public_hostname] = "ec2-10-0-0-2.compute-1.amazonaws.com"
+ @node_foo["cloud"]["public_hostname"] = "ec2-10-0-0-1.compute-1.amazonaws.com"
+ @node_bar["cloud"]["public_hostname"] = "ec2-10-0-0-2.compute-1.amazonaws.com"
end
it "returns an array of cloud public hostnames" do
- configure_query([@node_foo, @node_bar])
expect(@knife).to receive(:session_from_list).with([
["ec2-10-0-0-1.compute-1.amazonaws.com", nil],
["ec2-10-0-0-2.compute-1.amazonaws.com", nil],
@@ -97,12 +95,11 @@ describe Chef::Knife::Ssh do
context "when cloud hostnames are available but empty" do
before do
- @node_foo.automatic_attrs[:cloud][:public_hostname] = ""
- @node_bar.automatic_attrs[:cloud][:public_hostname] = ""
+ @node_foo["cloud"]["public_hostname"] = ""
+ @node_bar["cloud"]["public_hostname"] = ""
end
it "returns an array of fqdns" do
- configure_query([@node_foo, @node_bar])
expect(@knife).to receive(:session_from_list).with([
["foo.example.org", nil],
["bar.example.org", nil],
@@ -114,7 +111,7 @@ describe Chef::Knife::Ssh do
end
it "should raise an error if no host are found" do
- configure_query([ ])
+ allow(query_result).to receive(:search).with(any_args)
expect(@knife.ui).to receive(:fatal)
expect(@knife).to receive(:exit).with(10)
@knife.configure_session
@@ -122,10 +119,8 @@ describe Chef::Knife::Ssh do
context "when there are some hosts found but they do not have an attribute to connect with" do
before do
- allow(@query).to receive(:search).and_return([[@node_foo, @node_bar]])
- @node_foo.automatic_attrs[:fqdn] = nil
- @node_bar.automatic_attrs[:fqdn] = nil
- allow(Chef::Search::Query).to receive(:new).and_return(@query)
+ @node_foo["fqdn"] = nil
+ @node_bar["fqdn"] = nil
end
it "should raise a specific error (CHEF-3402)" do
@@ -158,31 +153,34 @@ describe Chef::Knife::Ssh do
before do
Chef::Config[:knife][:ssh_attribute] = nil
@knife.config[:attribute] = nil
- @node_foo.automatic_attrs[:cloud][:public_hostname] = "ec2-10-0-0-1.compute-1.amazonaws.com"
- @node_bar.automatic_attrs[:cloud][:public_hostname] = ""
+ @node_foo["cloud"]["public_hostname"] = "ec2-10-0-0-1.compute-1.amazonaws.com"
+ @node_bar["cloud"]["public_hostname"] = ""
end
it "should return fqdn by default" do
- expect(@knife.get_ssh_attribute(Chef::Node.new)).to eq("fqdn")
+ expect(@knife.get_ssh_attribute({ "fqdn" => "fqdn" })).to eq("fqdn")
end
it "should return cloud.public_hostname attribute if available" do
- expect(@knife.get_ssh_attribute(@node_foo)).to eq("cloud.public_hostname")
+ expect(@knife.get_ssh_attribute(@node_foo)).to eq("ec2-10-0-0-1.compute-1.amazonaws.com")
end
it "should favor to attribute_from_cli over config file and cloud" do
@knife.config[:attribute] = "command_line"
Chef::Config[:knife][:ssh_attribute] = "config_file"
+ @node_foo["config"] = "command_line"
+ @node_foo["knife_config"] = "config_file"
expect( @knife.get_ssh_attribute(@node_foo)).to eq("command_line")
end
it "should favor config file over cloud and default" do
Chef::Config[:knife][:ssh_attribute] = "config_file"
+ @node_foo["knife_config"] = "config_file"
expect( @knife.get_ssh_attribute(@node_foo)).to eq("config_file")
end
it "should return fqdn if cloud.hostname is empty" do
- expect( @knife.get_ssh_attribute(@node_bar)).to eq("fqdn")
+ expect( @knife.get_ssh_attribute(@node_bar)).to eq("bar.example.org")
end
end
@@ -294,7 +292,7 @@ describe Chef::Knife::Ssh do
describe "#run" do
before do
@query = Chef::Search::Query.new
- expect(@query).to receive(:search).and_return([[@node_foo]])
+ expect(@query).to receive(:search).and_yield(@node_foo)
allow(Chef::Search::Query).to receive(:new).and_return(@query)
allow(@knife).to receive(:ssh_command).and_return(exit_code)
@knife.name_args = ["*:*", "false"]
diff --git a/spec/unit/provider/directory_spec.rb b/spec/unit/provider/directory_spec.rb
index aebbaa6e81..4672db7d8d 100644
--- a/spec/unit/provider/directory_spec.rb
+++ b/spec/unit/provider/directory_spec.rb
@@ -148,6 +148,16 @@ describe Chef::Provider::Directory do
directory.run_action(:create)
expect(new_resource).not_to be_updated
end
+
+ context "in why run mode" do
+ before { Chef::Config[:why_run] = true }
+ after { Chef::Config[:why_run] = false }
+
+ it "does not modify new_resource" do
+ expect(directory).not_to receive(:load_resource_attributes_from_file).with(new_resource)
+ directory.run_action(:create)
+ end
+ end
end
describe "when the directory does not exist" do
diff --git a/spec/unit/provider/dsc_resource_spec.rb b/spec/unit/provider/dsc_resource_spec.rb
index 34eb9727f8..96356e5d73 100644
--- a/spec/unit/provider/dsc_resource_spec.rb
+++ b/spec/unit/provider/dsc_resource_spec.rb
@@ -165,4 +165,179 @@ describe Chef::Provider::DscResource do
end
end
end
+
+ describe "define_resource_requirements" do
+ let (:node) do
+ set_node_object
+ end
+
+ context "module usage is valid" do
+ before do
+ allow(provider).to receive(:module_usage_valid?).and_return(true)
+ allow(provider).to receive(:action_run)
+ end
+
+ [:run].each do |action|
+ context "action #{action}" do
+ it "does not raise the exception" do
+ expect { provider.run_action(action) }.not_to raise_error
+ end
+ end
+ end
+ end
+
+ context "module usage is invalid" do
+ before do
+ allow(provider).to receive(:module_usage_valid?).and_return(false)
+ allow(provider).to receive(:action_run)
+ end
+
+ [:run].each do |action|
+ context "action #{action}" do
+ it "raises the exception" do
+ expect { provider.run_action(action) }.to raise_error(
+ Chef::Exceptions::DSCModuleNameMissing
+ )
+ end
+ end
+ end
+ end
+ end
+
+ describe "module_usage_valid?" do
+ let (:node) do
+ set_node_object
+ end
+
+ context "module_name and module_version both are not provided" do
+ before do
+ provider.instance_variable_set(:@module_name, nil)
+ provider.instance_variable_set(:@module_version, nil)
+ end
+
+ it "returns true" do
+ response = provider.send(:module_usage_valid?)
+ expect(response).to be == true
+ end
+ end
+
+ context "module_name and module_version both are provided" do
+ before do
+ provider.instance_variable_set(:@module_name, "my_module")
+ provider.instance_variable_set(:@module_version, "1.3")
+ end
+
+ it "returns true" do
+ response = provider.send(:module_usage_valid?)
+ expect(response).to be == true
+ end
+ end
+
+ context "module_name is given but module_version is not given" do
+ before do
+ provider.instance_variable_set(:@module_name, "my_module")
+ provider.instance_variable_set(:@module_version, nil)
+ end
+
+ it "returns true" do
+ response = provider.send(:module_usage_valid?)
+ expect(response).to be == true
+ end
+ end
+
+ context "module_name is not given but module_version is given" do
+ before do
+ provider.instance_variable_set(:@module_name, nil)
+ provider.instance_variable_set(:@module_version, "1.4.0.1")
+ end
+
+ it "returns false" do
+ response = provider.send(:module_usage_valid?)
+ expect(response).to be == false
+ end
+ end
+ end
+
+ describe "module_info_object" do
+ let (:node) do
+ set_node_object
+ end
+
+ context "module_version is not given" do
+ before do
+ provider.instance_variable_set(:@module_version, nil)
+ allow(provider).to receive(:module_name).and_return("my_module")
+ end
+
+ it "returns only name of the module" do
+ response = provider.send(:module_info_object)
+ expect(response).to be == "my_module"
+ end
+ end
+
+ context "module_version is given" do
+ before do
+ provider.instance_variable_set(:@module_version, "1.3.1")
+ allow(provider).to receive(:module_name).and_return("my_module")
+ end
+
+ it "returns the module info object" do
+ response = provider.send(:module_info_object)
+ expect(response).to be == "@{ModuleName='my_module';ModuleVersion='1.3.1'}"
+ end
+ end
+ end
+
+ describe "invoke_resource" do
+ let (:node) do
+ set_node_object
+ end
+
+ let(:cmdlet) { double(:run! => nil) }
+
+ before(:each) do
+ allow(provider).to receive(:translate_type).and_return("my_properties")
+ provider.instance_variable_set(:@new_resource, double(
+ :properties => "my_properties", :resource => "my_resource", :timeout => 123
+ ))
+ end
+
+ context "when module_version is not given" do
+ before do
+ allow(provider).to receive(:module_info_object).and_return("my_module")
+ end
+
+ it "invokes Invoke-DscResource command with module name" do
+ expect(Chef::Util::Powershell::Cmdlet).to receive(:new).with(
+ node,
+ "Invoke-DscResource -Method my_method -Name my_resource -Property my_properties -Module my_module -Verbose",
+ "my_output_format"
+ ).and_return(cmdlet)
+ provider.send(:invoke_resource, "my_method", "my_output_format")
+ end
+ end
+
+ context "when module_version is given" do
+ before do
+ allow(provider).to receive(:module_info_object).and_return(
+ "@{ModuleName='my_module';ModuleVersion='my_module_version'}"
+ )
+ end
+
+ it "invokes Invoke-DscResource command with module info object" do
+ expect(Chef::Util::Powershell::Cmdlet).to receive(:new).with(
+ node,
+ "Invoke-DscResource -Method my_method -Name my_resource -Property my_properties -Module @{ModuleName='my_module';ModuleVersion='my_module_version'} -Verbose",
+ "my_output_format"
+ ).and_return(cmdlet)
+ provider.send(:invoke_resource, "my_method", "my_output_format")
+ end
+ end
+ end
+end
+
+def set_node_object
+ node = Chef::Node.new
+ node.automatic[:languages][:powershell][:version] = "5.0.10586.0"
+ node
end
diff --git a/spec/unit/provider/launchd_spec.rb b/spec/unit/provider/launchd_spec.rb
index 3e45433c62..693801f99b 100644
--- a/spec/unit/provider/launchd_spec.rb
+++ b/spec/unit/provider/launchd_spec.rb
@@ -185,8 +185,8 @@ XML
end
describe "hash is passed" do
- it "should produce the test_plist from the hash" do
- new_resource.hash test_hash
+ it "should produce the test_plist content from the plist_hash property" do
+ new_resource.plist_hash test_hash
expect(provider.content?).to be_truthy
expect(provider.content).to eql(test_plist)
end
diff --git a/spec/unit/resource/dsc_resource_spec.rb b/spec/unit/resource/dsc_resource_spec.rb
index b610c262cc..b687811392 100644
--- a/spec/unit/resource/dsc_resource_spec.rb
+++ b/spec/unit/resource/dsc_resource_spec.rb
@@ -18,6 +18,7 @@
require "spec_helper"
describe Chef::Resource::DscResource do
let(:dsc_test_resource_name) { "DSCTest" }
+ let(:dsc_test_resource_module_version) { "2.7.2" }
let(:dsc_test_property_name) { :DSCTestProperty }
let(:dsc_test_property_value) { "DSCTestValue" }
let(:dsc_test_reboot_action) { :reboot_now }
@@ -53,6 +54,11 @@ describe Chef::Resource::DscResource do
expect(dsc_test_resource.module_name).to eq(dsc_test_resource_name)
end
+ it "allows the module_version attribute to be set" do
+ dsc_test_resource.module_version(dsc_test_resource_module_version)
+ expect(dsc_test_resource.module_version).to eq(dsc_test_resource_module_version)
+ end
+
it "allows the reboot_action attribute to be set" do
dsc_test_resource.reboot_action(dsc_test_reboot_action)
expect(dsc_test_resource.reboot_action).to eq(dsc_test_reboot_action)
diff --git a/spec/unit/win32/error_spec.rb b/spec/unit/win32/error_spec.rb
new file mode 100644
index 0000000000..e8b6d5af6a
--- /dev/null
+++ b/spec/unit/win32/error_spec.rb
@@ -0,0 +1,67 @@
+#
+# Author:: Aliasgar Batterywala (aliasgar.batterywala@msystechnologies.com)
+# Copyright:: Copyright 2017, Chef Software Inc.
+# License:: Apache License, Version 2.0
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+require "spec_helper"
+if Chef::Platform.windows?
+ require "chef/win32/error"
+ require "chef/win32/api/error"
+end
+
+describe "Chef::Win32::Error", :windows_only do
+ describe "self.raise!" do
+ context "code is not passed to the raise! method" do
+ context "last error received is user_not_found" do
+ it "raises UserIDNotFound exception" do
+ expect(Chef::ReservedNames::Win32::Error).to receive(:get_last_error).and_return(
+ Chef::ReservedNames::Win32::API::Error::ERROR_USER_NOT_FOUND
+ )
+ expect(Chef::ReservedNames::Win32::Error).to receive_message_chain(:format_message, :strip)
+ expect { Chef::ReservedNames::Win32::Error.raise! }.to raise_error Chef::Exceptions::UserIDNotFound
+ end
+ end
+
+ context "last error received is not user_not_found" do
+ it "raises Win32APIError exception" do
+ expect(Chef::ReservedNames::Win32::Error).to receive(:get_last_error).and_return(
+ Chef::ReservedNames::Win32::API::Error::ERROR_BAD_USERNAME
+ )
+ expect(Chef::ReservedNames::Win32::Error).to receive_message_chain(:format_message, :strip).and_return("Bad Username")
+ expect { Chef::ReservedNames::Win32::Error.raise! }.to raise_error Chef::Exceptions::Win32APIError
+ end
+ end
+ end
+
+ context "code is passed to the raise! method" do
+ context "last error received is user_not_found" do
+ it "raises UserIDNotFound exception" do
+ expect(Chef::ReservedNames::Win32::Error).to_not receive(:get_last_error)
+ expect(Chef::ReservedNames::Win32::Error).to receive_message_chain(:format_message, :strip)
+ expect { Chef::ReservedNames::Win32::Error.raise! nil, Chef::ReservedNames::Win32::API::Error::ERROR_USER_NOT_FOUND }.to raise_error Chef::Exceptions::UserIDNotFound
+ end
+ end
+
+ context "last error received is not user_not_found" do
+ it "raises Win32APIError exception" do
+ expect(Chef::ReservedNames::Win32::Error).to_not receive(:get_last_error)
+ expect(Chef::ReservedNames::Win32::Error).to receive_message_chain(:format_message, :strip).and_return("Bad Username")
+ expect { Chef::ReservedNames::Win32::Error.raise! nil, Chef::ReservedNames::Win32::API::Error::ERROR_BAD_USERNAME }.to raise_error Chef::Exceptions::Win32APIError
+ end
+ end
+ end
+ end
+end
diff --git a/spec/unit/win32/security_spec.rb b/spec/unit/win32/security_spec.rb
new file mode 100644
index 0000000000..1c755061ce
--- /dev/null
+++ b/spec/unit/win32/security_spec.rb
@@ -0,0 +1,66 @@
+#
+# Author:: Aliasgar Batterywala (aliasgar.batterywala@msystechnologies.com)
+# Copyright:: Copyright 2017, Chef Software Inc.
+# License:: Apache License, Version 2.0
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+require "spec_helper"
+if Chef::Platform.windows?
+ require "chef/win32/error"
+ require "chef/win32/security"
+ require "chef/win32/api/error"
+end
+
+describe "Chef::Win32::Security", :windows_only do
+ describe "self.get_named_security_info" do
+ context "when HR result is ERROR_SUCCESS" do
+ it "does not raise the exception" do
+ expect(Chef::ReservedNames::Win32::Security).to receive(:GetNamedSecurityInfoW).and_return(
+ Chef::ReservedNames::Win32::API::Error::ERROR_SUCCESS
+ )
+ expect { Chef::ReservedNames::Win32::Security.get_named_security_info "/temp_path" }.to_not raise_error
+ end
+ end
+
+ context "when HR result is not ERROR_SUCCESS and not ERROR_USER_NOT_FOUND" do
+ it "raises Win32APIError exception" do
+ expect(Chef::ReservedNames::Win32::Security).to receive(:GetNamedSecurityInfoW).and_return(
+ Chef::ReservedNames::Win32::API::Error::ERROR_INVALID_ACCESS
+ )
+ expect { Chef::ReservedNames::Win32::Security.get_named_security_info "/temp_path" }.to raise_error Chef::Exceptions::Win32APIError
+ end
+ end
+ end
+
+ describe "self.set_named_security_info" do
+ context "when HR result is ERROR_SUCCESS" do
+ it "does not raise the exception" do
+ expect(Chef::ReservedNames::Win32::Security).to receive(:SetNamedSecurityInfoW).and_return(
+ Chef::ReservedNames::Win32::API::Error::ERROR_SUCCESS
+ )
+ expect { Chef::ReservedNames::Win32::Security.set_named_security_info "/temp_path", :SE_FILE_OBJECT, {} }.to_not raise_error
+ end
+ end
+
+ context "when HR result is not ERROR_SUCCESS but it is ERROR_USER_NOT_FOUND" do
+ it "raises UserIDNotFound exception" do
+ expect(Chef::ReservedNames::Win32::Security).to receive(:SetNamedSecurityInfoW).and_return(
+ Chef::ReservedNames::Win32::API::Error::ERROR_USER_NOT_FOUND
+ )
+ expect { Chef::ReservedNames::Win32::Security.set_named_security_info "/temp_path", :SE_FILE_OBJECT, {} }.to raise_error Chef::Exceptions::Chef::Exceptions::UserIDNotFound
+ end
+ end
+ end
+end
diff --git a/version_policy.rb b/version_policy.rb
index 5621ea43ff..a16e7ad500 100644
--- a/version_policy.rb
+++ b/version_policy.rb
@@ -21,6 +21,7 @@ OMNIBUS_OVERRIDES = {
## according to comment in omnibus-sw, latest versions don't work on solaris
# https://github.com/chef/omnibus-software/blob/aefb7e79d29ca746c3f843673ef5e317fa3cba54/config/software/libtool.rb#L23
:bundler => "1.12.5", # until we figure out how to work with 1.13.0
+ :rainbow => "2.1.0", # Currently pinned until rubygems is updated
"libffi" => "3.2.1",
"libiconv" => "1.14",
"liblzma" => "5.2.2",