summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.dockerignore2
-rw-r--r--.expeditor/config.yml82
-rwxr-xr-x.expeditor/update_dockerfile.sh8
-rwxr-xr-x[-rw-r--r--].expeditor/update_version.sh25
-rw-r--r--.github/CODEOWNERS4
-rw-r--r--.gitignore1
-rw-r--r--.rubocop.yml24
-rw-r--r--.travis.yml118
-rw-r--r--CHANGELOG.md262
-rw-r--r--CONTRIBUTING.md2
-rw-r--r--Dockerfile2
-rw-r--r--Gemfile11
-rw-r--r--Gemfile.lock114
-rw-r--r--HISTORY.md1362
-rw-r--r--MAINTAINERS.md3
-rw-r--r--MAINTAINERS.toml12
-rw-r--r--README.md8
-rw-r--r--RELEASE_NOTES.md551
-rw-r--r--Rakefile11
-rw-r--r--VERSION2
-rw-r--r--acceptance/Gemfile.lock2
-rw-r--r--acceptance/data-collector/.acceptance/data-collector-test/files/default/api.rb52
-rw-r--r--acceptance/data-collector/.acceptance/data-collector-test/recipes/default.rb6
-rw-r--r--appveyor.yml6
-rw-r--r--chef-config/lib/chef-config/version.rb2
-rw-r--r--kitchen-tests/.kitchen.travis.yml56
-rw-r--r--kitchen-tests/.kitchen.yml8
-rw-r--r--kitchen-tests/Berksfile5
-rw-r--r--kitchen-tests/Berksfile.lock55
-rw-r--r--kitchen-tests/cookbooks/base/Berksfile2
-rw-r--r--kitchen-tests/cookbooks/base/README.md4
-rw-r--r--kitchen-tests/cookbooks/base/metadata.rb11
-rw-r--r--kitchen-tests/cookbooks/base/recipes/default.rb15
-rw-r--r--kitchen-tests/cookbooks/base/recipes/packages.rb2
-rw-r--r--kitchen-tests/cookbooks/base/recipes/tests.rb2
-rw-r--r--kitchen-tests/cookbooks/webapp/Berksfile5
-rw-r--r--kitchen-tests/cookbooks/webapp/README.md3
-rw-r--r--kitchen-tests/cookbooks/webapp/attributes/default.rb14
-rw-r--r--kitchen-tests/cookbooks/webapp/metadata.rb12
-rw-r--r--kitchen-tests/cookbooks/webapp/recipes/default.rb64
-rw-r--r--kitchen-tests/cookbooks/webapp/templates/index.html.erb5
-rw-r--r--kitchen-tests/cookbooks/webapp/templates/index.php.erb8
-rw-r--r--kitchen-tests/data_bags/passwords/webapp.json4
-rw-r--r--kitchen-tests/test/fixtures/platforms/centos/5.json14
-rw-r--r--kitchen-tests/test/fixtures/platforms/centos/6.json14
-rw-r--r--kitchen-tests/test/fixtures/platforms/ubuntu/10.04.json14
-rw-r--r--kitchen-tests/test/fixtures/platforms/ubuntu/12.04.json14
-rw-r--r--kitchen-tests/test/fixtures/platforms/ubuntu/14.04.json14
-rw-r--r--kitchen-tests/test/fixtures/platforms/ubuntu/14.10.json14
-rw-r--r--kitchen-tests/test/fixtures/serverspec_helper.rb32
-rw-r--r--kitchen-tests/test/integration/webapp/default_spec.rb118
-rw-r--r--lib/chef/cookbook/metadata.rb4
-rw-r--r--lib/chef/deprecation/warnings.rb4
-rw-r--r--lib/chef/exceptions.rb2
-rw-r--r--lib/chef/http.rb19
-rw-r--r--lib/chef/http/api_versions.rb2
-rw-r--r--lib/chef/http/http_request.rb3
-rw-r--r--lib/chef/knife/core/bootstrap_context.rb1
-rw-r--r--lib/chef/knife/core/status_presenter.rb2
-rw-r--r--lib/chef/knife/core/ui.rb2
-rw-r--r--lib/chef/knife/search.rb2
-rw-r--r--lib/chef/knife/ssh.rb4
-rw-r--r--lib/chef/mash.rb6
-rw-r--r--lib/chef/mixin/deep_merge.rb2
-rw-r--r--lib/chef/mixin/user_context.rb52
-rw-r--r--lib/chef/node/attribute.rb94
-rw-r--r--lib/chef/node/immutable_collections.rb35
-rw-r--r--lib/chef/provider/apt_preference.rb94
-rw-r--r--lib/chef/provider/apt_repository.rb28
-rw-r--r--lib/chef/provider/apt_update.rb8
-rw-r--r--lib/chef/provider/execute.rb3
-rw-r--r--lib/chef/provider/git.rb23
-rw-r--r--lib/chef/provider/http_request.rb14
-rw-r--r--lib/chef/provider/ifconfig/redhat.rb4
-rw-r--r--lib/chef/provider/launchd.rb20
-rw-r--r--lib/chef/provider/package.rb15
-rw-r--r--lib/chef/provider/package/dnf.rb4
-rw-r--r--lib/chef/provider/package/dnf/dnf_helper.py1
-rw-r--r--lib/chef/provider/package/windows/registry_uninstall_entry.rb2
-rw-r--r--lib/chef/provider/package/zypper.rb10
-rw-r--r--lib/chef/provider/remote_file.rb19
-rw-r--r--lib/chef/provider/remote_file/fetcher.rb3
-rw-r--r--lib/chef/provider/remote_file/network_file.rb23
-rw-r--r--lib/chef/provider/route.rb33
-rw-r--r--lib/chef/provider/service/macosx.rb7
-rw-r--r--lib/chef/provider/service/systemd.rb23
-rw-r--r--lib/chef/provider/support/yum_repo.erb6
-rw-r--r--lib/chef/provider/support/zypper_repo.erb17
-rw-r--r--lib/chef/provider/systemd_unit.rb5
-rw-r--r--lib/chef/provider/windows_path.rb62
-rw-r--r--lib/chef/provider/windows_task.rb293
-rw-r--r--lib/chef/provider/yum_repository.rb2
-rw-r--r--lib/chef/provider/zypper_repository.rb81
-rw-r--r--lib/chef/providers.rb3
-rw-r--r--lib/chef/resource.rb6
-rw-r--r--lib/chef/resource/apt_package.rb2
-rw-r--r--lib/chef/resource/apt_preference.rb36
-rw-r--r--lib/chef/resource/apt_repository.rb4
-rw-r--r--lib/chef/resource/execute.rb14
-rw-r--r--lib/chef/resource/http_request.rb2
-rw-r--r--lib/chef/resource/ifconfig.rb36
-rw-r--r--lib/chef/resource/remote_file.rb60
-rw-r--r--lib/chef/resource/windows_path.rb41
-rw-r--r--lib/chef/resource/yum_repository.rb21
-rw-r--r--lib/chef/resource/zypper_repository.rb52
-rw-r--r--lib/chef/resources.rb3
-rw-r--r--lib/chef/search/query.rb7
-rw-r--r--lib/chef/server_api_versions.rb23
-rw-r--r--lib/chef/shell.rb1
-rw-r--r--lib/chef/shell/shell_session.rb8
-rw-r--r--lib/chef/util/dsc/local_configuration_manager.rb24
-rw-r--r--lib/chef/util/windows/logon_session.rb126
-rw-r--r--lib/chef/version.rb2
-rw-r--r--lib/chef/win32/api/file.rb1
-rw-r--r--lib/chef/win32/api/security.rb2
-rw-r--r--lib/chef/win32/file.rb2
-rw-r--r--lib/chef/win32/version.rb6
-rw-r--r--omnibus/Gemfile.lock75
-rw-r--r--omnibus/config/projects/chef.rb9
-rw-r--r--omnibus/resources/chef/ips/chef-symlinks.erb (renamed from omnibus/resources/chef/ips/symlinks.erb)0
-rw-r--r--omnibus_overrides.rb7
-rw-r--r--spec/functional/knife/ssh_spec.rb2
-rw-r--r--spec/functional/mixin/user_context_spec.rb117
-rw-r--r--spec/functional/resource/remote_file_spec.rb171
-rw-r--r--spec/functional/resource/windows_path_spec.rb64
-rw-r--r--spec/spec_helper.rb9
-rw-r--r--spec/unit/cookbook/metadata_spec.rb6
-rw-r--r--spec/unit/http/api_versions_spec.rb9
-rw-r--r--spec/unit/knife/bootstrap_spec.rb4
-rw-r--r--spec/unit/knife/client_delete_spec.rb2
-rw-r--r--spec/unit/knife/cookbook_show_spec.rb6
-rw-r--r--spec/unit/knife/ssh_spec.rb8
-rw-r--r--spec/unit/knife/status_spec.rb2
-rw-r--r--spec/unit/mixin/user_context_spec.rb109
-rw-r--r--spec/unit/node/immutable_collections_spec.rb16
-rw-r--r--spec/unit/node_spec.rb7
-rw-r--r--spec/unit/provider/apt_preference_spec.rb87
-rw-r--r--spec/unit/provider/apt_repository_spec.rb2
-rw-r--r--spec/unit/provider/dsc_resource_spec.rb4
-rw-r--r--spec/unit/provider/git_spec.rb55
-rw-r--r--spec/unit/provider/ifconfig/redhat_spec.rb8
-rw-r--r--spec/unit/provider/package/rubygems_spec.rb2
-rw-r--r--spec/unit/provider/package/windows/registry_uninstall_entry_spec.rb59
-rw-r--r--spec/unit/provider/package/windows_spec.rb2
-rw-r--r--spec/unit/provider/package/zypper_spec.rb43
-rw-r--r--spec/unit/provider/remote_file/fetcher_spec.rb1
-rw-r--r--spec/unit/provider/remote_file/network_file_spec.rb9
-rw-r--r--spec/unit/provider/route_spec.rb22
-rw-r--r--spec/unit/provider/service/macosx_spec.rb5
-rw-r--r--spec/unit/provider/service/systemd_service_spec.rb44
-rw-r--r--spec/unit/provider/systemd_unit_spec.rb83
-rw-r--r--spec/unit/provider/windows_path_spec.rb65
-rw-r--r--spec/unit/provider/windows_task_spec.rb153
-rw-r--r--spec/unit/resource/apt_preference_spec.rb49
-rw-r--r--spec/unit/resource/apt_repository_spec.rb24
-rw-r--r--spec/unit/resource/apt_update_spec.rb24
-rw-r--r--spec/unit/resource/execute_spec.rb22
-rw-r--r--spec/unit/resource/powershell_script_spec.rb4
-rw-r--r--spec/unit/resource/windows_path_spec.rb38
-rw-r--r--spec/unit/resource/zypper_repository_spec.rb65
-rw-r--r--spec/unit/resource_spec.rb8
-rw-r--r--spec/unit/search/query_spec.rb31
-rw-r--r--spec/unit/server_api_spec.rb75
-rw-r--r--spec/unit/server_api_versions_spec.rb22
-rw-r--r--spec/unit/shell/shell_session_spec.rb140
-rw-r--r--spec/unit/util/dsc/local_configuration_manager_spec.rb68
-rw-r--r--spec/unit/util/windows/logon_session_spec.rb284
-rw-r--r--spec/unit/win32/link_spec.rb73
-rw-r--r--tasks/changelog.rb37
-rw-r--r--tasks/dependencies.rb1
-rw-r--r--tasks/maintainers.rb6
-rw-r--r--tasks/version.rb41
172 files changed, 4200 insertions, 2776 deletions
diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 0000000000..d698ae021c
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1,2 @@
+# We don't want/need anything from the local system, so ignore everything.
+*
diff --git a/.expeditor/config.yml b/.expeditor/config.yml
index fcf7377c93..a64b2cbab0 100644
--- a/.expeditor/config.yml
+++ b/.expeditor/config.yml
@@ -1,31 +1,71 @@
-# The name of the product key for this product from mixlib-install
-product_key: chef
+# Documentation available at https://expeditor-docs.es.chef.io/
+
+# The name of the product keys for this product (from mixlib-install)
+product_key:
+ - chef
+ - angrychef
# Slack channel in Chef Software slack to send notifications about build failures, etc
slack:
notify_channel: chef-notify
-# When a version of ChefDK hits the current channel, build a corresponding Docker image
-# and publish that image to https://hub.docker.com/r/chef/chefdk
-docker:
- enable: true
- build_args:
- CHANNEL: "{{channel}}"
- VERSION: "{{version}}"
+# Which Ruby Gems, built when the Omnibus package is built, to publish to rubygems.org
+# This publish is triggered by the `built_in:publish_rubygems` artifact_action.
+rubygems:
+ - chef
+ - chef-config
github:
- # The file where the MAJOR.MINOR.PATCH version is kept
+ # The file where the MAJOR.MINOR.PATCH version is kept. The version in this file
+ # is bumped automatically via the `built_in:bump_version` merge_action.
version_file: "VERSION"
-
- # When a PR is merged, bump the PATCH version
- bump_version_on_merge: true
-
- # After the PATCH version has been bumped, execute this script
- # to distribute that version to other files in the repository.
- update_version_script: ".expeditor/update_version.sh"
-
- # The tag format Expeditor should use when tagging version commits
+ # The file where our CHANGELOG is kept. This file is updated automatically with
+ # details from the Pull Request via the `built_in:update_changelog` merge_action.
+ changelog_file: "CHANGELOG.md"
+ # The tag format to use (e.g. v1.0.0)
version_tag_format: "v{{version}}"
+ # The Github Team primarily responsible for handling incoming Pull Requests.
+ maintainer_group: chef/client-core
+ # Which Github branches to build Omnibus releases from, and what versions
+ # (as determined by the value in the VERSION file) those branches are responsible
+ # for building.
+ release_branch:
+ - master:
+ version_constraint: ~> 13.0
+ - chef-12:
+ version_constraint: ~> 12.0
+
+# These actions are taken, in order they are specified, anytime a Pull Request is merged.
+merge_actions:
+ - built_in:bump_version:
+ ignore_labels:
+ - "Version: Skip Bump"
+ - "Expeditor: Skip Version Bump"
+ - "Expeditor: Skip All"
+ - bash:.expeditor/update_version.sh:
+ only_if: built_in:bump_version
+ - built_in:update_changelog:
+ ignore_labels:
+ - "Meta: Exclude From Changelog"
+ - "Expeditor: Exclude From Changelog"
+ - "Expeditor: Skip All"
+ - built_in:trigger_omnibus_release_build:
+ ignore_labels:
+ - "Omnibus: Skip Build"
+ - "Expeditor: Skip Build"
+ - "Expeditor: Skip All"
+ only_if: built_in:bump_version
- # After the version is bumped and the tag is pushed to Github, trigger a Jenkins build
- trigger_build_on_bump: true
+# These actions are taken, in the order specified, when an Omnibus artifact is promoted
+# within Chef's internal artifact storage system.
+artifact_actions:
+ promoted_to_unstable:
+ - built_in:build_docker_image
+ promoted_to_current:
+ - built_in:tag_docker_image
+ promoted_to_stable:
+ - built_in:tag_docker_image
+ - built_in:publish_rubygems
+ - built_in:rollover_changelog
+ - bash:.expeditor/update_dockerfile.sh
+ - built_in:notify_chefio_slack_channels
diff --git a/.expeditor/update_dockerfile.sh b/.expeditor/update_dockerfile.sh
new file mode 100755
index 0000000000..9ae260fcb8
--- /dev/null
+++ b/.expeditor/update_dockerfile.sh
@@ -0,0 +1,8 @@
+#!/bin/sh
+#
+# This file updates the default VERSION build argument in the Dockerfile to the
+# VERSION passed in to the file via environment variables.
+
+set -evx
+
+sed -i -r "s/^ARG VERSION=.+/ARG VERSION=${VERSION}/" Dockerfile
diff --git a/.expeditor/update_version.sh b/.expeditor/update_version.sh
index 0dd9d0d65f..b2d76bc336 100644..100755
--- a/.expeditor/update_version.sh
+++ b/.expeditor/update_version.sh
@@ -6,28 +6,11 @@
set -evx
-# The github-changelog-generator requires that LANG be set
-export LANG=en_US.UTF-8
+sed -i -r "s/^(\s*)VERSION = \".+\"/\1VERSION = \"$(cat VERSION)\"/" chef-config/lib/chef-config/version.rb
+sed -i -r "s/VersionString\.new\(\".+\"\)/VersionString.new(\"$(cat VERSION)\")/" lib/chef/version.rb
-# Only install groups required to run the Rake command
-export BUNDLE_WITHOUT=omnibus_package:test:pry:integration:docgen:maintenance:travis:aix:bsd:linux:mac_os_x:solaris:windows:development
-
-# We need to run a bundle install so that our `bundle exec rake` command will work.
-gem environment
-omnibus_bundler=$(grep bundler omnibus_overrides.rb | cut -d'"' -f2)
-gem install bundler -v $omnibus_bundler --user-install --conservative
-bundle install
-
-# Run a rake command that will update various files in chef/chef-dk with the new VERSION
-bundle exec rake version:update
-
-# Run the following commands to update the changelog and dockerfile, but ignore errors.
-bundle exec rake changelog:update || true
-bundle exec rake update_dockerfile || true
-
-# Our `rake` command can sometimes modify this file, but we don't care about the
-# changes it makes. Reset it to HEAD.
-git checkout .bundle/config || true
+# Update the version inside Gemfile.lock
+bundle update chef chef-config
# Once Expeditor finshes executing this script, it will commit the changes and push
# the commit as a new tag corresponding to the value in the VERSION file.
diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS
new file mode 100644
index 0000000000..00e1134964
--- /dev/null
+++ b/.github/CODEOWNERS
@@ -0,0 +1,4 @@
+# Order is important. The last matching pattern has the most precedence.
+
+* @chef/client-maintainers
+.expeditor/** @chef/engineering-services
diff --git a/.gitignore b/.gitignore
index 846ffdcedd..eb3e9a59a2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -25,6 +25,7 @@ binstubs/
# IDE files
.project
+.idea
# Documentation
_site/*
diff --git a/.rubocop.yml b/.rubocop.yml
index 3c2a48e548..ec28184845 100644
--- a/.rubocop.yml
+++ b/.rubocop.yml
@@ -4,3 +4,27 @@ AllCops:
- "vendor/**/*"
- "pkg/**/*"
- "chef-config/pkg/**/*"
+Security/Eval:
+ Enabled: false
+Lint/UselessAssignment:
+ Enabled: false
+Lint/DeprecatedClassMethods:
+ Enabled: false
+Lint/ParenthesesAsGroupedExpression:
+ Enabled: false
+Lint/AmbiguousRegexpLiteral:
+ Enabled: false
+Lint/AssignmentInCondition:
+ Enabled: false
+Lint/AmbiguousBlockAssociation:
+ Enabled: false
+Lint/UnneededSplatExpansion:
+ Enabled: false
+Lint/ShadowingOuterLocalVariable:
+ Enabled: false
+Lint/EmptyWhen:
+ Enabled: false
+Lint/IneffectiveAccessModifier:
+ Enabled: false
+Lint/ShadowedException:
+ Enabled: false
diff --git a/.travis.yml b/.travis.yml
index e07a56dbbd..c4562a808e 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -31,25 +31,25 @@ env:
matrix:
include:
- - rvm: 2.3.3
+ - rvm: 2.3.5
sudo: true
script: sudo -E $(which bundle) exec rake spec;
# also remove integration / external tests
bundler_args: --without ci docgen guard integration maintenance omnibus_package --frozen
- - rvm: 2.4.1
+ - rvm: 2.4.2
sudo: true
script: sudo -E $(which bundle) exec rake spec;
# also remove integration / external tests
bundler_args: --without ci docgen guard integration maintenance omnibus_package --frozen
- env:
CHEFSTYLE: 1
- rvm: 2.4.1
+ rvm: 2.4.2
script: bundle exec rake style
# also remove integration / external tests
bundler_args: --without ci docgen guard integration maintenance omnibus_package --frozen
- env:
AUDIT_CHECK: 1
- rvm: 2.4.1
+ rvm: 2.4.2
script: bundle exec bundle-audit check --update
# also remove integration / external tests
bundler_args: --without ci docgen guard integration maintenance omnibus_package --frozen
@@ -59,39 +59,39 @@ matrix:
- env:
TEST_GEM: sethvargo/chef-sugar
script: bundle exec tasks/bin/run_external_test $TEST_GEM master rake
- rvm: 2.4.1
+ rvm: 2.4.2
- env:
PEDANT_OPTS: --skip-oc_id
TEST_GEM: chef/chef-zero
script: bundle exec tasks/bin/run_external_test $TEST_GEM master rake spec cheffs
- rvm: 2.4.1
+ rvm: 2.4.2
- env:
TEST_GEM: chef/cheffish
script: bundle exec tasks/bin/run_external_test $TEST_GEM master rake spec
- rvm: 2.4.1
+ rvm: 2.4.2
- env:
TEST_GEM: chefspec/chefspec
script: bundle exec tasks/bin/run_external_test $TEST_GEM master rake
- rvm: 2.4.1
+ rvm: 2.4.2
- env:
TEST_GEM: foodcritic/foodcritic
script: bundle exec tasks/bin/run_external_test $TEST_GEM master rake test
- rvm: 2.4.1
+ rvm: 2.4.2
- env:
TEST_GEM: poise/halite
script: bundle exec tasks/bin/run_external_test $TEST_GEM master rake spec
- rvm: 2.4.1
+ rvm: 2.4.2
- env:
TEST_GEM: chef/knife-windows
script: bundle exec tasks/bin/run_external_test $TEST_GEM master rake unit_spec
- rvm: 2.4.1
+ rvm: 2.4.2
- env:
TEST_GEM: poise/poise
script: bundle exec tasks/bin/run_external_test $TEST_GEM master rake spec
- rvm: 2.4.1
+ rvm: 2.4.2
### START TEST KITCHEN ONLY ###
#
- - rvm: 2.4.1
+ - rvm: 2.4.2
services: docker
sudo: required
gemfile: kitchen-tests/Gemfile
@@ -103,13 +103,13 @@ matrix:
- sudo iptables -L DOCKER || ( echo "DOCKER iptables chain missing" ; sudo iptables -N DOCKER )
- cd kitchen-tests
script:
- - bundle exec kitchen test webapp-ubuntu-1404
+ - bundle exec kitchen test base-ubuntu-1404
after_failure:
- cat .kitchen/logs/kitchen.log
env:
- UBUNTU=14.04
- KITCHEN_YAML=.kitchen.travis.yml
- - rvm: 2.4.1
+ - rvm: 2.4.2
services: docker
sudo: required
gemfile: kitchen-tests/Gemfile
@@ -121,13 +121,13 @@ matrix:
- sudo iptables -L DOCKER || ( echo "DOCKER iptables chain missing" ; sudo iptables -N DOCKER )
- cd kitchen-tests
script:
- - bundle exec kitchen test webapp-ubuntu-1604
+ - bundle exec kitchen test base-ubuntu-1604
after_failure:
- cat .kitchen/logs/kitchen.log
env:
- UBUNTU=16.04
- KITCHEN_YAML=.kitchen.travis.yml
- - rvm: 2.4.1
+ - rvm: 2.4.2
services: docker
sudo: required
gemfile: kitchen-tests/Gemfile
@@ -139,13 +139,13 @@ matrix:
- sudo iptables -L DOCKER || ( echo "DOCKER iptables chain missing" ; sudo iptables -N DOCKER )
- cd kitchen-tests
script:
- - bundle exec kitchen test webapp-debian-7
+ - bundle exec kitchen test base-debian-7
after_failure:
- cat .kitchen/logs/kitchen.log
env:
- DEBIAN=7
- KITCHEN_YAML=.kitchen.travis.yml
- - rvm: 2.4.1
+ - rvm: 2.4.2
services: docker
sudo: required
gemfile: kitchen-tests/Gemfile
@@ -157,13 +157,13 @@ matrix:
- sudo iptables -L DOCKER || ( echo "DOCKER iptables chain missing" ; sudo iptables -N DOCKER )
- cd kitchen-tests
script:
- - bundle exec kitchen test webapp-debian-8
+ - bundle exec kitchen test base-debian-8
after_failure:
- cat .kitchen/logs/kitchen.log
env:
- DEBIAN=8
- KITCHEN_YAML=.kitchen.travis.yml
- - rvm: 2.4.1
+ - rvm: 2.4.2
services: docker
sudo: required
gemfile: kitchen-tests/Gemfile
@@ -175,13 +175,31 @@ matrix:
- sudo iptables -L DOCKER || ( echo "DOCKER iptables chain missing" ; sudo iptables -N DOCKER )
- cd kitchen-tests
script:
- - bundle exec kitchen test webapp-centos-6
+ - bundle exec kitchen test base-debian-9
+ after_failure:
+ - cat .kitchen/logs/kitchen.log
+ env:
+ - DEBIAN=9
+ - 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-centos-6
after_failure:
- cat .kitchen/logs/kitchen.log
env:
- CENTOS=6
- KITCHEN_YAML=.kitchen.travis.yml
- - rvm: 2.4.1
+ - rvm: 2.4.2
services: docker
sudo: required
gemfile: kitchen-tests/Gemfile
@@ -193,13 +211,13 @@ matrix:
- sudo iptables -L DOCKER || ( echo "DOCKER iptables chain missing" ; sudo iptables -N DOCKER )
- cd kitchen-tests
script:
- - bundle exec kitchen test webapp-centos-7
+ - bundle exec kitchen test base-centos-7
after_failure:
- cat .kitchen/logs/kitchen.log
env:
- CENTOS=7
- KITCHEN_YAML=.kitchen.travis.yml
-# - rvm: 2.4.1
+# - rvm: 2.4.2
# services: docker
# sudo: required
# gemfile: kitchen-tests/Gemfile
@@ -211,31 +229,31 @@ matrix:
# - sudo iptables -L DOCKER || ( echo "DOCKER iptables chain missing" ; sudo iptables -N DOCKER )
# - cd kitchen-tests
# script:
-# - bundle exec kitchen test webapp-fedora-latest
+# - 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.1
- 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 webapp-amazonlinux
- after_failure:
- - cat .kitchen/logs/kitchen.log
- env:
- - AMAZONLINUX=LATEST
- - KITCHEN_YAML=.kitchen.travis.yml
-# - rvm: 2.4.1
+# - 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
@@ -253,7 +271,7 @@ matrix:
# env:
# - AWESOME_CUSTOMERS_UBUNTU=1
# - KITCHEN_YAML=.kitchen.travis.yml
-# - rvm: 2.4.1
+# - rvm: 2.4.2
# services: docker
# sudo: required
# gemfile: kitchen-tests/Gemfile
@@ -272,7 +290,7 @@ matrix:
# - AWESOME_CUSTOMERS_RHEL=1
# - KITCHEN_YAML=.kitchen.travis.yml
# ### END TEST KITCHEN ONLY ###
- - rvm: 2.4.1
+ - rvm: 2.4.2
sudo: required
before_install:
- gem update --system $(grep rubygems omnibus_overrides.rb | cut -d'"' -f2)
@@ -292,7 +310,7 @@ matrix:
- sudo cat /var/log/squid3/cache.log
- sudo cat /var/log/squid3/access.log
allow_failures:
- - rvm: 2.4.1
+ - rvm: 2.4.2
services: docker
sudo: required
gemfile: kitchen-tests/Gemfile
@@ -304,7 +322,7 @@ matrix:
- sudo iptables -L DOCKER || ( echo "DOCKER iptables chain missing" ; sudo iptables -N DOCKER )
- cd kitchen-tests
script:
- - travis_wait bundle exec kitchen test webapp-amazonlinux
+ - travis_wait bundle exec kitchen test base-amazonlinux
after_failure:
- cat .kitchen/logs/kitchen.log
env:
@@ -316,7 +334,7 @@ matrix:
- env:
TEST_GEM: chef/knife-windows
script: bundle exec tasks/bin/run_external_test $TEST_GEM master rake unit_spec
- rvm: 2.4.1
+ rvm: 2.4.2
notifications:
on_change: true
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 29273512e2..04e681fb36 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,35 +1,247 @@
-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).
+<!-- usage documentation: http://expeditor-docs.es.chef.io/configuration/changelog/ -->
+<!-- latest_release 13.4.33 -->
+## [v13.4.33](https://github.com/chef/chef/tree/v13.4.33) (2017-09-25)
+
+#### Merged Pull Requests
+- update expeditor labels [#6432](https://github.com/chef/chef/pull/6432) ([thommay](https://github.com/thommay))
+<!-- latest_release -->
+
+<!-- release_rollup since=13.4.24 -->
+### Changes since 13.4.24 release
+
+#### Merged Pull Requests
+- update expeditor labels [#6432](https://github.com/chef/chef/pull/6432) ([thommay](https://github.com/thommay)) <!-- 13.4.33 -->
+- Fix Knife search ID only option to actually filter result set [#6438](https://github.com/chef/chef/pull/6438) ([dimsh99](https://github.com/dimsh99)) <!-- 13.4.32 -->
+- Add throttle and metalink options to yum_repository [#6431](https://github.com/chef/chef/pull/6431) ([tas50](https://github.com/tas50)) <!-- 13.4.31 -->
+- Update dokken integration testing: dokken images, updated cookbook, debian 9 [#6414](https://github.com/chef/chef/pull/6414) ([tas50](https://github.com/tas50)) <!-- 13.4.30 -->
+- Don&#39;t catch SIGCHLD from dnf_helper.py [#6416](https://github.com/chef/chef/pull/6416) ([nemith](https://github.com/nemith)) <!-- 13.4.29 -->
+- Open apt resources up to prevent breaking change [#6417](https://github.com/chef/chef/pull/6417) ([tas50](https://github.com/tas50)) <!-- 13.4.28 -->
+- Remove unused requires in yum_repository [#6413](https://github.com/chef/chef/pull/6413) ([tas50](https://github.com/tas50)) <!-- 13.4.27 -->
+- Quiet the output of the zypper refresh and add force [#6408](https://github.com/chef/chef/pull/6408) ([tas50](https://github.com/tas50)) <!-- 13.4.26 -->
+- Replace which apt-get check with simple debian check in apt resources [#6409](https://github.com/chef/chef/pull/6409) ([tas50](https://github.com/tas50)) <!-- 13.4.25 -->
+<!-- release_rollup -->
+
+<!-- latest_stable_release -->
+## [v13.4.24](https://github.com/chef/chef/tree/v13.4.24) (2017-09-14)
+
+#### Merged Pull Requests
+- MSYS-656 - fixed dsc_script for WMF5 [#6383](https://github.com/chef/chef/pull/6383) ([piyushawasthi](https://github.com/piyushawasthi))
+- [MSYS-594] windows_task resource is not idempotent when specifying start_time and start_day [#6312](https://github.com/chef/chef/pull/6312) ([harikesh-kolekar](https://github.com/harikesh-kolekar))
+- Allow specifying default gateway on RHEL/Centos [#6386](https://github.com/chef/chef/pull/6386) ([tomdoherty](https://github.com/tomdoherty))
+- Use ruby 2.4.2 to addess multiple security vulnerabilities [#6404](https://github.com/chef/chef/pull/6404) ([thommay](https://github.com/thommay))
+<!-- latest_stable_release -->
+
+## [v13.4.19](https://github.com/chef/chef/tree/v13.4.19) (2017-09-13)
+
+#### Bug Fixes
+- Ignore validation errors in Resource#to_text [#6331](https://github.com/chef/chef/pull/6331) ([coderanger](https://github.com/coderanger))
+- Auto import gpg keys in zypper_repository [#6348](https://github.com/chef/chef/pull/6348) ([tas50](https://github.com/tas50))
+- Handle apple's git in the git resource [#6359](https://github.com/chef/chef/pull/6359) ([kzw](https://github.com/kzw))
+- Launchd should not load launchagents as root. [#6353](https://github.com/chef/chef/pull/6353) ([mikedodge04](https://github.com/mikedodge04))
+- Pass json configuration to ShellSession class [#6314](https://github.com/chef/chef/pull/6314) ([btm](https://github.com/btm))
+
+#### Merged Pull Requests
+- Add windows_path resource from the Windows cookbook [#6295](https://github.com/chef/chef/pull/6295) ([NimishaS](https://github.com/NimishaS))
+- Bump Bundler version to 1.15.4 [#6349](https://github.com/chef/chef/pull/6349) ([jakauppila](https://github.com/jakauppila))
+- dnf_provider: be more specific when we provide `package` [#6351](https://github.com/chef/chef/pull/6351) ([jaymzh](https://github.com/jaymzh))
+- Speed up immutabilization [#6355](https://github.com/chef/chef/pull/6355) ([lamont-granquist](https://github.com/lamont-granquist))
+- node attributes: remove useless dup in merge_all [#6356](https://github.com/chef/chef/pull/6356) ([lamont-granquist](https://github.com/lamont-granquist))
+- Link to the knife docs in both places where we error on editor [#6363](https://github.com/chef/chef/pull/6363) ([tas50](https://github.com/tas50))
+- Bump rubygems to 2.6.13 [#6365](https://github.com/chef/chef/pull/6365) ([lamont-granquist](https://github.com/lamont-granquist))
+- Ship chef-vault in the omnibus package [#6370](https://github.com/chef/chef/pull/6370) ([thommay](https://github.com/thommay))
+- Support an array of keys for apt_repository [#6372](https://github.com/chef/chef/pull/6372) ([gsreynolds](https://github.com/gsreynolds))
+- Immutablize properly as we deep merge [#6362](https://github.com/chef/chef/pull/6362) ([lamont-granquist](https://github.com/lamont-granquist))
+- Alternate user local logon authentication for remote_file resource [#5832](https://github.com/chef/chef/pull/5832) ([NimishaS](https://github.com/NimishaS))
+- Add support for specifying ETHTOOL_OPTS in the ifconfig resource [#6384](https://github.com/chef/chef/pull/6384) ([tomdoherty](https://github.com/tomdoherty))
+- Cleanup the current changelog [#6387](https://github.com/chef/chef/pull/6387) ([tas50](https://github.com/tas50))
+
+## [v13.3.42](https://github.com/chef/chef/tree/v13.3.42) (2017-08-16)
+
+#### Merged Pull Requests
+- Update Expeditor config to use new Merge and Artifact Actions [#6287](https://github.com/chef/chef/pull/6287) ([tduffield](https://github.com/tduffield))
+- Apt: Add apt_preference resource from apt cookbooks [#5529](https://github.com/chef/chef/pull/5529) ([tas50](https://github.com/tas50))
+- Fix typos [#6298](https://github.com/chef/chef/pull/6298) ([akitada](https://github.com/akitada))
+- Set explicit page size for every search request [#6299](https://github.com/chef/chef/pull/6299) ([stevendanna](https://github.com/stevendanna))
+- Add .dockerignore to reduce size of resulting images [#6296](https://github.com/chef/chef/pull/6296) ([tduffield](https://github.com/tduffield))
+- Fix git command in DCO sign-off example [#6306](https://github.com/chef/chef/pull/6306) ([edmorley](https://github.com/edmorley))
+- add option to enable unprivileged symlink creation on windows [#6236](https://github.com/chef/chef/pull/6236) ([svmastersamurai](https://github.com/svmastersamurai))
+- Bump omnibus-software version [#6310](https://github.com/chef/chef/pull/6310) ([thommay](https://github.com/thommay))
+- throw readable errors if multiple dsc resources are found [#6307](https://github.com/chef/chef/pull/6307) ([Happycoil](https://github.com/Happycoil))
+- Add zypper_repository resource [#5948](https://github.com/chef/chef/pull/5948) ([tas50](https://github.com/tas50))
+- Pull in Ohai 13.3 [#6319](https://github.com/chef/chef/pull/6319) ([tas50](https://github.com/tas50))
+- Maintain compat with old zypper_repo resource used in cookbooks [#6318](https://github.com/chef/chef/pull/6318) ([tas50](https://github.com/tas50))
+- README improvement for Chef beginner. [#6297](https://github.com/chef/chef/pull/6297) ([takaya-fuj19](https://github.com/takaya-fuj19))
+- Bump InSpec to v1.33.1 [#6324](https://github.com/chef/chef/pull/6324) ([adamleff](https://github.com/adamleff))
+
+
+## [v13.3.27](https://github.com/chef/chef/tree/v13.3.27) (2017-07-26)
+[Full Changelog](https://github.com/chef/chef/compare/v13.0.118...v13.3.27)
+
+- Added username/password validation for elevated option [\#6293](https://github.com/chef/chef/pull/6293) ([NimishaS](https://github.com/NimishaS))
+- Bump mixlib-shellout for \#6271 [\#6285](https://github.com/chef/chef/pull/6285) ([btm](https://github.com/btm))
+- Use new Expeditor config format [\#6272](https://github.com/chef/chef/pull/6272) ([tduffield](https://github.com/tduffield))
+- Added :elevated option for powershell\_script resource [\#6271](https://github.com/chef/chef/pull/6271) ([NimishaS](https://github.com/NimishaS))
+- Make mount idempotent on Aix [\#6213](https://github.com/chef/chef/pull/6213) ([NAshwini](https://github.com/NAshwini))
+- Allow windows\_task create action to update tasks. [\#6193](https://github.com/chef/chef/pull/6193) ([harikesh-kolekar](https://github.com/harikesh-kolekar))
+- Use socketless local mode by default [\#6177](https://github.com/chef/chef/pull/6177) ([coderanger](https://github.com/coderanger))
+- convert breakpoint resource to a custom resource [\#6176](https://github.com/chef/chef/pull/6176) ([lamont-granquist](https://github.com/lamont-granquist))
+- Make non-legacy solo use socketless mode [\#6174](https://github.com/chef/chef/pull/6174) ([coderanger](https://github.com/coderanger))
+- Prefer Systemd with sysvinit script over Upstart for service provider [\#6157](https://github.com/chef/chef/pull/6157) ([shortdudey123](https://github.com/shortdudey123))
-## [v13.3.1](https://github.com/chef/chef/tree/v13.3.1) (2017-07-06)
-[Full Changelog](https://github.com/chef/chef/compare/v13.0.118...v13.3.1)
+## v13.0.118 (2017-04-12)
+
+- Fix Gems won't install on Windows with Chef 13
+- Fix yum_package options option broken in Chef 13
+- Fix cookbooks uploaded by Chef 13 can't be used by Chef 12
+- Update Ohai to 13.0.1 to fix the OpenStack and Eucalyptus plugins
+
+## v13.0.113 (2017-04-06)
+
+- Use Ohai 13.0
+- Add new server enforced required recipe feature
+- shell_out PATH fixes and path_sanity changes
+- Remove magic from the logger/formatter settings
+- Add new windows_task resource
+- Better solution to gem_package source issues
+- Remove the knife cookbook create command in favor of Chef-DK
+- Remove need to define use_inline_resources and always enable inline resources
+- RFC 59 - Load ohai plugins
+- Use new lzma lib
+- Have knife cookbook generate use SPDX standard license strings
+- Implement RFC033: Root aliases
+- Ensure DataBagItems are a Mash
+- Add InSpec to chef omnibus builds
+- Remove knife cookbook site vendor
+- Make Standardized Exit Codes The Default Behavior
+- Tweaks to rubygems source option for urls
+- Allow lazy{} to be used in template resource variables.
+- Freeze property defaults
+- fix knife ssh --exit-on-error
+- Add -u param to usermod in linux_user resource when using non_unique
+- Launchd limit_load_to_session_type accepts Array or String
+- Remove the consts for DSL-based resources/providers
+- Add real support for rb files (at least roles) in knife-serve
+- Adding restart action to launchd resource
+- systemd_unit verifier escape hatch
+- Ensure we check all required fields
+- V2 Cookbook Manifests
+- Fix and simplify rake bundle:* commands
+- Expand the system info displayed on error to give us some more data to work with when helping users
+- Add policy_name and policy_group indexes to converge message sent to ...
+- Turn on zypper gpg checks by default
+- Knife search exit 1 when no results
+- Remove deprecated knife subcommand APIs
+- Coerce package options property to an Array
+- Fix cookbook gem installer
+- Remove iconv from the chef build
+- Remove deprecated Chef::ResourceResolver.resource API
+- Fix notifying array resources
+- Remove deprecated run_command API entirely
+- Apply knife search node fuzzifier to knife ssh
+- Remove Chef::Resource.updated=
+- Remove deprecated launchd resource hash property
+- Remove more deprecated method_missing access
+- Support nameless resources and remove deprecated multi-arg resources
+- bumping acceptance gems
+- Set default guard_interpreter to powershell_script on Windows
+- Remove more deprecated provider_resolver code
+- Make ActionClass a class
+- Don't include nokogiri gem as it doesn't compile on Windows right now
+- Retry API requests if using an unsupported version
+- Bump _XOPEN_SOURCE to 600 for ruby 2.4 on Solaris
+- Upgrade Ruby to the 2.4.1 release
+- Fix action class weirdness in Chef-13
+- Make ResourceReporter smarter to get resource identity and state
+- Don't `rescue Exception` in retryable resources
+- Simplify DSL creation
+- Remove deprecated Chef::Client attrs
+- Remove method_missing from the DSL
+- Remove support for the sort option to searches.
+- smf_recursive_dependencies: Allow solaris services to start recursively.
+- Fix for creating users in non english windows machines
+- Remove node_map back-compat
+- Fix chef-shell option name and help message
+- Remove Chef::ShellOut
+- Remove deprecated run_context methods
+- Remove old platform mapping code
+- Remove the old rake tasks
+- Properly use chef-shell in SoloSession by deprecating old behavior into SoloLegacySession
+- Raise on properties redefining inherited methods
+- Optimize cheffs
+- Remove Chef::REST
+- Fix node#debug_value access through arrays
+- Nillable properties
+- Freeze merged node attribute
+- Properly deep dup Node#to_hash
+- Add release policy badge to README
+- Remove the deprecated easy_install resource
+- Remove declare_resource create_if_missing API
+- Kill JSON auto inflate with fire
+- Remove method_missing access to node object.
+- Cleanup of Chef::Resource
+- Add attribute blacklist
+- Enable why-run by default in resources
+- Ensure that there are no pesky // in our paths
+- Compress debs and rpms with xz
+- Fix apt_repository for Ubuntu 16.10+
+- Remove all Chef 11 era deprecations
+- Remove partial_search methods
+- Use v3 data bag encryption
+- Remove %{file} from verify interpolation
+- Revert "Remove all 11 era deprecations"
+- Convert additional resource methods to properties
+- Remove backcompat classes
+- Remove provisioning from the downstream tests
+- Remove supports API from Chef::Resource
+- Be a bit less keen to help properties
+- Add an option for gateway_identity_file that will allow key-based authentication on the gateway.
+- Mac: Validate that a machine has a computer level profile
+- Verify data bag exists before trying to create it in knife
+- Remove resource cloning and 3694 warnings
+- HTTP: add debug long for non-JSON response
+
+
+## [v12.21.4](https://github.com/chef/chef/tree/v12.21.4) (2017-08-14)
+[Full Changelog](https://github.com/chef/chef/compare/v12.21.3...v12.21.4)
-**Closed issues:**
+**Fixed bugs:**
+- Backport #5941 (Make ResourceReporter smarter to get resource identity and state) [\#6308](https://github.com/chef/chef/pull/6308)
-- Chomp errors when using Chocolatey provider [\#6165](https://github.com/chef/chef/issues/6165)
+**Tech cleanup:**
+- Bump omnibus-software to fix early Rubygems segfaults on Windows [\#6329](https://github.com/chef/chef/pull/6329)
+- Upgrade Ruby from 2.3.1 to 2.3.4
+- Upgrade libiconv from 1.14 to 1.15
+- Upgrade Rubygems from 2.6.10 to 2.6.12
-**Merged pull requests:**
+## [v12.21.3](https://github.com/chef/chef/tree/v12.21.3) (2017-06-23)
+[Full Changelog](https://github.com/chef/chef/compare/v12.21.1...v12.21.3)
-- \[MSYS-590\]Make mount idempotent on Aix [\#6213](https://github.com/chef/chef/pull/6213) ([NAshwini](https://github.com/NAshwini))
-- Use socketless local mode by default [\#6177](https://github.com/chef/chef/pull/6177) ([coderanger](https://github.com/coderanger))
-- convert breakpoint resource to a custom resource [\#6176](https://github.com/chef/chef/pull/6176) ([lamont-granquist](https://github.com/lamont-granquist))
-- Make non-legacy solo use socketless mode [\#6174](https://github.com/chef/chef/pull/6174) ([coderanger](https://github.com/coderanger))
-- Prefer Systemd with sysvinit script over Upstart for service provider [\#6157](https://github.com/chef/chef/pull/6157) ([shortdudey123](https://github.com/shortdudey123))
-- Prefer Systemd with sysvinit script over Upstart for service provider [\#6156](https://github.com/chef/chef/pull/6156) ([shortdudey123](https://github.com/shortdudey123))
-- Ensure that we check the embedded gem binary last [\#6154](https://github.com/chef/chef/pull/6154) ([thommay](https://github.com/thommay))
-- \[MSYS-563\] Modified error message to explain connectivity issue due to Proxy [\#6142](https://github.com/chef/chef/pull/6142) ([NimishaS](https://github.com/NimishaS))
-- Fixing broken functional test in windows\_task resource [\#6139](https://github.com/chef/chef/pull/6139) ([NimishaS](https://github.com/NimishaS))
-- Discard caches for files not in the manifest [\#6129](https://github.com/chef/chef/pull/6129) ([akitada](https://github.com/akitada))
-- User on Windows with group incorrectly warns about passing GID [\#6125](https://github.com/chef/chef/pull/6125) ([harikesh-kolekar](https://github.com/harikesh-kolekar))
-- reconfigure between runs when running in a loop [\#6122](https://github.com/chef/chef/pull/6122) ([btm](https://github.com/btm))
+**Fixed bugs:**
+- Properly send expanded run list event for policy file nodes [\#6229](https://github.com/chef/chef/pull/6229) / [\#6233](https://github.com/chef/chef/pull/6233)
-## [v12.19.33](https://github.com/chef/chef/tree/v12.19.33) (2017-02-16)
-[Full Changelog](https://github.com/chef/chef/compare/v12.18.31...v12.19.33)
+## [v12.21.1](https://github.com/chef/chef/tree/v12.21.1) (2017-06-20)
+[Full Changelog](https://github.com/chef/chef/compare/v12.21.0...v12.21.1)
-**Closed issues:**
+- Handle the supports pseudo-property more gracefully [\#6222](https://github.com/chef/chef/pull/6222) ([coderanger](https://github.com/coderanger))
+- Provide better system information when Chef crashes [\#6173](https://github.com/chef/chef/pull/6173) ([coderanger](https://github.com/coderanger))
+- On Debian based systems, correctly prefer Systemd to Upstart [\#6157](https://github.com/chef/chef/pull/6157) ([shortdudey123](https://github.com/shortdudey123))
+- Don't crash if we downgrade from Chef 13 to Chef 12 [\#6129](https://github.com/chef/chef/pull/6129) ([akitada](https://github.com/akitada))
+- Update zlib to 1.2.11 to resolve CVEs [#6219](https://github.com/chef/chef/pull/6219) ([thommay](https://github.com/thommay))
+- Update Ohai to 8.24 with improved EC2 metadata handling, dmi code fixes, and scala/lua detection fixes
-- Package resource fails chefspec on RHEL starting with Chef 12.18. [\#5769](https://github.com/chef/chef/issues/5769)
+## v12.20.3 (2017-04-30)
-**Merged pull requests:**
+- Add the ability to define a server enforced required recipe[#6032](https://github.com/chef/chef/pull/6032)([sdelano](https://github.com/sdelano))
+- Fix apt_repository key fingerprint for Ubuntu 16.10+
+- Verify if a databag exists before we try to create it with knife
+- Bump json, winrm, plist, and net-ssh gems to the latest [#6106](https://github.com/chef/chef/pull/6106) ([rhass](https://github.com/rhass))
+
+## v12.19.36 (2017-02-23)
+
+- Use shellsplit for apt_package options [#5838](https://github.com/chef/chef/pull/5838) ([mivok](https://github.com/mivok))
+
+## [v12.19.33](https://github.com/chef/chef/tree/v12.19.33) (2017-02-16)
+[Full Changelog](https://github.com/chef/chef/compare/v12.18.31...v12.19.33)
- coerce immutable arrays to normal arrays in the yum\_package resource [\#5816](https://github.com/chef/chef/pull/5816) ([lamont-granquist](https://github.com/lamont-granquist))
- Suppress sensitive properties from resource log and reporting output [\#5803](https://github.com/chef/chef/pull/5803) ([tduffield](https://github.com/tduffield))
@@ -1383,6 +1595,4 @@ of partial templates.
* Fixed a bug where nested resources that inherited from Resource::LWRPBase
would not share the same actions/default_action as their parent
* Raise error if a guard_interpreter is specified and a block is passed to a guard (conditional)
-* Allow specifying a guard_interpreter after a conditional on a resource (Fixes #1943)
-
-\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)* \ No newline at end of file
+* Allow specifying a guard_interpreter after a conditional on a resource (Fixes #1943) \ No newline at end of file
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 1f197360f5..723c7e0ec8 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -90,7 +90,7 @@ The DCO requires a sign-off message in the following format appear on each commi
Signed-off-by: Julia Child <juliachild@chef.io>
```
-The DCO text can either be manually added to your commit body, or you can add either **-s** or **--signoff** to your usual git commit commands. If you forget to add the sign-off you can also amend a previous commit with the sign-off by running **git commit –-amend -s**. If you've pushed your changes to Github already you'll need to force push your branch after this with **git push -f**.
+The DCO text can either be manually added to your commit body, or you can add either **-s** or **--signoff** to your usual git commit commands. If you forget to add the sign-off you can also amend a previous commit with the sign-off by running **git commit --amend -s**. If you've pushed your changes to Github already you'll need to force push your branch after this with **git push -f**.
### Chef Obvious Fix Policy
diff --git a/Dockerfile b/Dockerfile
index 4befc17d39..2e32d2e452 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -2,7 +2,7 @@ FROM busybox
MAINTAINER Chef Software, Inc. <docker@chef.io>
ARG CHANNEL=stable
-ARG VERSION=13.2.20
+ARG VERSION=13.4.24
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 b/Gemfile
index d488d8b01a..14b67daf94 100644
--- a/Gemfile
+++ b/Gemfile
@@ -16,8 +16,7 @@ group(:omnibus_package) do
gem "appbundler"
gem "rb-readline"
gem "inspec"
- # nokogiri has no ruby-2.4 version for windows so it cannot go into our Gemfile.lock
- # gem "nokogiri", ">= 1.7.1"
+ gem "chef-vault"
end
group(:omnibus_package, :pry) do
@@ -31,7 +30,7 @@ group(:docgen) do
gem "yard"
end
-group(:maintenance, :ci) do
+group(:maintenance) do
gem "tomlrb"
# To sync maintainers with github
@@ -52,17 +51,13 @@ end
group(:development, :test) do
gem "rake"
gem "simplecov"
+ gem "webmock"
# for testing new chefstyle rules
# gem 'chefstyle', github: 'chef/chefstyle'
gem "chefstyle", git: "https://github.com/chef/chefstyle.git", branch: "master"
end
-group(:ci) do
- gem "github_changelog_generator", git: "https://github.com/chef/github-changelog-generator"
- gem "mixlib-install"
-end
-
group(:travis) do
# See `bundler-audit` in .travis.yml
gem "bundler-audit", git: "https://github.com/rubysec/bundler-audit.git"
diff --git a/Gemfile.lock b/Gemfile.lock
index 757efb6524..5f086dceea 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -1,39 +1,26 @@
GIT
remote: https://github.com/chef/chefstyle.git
- revision: e6b966a18dc4a12b4dfa49ccb911dad7432ca4fd
+ revision: 4f1a175179965d53b9f2a068f2ea4c59090454a1
branch: master
specs:
chefstyle (0.6.0)
rubocop (= 0.49.1)
GIT
- remote: https://github.com/chef/github-changelog-generator
- revision: 7ab4953b47598dccf10e106058673c1592b8f9bf
- specs:
- github_changelog_generator (1.14.2)
- activesupport
- faraday-http-cache
- multi_json
- octokit (~> 4.6)
- rainbow (>= 2.1)
- rake (>= 10.0)
- retriable (>= 1.4)
-
-GIT
remote: https://github.com/rubysec/bundler-audit.git
- revision: 6eb5a81e9b184fbb8db03f3e57dc758c65dd7383
+ revision: 6e2e298aebb0707a1b62c08c005335ecd130aa66
specs:
- bundler-audit (0.5.0)
+ bundler-audit (0.6.0)
bundler (~> 1.2)
thor (~> 0.18)
PATH
remote: .
specs:
- chef (13.3.1)
+ chef (13.4.33)
addressable
bundler (>= 1.10)
- chef-config (= 13.3.1)
+ chef-config (= 13.4.33)
chef-zero (>= 13.0)
diff-lcs (~> 1.2, >= 1.2.4)
erubis (~> 2.7)
@@ -60,10 +47,10 @@ PATH
specinfra (~> 2.10)
syslog-logger (~> 1.6)
uuidtools (~> 2.1.5)
- chef (13.3.1-universal-mingw32)
+ chef (13.4.33-universal-mingw32)
addressable
bundler (>= 1.10)
- chef-config (= 13.3.1)
+ chef-config (= 13.4.33)
chef-zero (>= 13.0)
diff-lcs (~> 1.2, >= 1.2.4)
erubis (~> 2.7)
@@ -105,7 +92,7 @@ PATH
PATH
remote: chef-config
specs:
- chef-config (13.3.1)
+ chef-config (13.4.33)
addressable
fuzzyurl
mixlib-config (~> 2.0)
@@ -114,11 +101,6 @@ PATH
GEM
remote: https://rubygems.org/
specs:
- activesupport (5.1.2)
- concurrent-ruby (~> 1.0, >= 1.0.2)
- i18n (~> 0.7)
- minitest (~> 5.1)
- tzinfo (~> 1.1)
addressable (2.4.0)
appbundler (0.10.0)
mixlib-cli (~> 1.4)
@@ -128,8 +110,9 @@ GEM
debug_inspector (>= 0.0.1)
blankslate (2.1.2.4)
builder (3.2.3)
- byebug (9.0.6)
- chef-zero (13.0.0)
+ byebug (9.1.0)
+ chef-vault (3.3.0)
+ chef-zero (13.1.0)
ffi-yajl (~> 2.2)
hashie (>= 2.0, < 4.0)
mixlib-log (~> 1.3)
@@ -139,7 +122,8 @@ GEM
chef-zero (~> 13.0)
net-ssh
coderay (1.1.1)
- concurrent-ruby (1.0.5)
+ crack (0.4.3)
+ safe_yaml (~> 1.0.0)
debug_inspector (0.0.3)
diff-lcs (1.3)
docile (1.1.5)
@@ -149,12 +133,10 @@ GEM
erubis (2.7.0)
ethon (0.10.1)
ffi (>= 1.3.0)
- excon (0.57.0)
- faraday (0.12.1)
+ excon (0.58.0)
+ faraday (0.13.1)
multipart-post (>= 1.2, < 3)
- faraday-http-cache (2.0.0)
- faraday (~> 0.8)
- faraday_middleware (0.11.0.1)
+ faraday_middleware (0.12.2)
faraday (>= 0.7.4, < 1.0)
ffi (1.9.18)
ffi (1.9.18-x64-mingw32)
@@ -175,13 +157,13 @@ GEM
ffi (>= 1.0.1)
gyoku (1.3.1)
builder (>= 2.1.2)
- hashie (3.5.5)
+ hashdiff (0.3.6)
+ hashie (3.5.6)
highline (1.7.8)
htmlentities (4.3.4)
httpclient (2.8.3)
- i18n (0.8.4)
- iniparse (1.4.3)
- inspec (1.30.0)
+ iniparse (1.4.4)
+ inspec (1.36.1)
addressable (~> 2.4)
faraday (>= 0.9.0)
hashie (~> 3.4)
@@ -200,7 +182,7 @@ GEM
sslshake (~> 1.2)
thor (~> 0.19)
toml (~> 0.1)
- train (>= 0.24.0, < 1.0)
+ train (~> 0.26)
ipaddress (0.8.3)
iso8601 (0.9.1)
json (2.1.0)
@@ -212,24 +194,17 @@ GEM
little-plugger (~> 1.1)
multi_json (~> 1.10)
method_source (0.8.2)
- minitest (5.10.2)
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 (3.3.1)
- 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)
- multi_json (1.12.1)
+ multi_json (1.12.2)
multipart-post (2.0.0)
net-http-persistent (2.9.4)
net-http-pipeline (1.0.1)
@@ -237,7 +212,7 @@ GEM
net-ssh (>= 2.6.5)
net-sftp (2.1.2)
net-ssh (>= 2.6.5)
- net-ssh (4.1.0)
+ net-ssh (4.2.0)
net-ssh-gateway (2.0.0)
net-ssh (>= 4.0.0)
net-ssh-multi (1.2.1)
@@ -248,7 +223,7 @@ GEM
nori (2.6.0)
octokit (4.7.0)
sawyer (~> 0.8.0, >= 0.5.3)
- ohai (13.2.0)
+ ohai (13.4.0)
chef-config (>= 12.5.0.alpha.1, < 14)
ffi (~> 1.9)
ffi-yajl (~> 2.2)
@@ -260,7 +235,7 @@ GEM
plist (~> 3.1)
systemu (~> 2.6.4)
wmi-lite (~> 1.0)
- parallel (1.11.2)
+ parallel (1.12.0)
parser (2.4.0.0)
ast (~> 2.2)
parslet (1.5.0)
@@ -272,8 +247,8 @@ GEM
coderay (~> 1.1.0)
method_source (~> 0.8.1)
slop (~> 3.4)
- pry-byebug (3.4.2)
- byebug (~> 9.0)
+ pry-byebug (3.5.0)
+ byebug (~> 9.1)
pry (~> 0.10)
pry-remote (0.1.8)
pry (~> 0.9)
@@ -288,8 +263,7 @@ GEM
rainbow (2.2.2)
rake
rake (12.0.0)
- rb-readline (0.5.4)
- retriable (3.0.2)
+ rb-readline (0.5.5)
rspec (3.6.0)
rspec-core (~> 3.6.0)
rspec-expectations (~> 3.6.0)
@@ -321,23 +295,24 @@ GEM
ruby-shadow (2.5.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)
- serverspec (2.39.1)
+ serverspec (2.40.0)
multi_json
rspec (~> 3.0)
rspec-its
specinfra (~> 2.68)
sfl (2.3)
- simplecov (0.14.1)
+ simplecov (0.15.0)
docile (~> 1.1.0)
json (>= 1.8, < 3)
simplecov-html (~> 0.10.0)
- simplecov-html (0.10.1)
+ simplecov-html (0.10.2)
slop (3.6.0)
- specinfra (2.68.1)
+ specinfra (2.71.3)
net-scp
net-ssh (>= 2.7, < 5.0)
net-telnet
@@ -345,12 +320,11 @@ GEM
sslshake (1.2.0)
syslog-logger (1.6.8)
systemu (2.6.5)
- thor (0.19.4)
- thread_safe (0.3.6)
+ thor (0.20.0)
toml (0.1.2)
parslet (~> 1.5.0)
tomlrb (1.2.4)
- train (0.25.0)
+ train (0.26.2)
docker-api (~> 1.26)
json (>= 1.8, < 3.0)
mixlib-shellout (~> 2.0)
@@ -369,10 +343,12 @@ GEM
typhoeus (~> 0.6, >= 0.6.8)
typhoeus (0.8.0)
ethon (>= 0.8.0)
- tzinfo (1.2.3)
- thread_safe (~> 0.1)
unicode-display_width (1.3.0)
uuidtools (2.1.5)
+ webmock (3.0.1)
+ addressable (>= 2.3.6)
+ crack (>= 0.3.2)
+ hashdiff
websocket (1.2.4)
win32-api (1.5.3-universal-mingw32)
win32-dir (0.5.1)
@@ -421,11 +397,10 @@ DEPENDENCIES
bundler-audit!
chef!
chef-config!
+ chef-vault
cheffish (~> 13)
chefstyle!
- github_changelog_generator!
inspec
- mixlib-install
netrc
octokit
ohai (~> 13)
@@ -440,7 +415,8 @@ DEPENDENCIES
simplecov
tomlrb
travis
+ webmock
yard
BUNDLED WITH
- 1.15.1
+ 1.15.4
diff --git a/HISTORY.md b/HISTORY.md
deleted file mode 100644
index 9c3fdb8771..0000000000
--- a/HISTORY.md
+++ /dev/null
@@ -1,1362 +0,0 @@
-## [v12.19.33](https://github.com/chef/chef/tree/v12.19.33) (2017-02-16)
-[Full Changelog](https://github.com/chef/chef/compare/v12.18.31...v12.19.33)
-
-**Closed issues:**
-
-- Package resource fails chefspec on RHEL starting with Chef 12.18. [\#5769](https://github.com/chef/chef/issues/5769)
-
-**Merged pull requests:**
-
-- coerce immutable arrays to normal arrays in the yum\_package resource [\#5816](https://github.com/chef/chef/pull/5816) ([lamont-granquist](https://github.com/lamont-granquist))
-- Suppress sensitive properties from resource log and reporting output [\#5803](https://github.com/chef/chef/pull/5803) ([tduffield](https://github.com/tduffield))
-- Sanitize UTF-8 data sent to Data Collector [\#5793](https://github.com/chef/chef/pull/5793) ([lamont-granquist](https://github.com/lamont-granquist))
-- Add multipackage\_api support to yum\_package provider [\#5791](https://github.com/chef/chef/pull/5791) ([tduffield](https://github.com/tduffield))
-- rhel7 / dnf 2.0 fixes / improved errors [\#5782](https://github.com/chef/chef/pull/5782) ([lamont-granquist](https://github.com/lamont-granquist))
-- Grant Administrators group permissions to nodes directory under chef-solo [\#5781](https://github.com/chef/chef/pull/5781) ([tduffield](https://github.com/tduffield))
-- Fix --no-fips on chef-client [\#5778](https://github.com/chef/chef/pull/5778) ([btm](https://github.com/btm))
-- Raise error if ips\_package install returns non-zero [\#5773](https://github.com/chef/chef/pull/5773) ([tduffield](https://github.com/tduffield))
-- Use CIDR notation rather than netmask in route-eth0 file [\#5772](https://github.com/chef/chef/pull/5772) ([tduffield](https://github.com/tduffield))
-- Verify systemd\_unit file with custom verifier [\#5765](https://github.com/chef/chef/pull/5765) ([mal](https://github.com/mal))
-- Windows alternate user support for execute resources [\#5764](https://github.com/chef/chef/pull/5764) ([NimishaS](https://github.com/NimishaS))
-- favor metadata.json over metadata.rb [\#5750](https://github.com/chef/chef/pull/5750) ([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))
-- dh/url support cab [\#5732](https://github.com/chef/chef/pull/5732) ([dheerajd-msys](https://github.com/dheerajd-msys))
-- use git archive to speed up putting source in place [\#5730](https://github.com/chef/chef/pull/5730) ([robbkidd](https://github.com/robbkidd))
-- use pkg.path variable to reference path to self [\#5729](https://github.com/chef/chef/pull/5729) ([robbkidd](https://github.com/robbkidd))
-- Raise NamedSecurityInfo related exception using HR result. [\#5727](https://github.com/chef/chef/pull/5727) ([Aliasgar16](https://github.com/Aliasgar16))
-- Core: Ensure paths are correctly escaped when syntax checking [\#5704](https://github.com/chef/chef/pull/5704) ([ceneo](https://github.com/ceneo))
-- 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))
-
-## [v12.18.31](https://github.com/chef/chef/tree/v12.18.31) (2017-01-11)
-[Full Changelog](https://github.com/chef/chef/compare/v12.17.44...v12.18.31)
-
-**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))
-
-**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))
-
-## [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)
-
-**Implemented enhancements:**
-
-- Action :umount for mount resource is an obtuse anachronism [\#5595](https://github.com/chef/chef/issues/5595)
-- Core: Update ohai resource to new style, stop overwriting name property [\#5607](https://github.com/chef/chef/pull/5607) ([adamleff](https://github.com/adamleff))
-- Linux: mount provider - skip device detection for zfs [\#5603](https://github.com/chef/chef/pull/5603) ([ttr](https://github.com/ttr))
-- Core: Ensure chef-solo creates node files w/ correct permissions [\#5601](https://github.com/chef/chef/pull/5601) ([scottopherson](https://github.com/scottopherson))
-- Resources: Add unmount as an alias to umount in the mount resource [\#5599](https://github.com/chef/chef/pull/5599) ([shortdudey123](https://github.com/shortdudey123))
-- Core: Update Data Collector to use Chef::JSONCompat [\#5590](https://github.com/chef/chef/pull/5590) ([adamleff](https://github.com/adamleff))
-- Knife: Add ability to pass multiple nodes to knife node/client delete [\#5572](https://github.com/chef/chef/pull/5572) ([jeunito](https://github.com/jeunito))
-- Core: Data Collector debug log should output JSON [\#5570](https://github.com/chef/chef/pull/5570) ([adamleff](https://github.com/adamleff))
-- Yum: Purge yum cache before deleting repo config [\#5509](https://github.com/chef/chef/pull/5509) ([iancward](https://github.com/iancward))
-- Knife Bootstrap: Passing config\_log\_level and config\_log\_location from config.rb [\#5502](https://github.com/chef/chef/pull/5502) ([dheerajd-msys](https://github.com/dheerajd-msys))
-
-**Fixed bugs:**
-
-- Custom Resources: Undefined method up\_to\_date thrown by Chef 12.16.42 [\#5593](https://github.com/chef/chef/issues/5593)
-- Core: Ensure deprecation messages are always included [\#5618](https://github.com/chef/chef/pull/5618) ([thommay](https://github.com/thommay))
-- Core: Fix bug where Access Controls on existing symlink resources would be ignored on first chef-client run [\#5616](https://github.com/chef/chef/pull/5616) ([tduffield](https://github.com/tduffield))
-- The suggested fix for the manage\_home deprecation is incorrect [\#5615](https://github.com/chef/chef/pull/5615) ([tas50](https://github.com/tas50))
-- change choco -version to choco --version [\#5613](https://github.com/chef/chef/pull/5613) ([spuder](https://github.com/spuder))
-- Knife: Correct example `chef\_server\_url` in `knife configure` [\#5602](https://github.com/chef/chef/pull/5602) ([jerryaldrichiii](https://github.com/jerryaldrichiii))
-- Windows: Ensure correct version of shutdown is called when using the reboot resource [\#5596](https://github.com/chef/chef/pull/5596) ([Xoph](https://github.com/Xoph))
-- Windows: Support for running cab\_package on non-English system locales [\#5591](https://github.com/chef/chef/pull/5591) ([jugatsu](https://github.com/jugatsu))
-- Core: Ensure Data Collector resource report exists before updating [\#5571](https://github.com/chef/chef/pull/5571) ([adamleff](https://github.com/adamleff))
-- Windows: Use the full path to expand.exe for msu\_package [\#5564](https://github.com/chef/chef/pull/5564) ([NimishaS](https://github.com/NimishaS))
-- Unset http\[s\]\_proxy in the subversion spec [\#5562](https://github.com/chef/chef/pull/5562) ([stefanor](https://github.com/stefanor))
-- Core: fix Lint/UnifiedInteger cop [\#5547](https://github.com/chef/chef/pull/5547) ([lamont-granquist](https://github.com/lamont-granquist))
-- Core: fix ImmutableArray slices [\#5541](https://github.com/chef/chef/pull/5541) ([lamont-granquist](https://github.com/lamont-granquist))
-- Prevent apt\_update failures on non-Linux platforms [\#5524](https://github.com/chef/chef/pull/5524) ([tas50](https://github.com/tas50))
-- Core: Ensure that the sensitive property is correctly accessed [\#5508](https://github.com/chef/chef/pull/5508) ([axos88](https://github.com/axos88))
-
-**Closed issues:**
-
-- cab\_package doesn't support running on non-English system locales [\#5592](https://github.com/chef/chef/issues/5592)
-- Support restarting/stopping/ the service from state paused on windows [\#5586](https://github.com/chef/chef/issues/5586)
-
-## [v12.16.42](https://github.com/chef/chef/tree/v12.16.42) (2016-11-04)
-[Full Changelog](https://github.com/chef/chef/compare/v12.15.19...v12.16.42)
-
-**Implemented enhancements:**
-
-- Core: improve readability of property-resource namespace collision exception message [\#5500](https://github.com/chef/chef/pull/5500) ([lamont-granquist](https://github.com/lamont-granquist))
-- Omnibus: Pull in Ohai 8.21.0 and other new deps [\#5499](https://github.com/chef/chef/pull/5499) ([tas50](https://github.com/tas50))
-- Core: Add deprecations to Data Collector run completion messages [\#5496](https://github.com/chef/chef/pull/5496) ([adamleff](https://github.com/adamleff))
-- Core: add attribute\_changed hook to event handlers [\#5495](https://github.com/chef/chef/pull/5495) ([lamont-granquist](https://github.com/lamont-granquist))
-- Knife: Add the `--field-separator` flag to knife show commands [\#5489](https://github.com/chef/chef/pull/5489) ([tduffield](https://github.com/tduffield))
-- Core: Enable Signed Header Auth for Data Collector, and Configure the Data Collector Automatically [\#5487](https://github.com/chef/chef/pull/5487) ([danielsdeleo](https://github.com/danielsdeleo))
-- Core: set use\_inline\_resources in package superclass [\#5483](https://github.com/chef/chef/pull/5483) ([lamont-granquist](https://github.com/lamont-granquist))
-- Package: Add new "lock" action for apt, yum and zypper packages [\#5395](https://github.com/chef/chef/pull/5395) ([yeoldegrove](https://github.com/yeoldegrove))
-
-**Fixed bugs:**
-
-- Enable data collector w/o token for solo, but require explicit URL [\#5511](https://github.com/chef/chef/pull/5511) ([danielsdeleo](https://github.com/danielsdeleo))
-- Core: Include chef/chef\_class in Chef::REST for method log\_deprecation [\#5504](https://github.com/chef/chef/pull/5504) ([smalltown](https://github.com/smalltown))
-- Knife: Updating knife ssl fetch to correctly store certificate when it does not have a CN [\#5498](https://github.com/chef/chef/pull/5498) ([tyler-ball](https://github.com/tyler-ball))
-- Knife: Fixed knife download cookbooks issue which used to corrupt the certificate files each time the command was fired. [\#5494](https://github.com/chef/chef/pull/5494) ([Aliasgar16](https://github.com/Aliasgar16))
-- Solaris: Properly check lock status of users on solaris2 [\#5486](https://github.com/chef/chef/pull/5486) ([tduffield](https://github.com/tduffield))
-- Solaris: Fix IPS package must create symlinks to package commands [\#5485](https://github.com/chef/chef/pull/5485) ([jaymalasinha](https://github.com/jaymalasinha))
-
-## [v12.15.19](https://github.com/chef/chef/tree/v12.15.19) (2016-10-07)
-[Full Changelog](https://github.com/chef/chef/compare/v12.14.89...v12.15.19)
-
-**Enhancements:**
-
-- Adding support for rfc 62 exit code 213 (Chef upgrades) [\#5428](https://github.com/chef/chef/pull/5428) ([jeremymv2](https://github.com/jeremymv2))
-- Allow raw_key to override the configured signing\_key [\#5314](https://github.com/chef/chef/pull/5314) ([thommay](https://github.com/thommay))
-- Set yum\_repository gpgcheck default to true [\#5398](https://github.com/chef/chef/pull/5398) ([shortdudey123](https://github.com/shortdudey123))
-- Allow deletion of registry\_key without the need for users to pass data key in values hash. [\#5359](https://github.com/chef/chef/pull/5359) ([Aliasgar16](https://github.com/Aliasgar16))
-- Adding support for cab files to Chef package provider on windows [\#5285](https://github.com/chef/chef/pull/5285) ([Vasu1105](https://github.com/Vasu1105))
-- Ignore unknown metadata fields in metadata.rb [\#5299](https://github.com/chef/chef/pull/5299) ([lamont-granquist](https://github.com/lamont-granquist))
-
-**Fixed Bugs:**
-
-- knife ssh: use the command line prompt for sudo if set [\#5427](https://github.com/chef/chef/pull/5427) ([lamont-granquist](https://github.com/lamont-granquist))
-- User provider: Fix manage\_home provider inconsistency for Mac and FreeBSD providers [\#5423](https://github.com/chef/chef/pull/5423) ([lamont-granquist](https://github.com/lamont-granquist))
-- Fix for "Chefspec template rendering fails when cookbook\_name != directory name" [\#5417](https://github.com/chef/chef/pull/5417) ([lamont-granquist](https://github.com/lamont-granquist))
-- Fix solaris handling for useradd -m/-M behavior [\#5408](https://github.com/chef/chef/pull/5408) ([coderanger](https://github.com/coderanger))
-- Normalize full key name to avoid resource update on identical key names [\#5290](https://github.com/chef/chef/pull/5290) ([bai](https://github.com/bai))
-- Add trailing newline to generated 15update-stamp [\#5382](https://github.com/chef/chef/pull/5382) ([pwalz](https://github.com/pwalz))
-- Invalid `dsc_scripts` should fail the run [\#5377](https://github.com/chef/chef/pull/5377) ([NimishaS](https://github.com/NimishaS))
-- Revert --local filter for gems installed from paths [\#5379](https://github.com/chef/chef/pull/5379) ([mwrock](https://github.com/mwrock))
-- Fix knife list\_commands\(\) [\#5386](https://github.com/chef/chef/pull/5386) ([lamont-granquist](https://github.com/lamont-granquist))
-- Don't use -r for users or groups on Solaris. [\#5355](https://github.com/chef/chef/pull/5355) ([coderanger](https://github.com/coderanger))
-- Chef 12 Attribute Regression [\#5360](https://github.com/chef/chef/pull/5360) ([gbagnoli](https://github.com/gbagnoli))
-- Handling Errno::ETIMEDOUT [\#5358](https://github.com/chef/chef/pull/5358) ([NimishaS](https://github.com/NimishaS))
-
-## [v12.14.89](https://github.com/chef/chef/tree/v12.14.89) (2016-09-22)
-[Full Changelog](https://github.com/chef/chef/compare/v12.14.77...v12.14.89)
-
-**Fixed Bugs:**
-
-- Revert "Verify systemd\_unit file during create" [\#5326](https://github.com/chef/chef/pull/5326) ([mwrock](https://github.com/mwrock))
-- Fix method\_access and array handling in node presenter [\#5351](https://github.com/chef/chef/pull/5351) ([lamont-granquist](https://github.com/lamont-granquist))
-- Fixed undefined short\_cksum method issue and checksum in uppercase issue for windows\_package resource. [\#5332](https://github.com/chef/chef/pull/5332) ([Aliasgar16](https://github.com/Aliasgar16))
-- Fix makecache action name in yum\_repository [\#5348](https://github.com/chef/chef/pull/5348) ([tas50](https://github.com/tas50))
-
-## [v12.14.77](https://github.com/chef/chef/tree/v12.14.77) (2016-09-19)
-[Full Changelog](https://github.com/chef/chef/compare/v12.14.60...v12.14.77)
-
-**Fixed Bugs:**
-
-- Revert supports\[:manage\_home\] behavior [\#5322](https://github.com/chef/chef/pull/5322) ([lamont-granquist](https://github.com/lamont-granquist))
-- Preserve the extension of the file in the rendered tempfile in File providers [\#5327](https://github.com/chef/chef/pull/5327) ([lamont-granquist](https://github.com/lamont-granquist))
-- Allow the :delete action for yum\_repository + fix old property support [\#5320](https://github.com/chef/chef/pull/5320) ([tas50](https://github.com/tas50))
-
-## [v12.14.60](https://github.com/chef/chef/tree/v12.14.60) (2016-09-09)
-[Full Changelog](https://github.com/chef/chef/compare/v12.13.37...v12.14.60)
-
-**Enhancements:**
-
-- Only support Solaris 10u11 and newer [\#5264](https://github.com/chef/chef/pull/5264) ([rhass](https://github.com/rhass))
-- Added code to handle deletion of directories on Windows that are symlinks. [\#5234](https://github.com/chef/chef/pull/5234) ([Aliasgar16](https://github.com/Aliasgar16))
-- Readability improvements to options parsing code [\#5289](https://github.com/chef/chef/pull/5289) ([lamont-granquist](https://github.com/lamont-granquist))
-- Add Hash type to launchd:keep\_alive [\#5182](https://github.com/chef/chef/pull/5182) ([erikng](https://github.com/erikng))
-- Added timeout during removing of windows package [\#5250](https://github.com/chef/chef/pull/5250) ([dheerajd-msys](https://github.com/dheerajd-msys))
-- Bump openssl to 1.0.2h [\#5260](https://github.com/chef/chef/pull/5260) ([lamont-granquist](https://github.com/lamont-granquist))
-- Rewrite linux\_user provider check\_lock [\#5248](https://github.com/chef/chef/pull/5248) ([lamont-granquist](https://github.com/lamont-granquist))
-- Allow flagging a resource property as sensitive [\#5185](https://github.com/chef/chef/pull/5185) ([adamleff](https://github.com/adamleff))
-- Rewrite linux useradd provider [\#5243](https://github.com/chef/chef/pull/5243) ([lamont-granquist](https://github.com/lamont-granquist))
-- Add yum_repository resource from the yum cookbook [\#5187](https://github.com/chef/chef/pull/5187) ([thommay](https://github.com/thommay))
-- Verify systemd\_unit file during create [\#5210](https://github.com/chef/chef/pull/5210) ([mal](https://github.com/mal))
-- Add a warning for guard blocks that return a non-empty string [\#5233](https://github.com/chef/chef/pull/5233) ([coderanger](https://github.com/coderanger))
-- Forward package cookbook\_name to underlying remote\_file [\#5128](https://github.com/chef/chef/pull/5128) ([Annih](https://github.com/Annih))
-- Fix "URI.escape is obsolete" warnings [\#5230](https://github.com/chef/chef/pull/5230) ([jkeiser](https://github.com/jkeiser))
-- Remove ruby 2.1 support [\#5220](https://github.com/chef/chef/pull/5220) ([lamont-granquist](https://github.com/lamont-granquist))
-- User provider manage\_home behavior and refactor [\#5122](https://github.com/chef/chef/pull/5122) ([lamont-granquist](https://github.com/lamont-granquist))
-- Fix Style/BlockDelimiters, Style/MultilineBlockLayout and 0.42.0 engine upgrade [\#5218](https://github.com/chef/chef/pull/5218) ([lamont-granquist](https://github.com/lamont-granquist))
-- Switch from Ruby 2.1.9 to Ruby 2.3.1 [\#5190](https://github.com/chef/chef/pull/5190) ([jkeiser](https://github.com/jkeiser))
-- Update to latest chefstyle [\#5217](https://github.com/chef/chef/pull/5217) ([jkeiser](https://github.com/jkeiser))
-- Rubygems memory performance improvement [\#5203](https://github.com/chef/chef/pull/5203) ([lamont-granquist](https://github.com/lamont-granquist))
-- HTTP 1.1 keepalives for cookbook synchronization [\#5151](https://github.com/chef/chef/pull/5151) ([lamont-granquist](https://github.com/lamont-granquist))
-
-**Fixed Bugs:**
-
-- Fixes GH-4955, allowing local gems with remote dependencies [\#5098](https://github.com/chef/chef/pull/5098) ([jyaworski](https://github.com/jyaworski))
-- Hook up the recipe\_file\_loaded event which was defined but not actually called [\#5281](https://github.com/chef/chef/pull/5281) ([coderanger](https://github.com/coderanger))
-- fix gem\_package regression in master [\#5262](https://github.com/chef/chef/pull/5262) ([lamont-granquist](https://github.com/lamont-granquist))
-- Added fix for spaces in profile identifiers [\#5159](https://github.com/chef/chef/pull/5159) ([natewalck](https://github.com/natewalck))
-- Add a hook for compat\_resource [\#5259](https://github.com/chef/chef/pull/5259) ([lamont-granquist](https://github.com/lamont-granquist))
-- Fix flush\_cache issues in yum\_package [\#5258](https://github.com/chef/chef/pull/5258) ([jaymzh](https://github.com/jaymzh))
-- Use symbols instead of strings as keys for systemd user property [\#5241](https://github.com/chef/chef/pull/5241) ([joshuamiller01](https://github.com/joshuamiller01))
-- Use upstart goal state as service status [\#5249](https://github.com/chef/chef/pull/5249) ([evan2645](https://github.com/evan2645))
-- Fix the useradd test filters [\#5236](https://github.com/chef/chef/pull/5236) ([lamont-granquist](https://github.com/lamont-granquist))
-- Fix specify members of group on suse/openbsd/solaris2/hpux [\#5152](https://github.com/chef/chef/pull/5152) ([tas50](https://github.com/tas50))
-- Fix cookbook upload of symlinked cookbooks in Ruby 2.3 on Windows [\#5216](https://github.com/chef/chef/pull/5216) ([jkeiser](https://github.com/jkeiser))
-- Don't use relative\_path\_from on glob results [\#5215](https://github.com/chef/chef/pull/5215) ([jkeiser](https://github.com/jkeiser))
-
-## [v12.13.37](https://github.com/chef/chef/tree/v12.13.37) (2016-08-12)
-[Full Changelog](https://github.com/chef/chef/compare/v12.13.30...v12.13.37)
-
-**Enhancements:**
-
-- Bumping ohai and mixlib-log to fix regression [\#5197](https://github.com/chef/chef/pull/5197) ([mwrock](https://github.com/mwrock))
-- Remove requires in Chef::Recipe that are no longer necessary [\#5189](https://github.com/chef/chef/pull/5189) ([lamont-granquist](https://github.com/lamont-granquist))
-
-## [v12.13.30](https://github.com/chef/chef/tree/v12.13.30) (2016-08-05)
-[Full Changelog](https://github.com/chef/chef/compare/v12.12.15...v12.13.30)
-
-**Enhancements:**
-
-- noop apt_update similar to apt_repository [\#5173](https://github.com/chef/chef/pull/5173) ([lamont-granquist](https://github.com/lamont-granquist))
-- Bump dependencies to bring in Ohai 8.18 [\#5168](https://github.com/chef/chef/pull/5168) ([tas50](https://github.com/tas50))
-- Make Chef work with Ruby 2.3, update Ruby to 2.1.9 [\#5165](https://github.com/chef/chef/pull/5165) ([jkeiser](https://github.com/jkeiser))
-- Log cause chain for exceptions [\#3354](https://github.com/chef/chef/pull/3354) ([jaym](https://github.com/jaym))
-- First pass on --config-option handling. [\#5045](https://github.com/chef/chef/pull/5045) ([coderanger](https://github.com/coderanger))
-- Add bootstrap proxy authentication support. [\#4059](https://github.com/chef/chef/pull/4059) ([yossigo](https://github.com/yossigo))
-- Support setting an empty string for cron attrs [\#5127](https://github.com/chef/chef/pull/5127) ([thommay](https://github.com/thommay))
-- Also clear notifications when deleting a resource. [\#5146](https://github.com/chef/chef/pull/5146) ([coderanger](https://github.com/coderanger))
-- Clean up subscribes internals and notification storage. [\#5145](https://github.com/chef/chef/pull/5145) ([coderanger](https://github.com/coderanger))
-- Cache ChefFS children [\#5131](https://github.com/chef/chef/pull/5131) ([thommay](https://github.com/thommay))
-- Update to rspec 3.5 [\#5126](https://github.com/chef/chef/pull/5126) ([thommay](https://github.com/thommay))
-- Add `chef\_data\_bag\_item` to Cheffish DSL methods [\#5125](https://github.com/chef/chef/pull/5125) ([danielsdeleo](https://github.com/danielsdeleo))
-- replace glibc resolver with ruby resolver [\#5123](https://github.com/chef/chef/pull/5123) ([lamont-granquist](https://github.com/lamont-granquist))
-- The user must specify a category for a new cookbook [\#5091](https://github.com/chef/chef/pull/5091) ([thommay](https://github.com/thommay))
-- Warn if not installing an individual bff fileset [\#5093](https://github.com/chef/chef/pull/5093) ([mwrock](https://github.com/mwrock))
-- Use Mixlib::Archive to extract tarballs [\#5080](https://github.com/chef/chef/pull/5080) ([thommay](https://github.com/thommay))
-- Data Collector server URL validation, and disable on host down [\#5076](https://github.com/chef/chef/pull/5076) ([adamleff](https://github.com/adamleff))
-
-**Fixed Bugs:**
-
-- Don't log error for reporting audit data in when in chef-zero [\#5016](https://github.com/chef/chef/pull/5016) ([erichelgeson](https://github.com/erichelgeson))
-- Invalidate the file system cache on deletion [\#5154](https://github.com/chef/chef/pull/5154) ([thommay](https://github.com/thommay))
-- Root ACLs are a top level json file not a sub-directory [\#5155](https://github.com/chef/chef/pull/5155) ([thommay](https://github.com/thommay))
-- Install nokogiri and pin mixlib-cli [\#5118](https://github.com/chef/chef/pull/5118) ([ksubrama](https://github.com/ksubrama))
-- Ensure that the valid option is given back to the option parser [\#5114](https://github.com/chef/chef/pull/5114) ([dldinternet](https://github.com/dldinternet))
-- Fixed regex for zypper version 1.13.\*. [\#5109](https://github.com/chef/chef/pull/5109) ([yeoldegrove](https://github.com/yeoldegrove))
-- add back method\_missing support to set\_unless [\#5103](https://github.com/chef/chef/pull/5103) ([lamont-granquist](https://github.com/lamont-granquist))
-- Fix \#5094 node.default\_unless issue in 12.12.13 [\#5097](https://github.com/chef/chef/pull/5097) ([lamont-granquist](https://github.com/lamont-granquist))
-- Fix \#5078 using cwd parameter instead of Dir.pwd [\#5079](https://github.com/chef/chef/pull/5079) ([Tensibai](https://github.com/Tensibai))
-
-## [v12.12.15](https://github.com/chef/chef/tree/v12.12.15) (2016-07-08)
-[Full Changelog](https://github.com/chef/chef/compare/v12.12.13...v12.12.15)
-
-**Fixed Bugs:**
-
-- Fix for #5094 12.12.13 node.default_unless issue [\#5097](https://github.com/chef/chef/pull/5097) ([lamont-granquist](https://github.com/lamont-granquist))
-
-## [v12.12.13](https://github.com/chef/chef/tree/v12.12.13) (2016-07-01)
-[Full Changelog](https://github.com/chef/chef/compare/v12.11.18...v12.12.13)
-
-**Implemented Enhancements:**
-
-- Tweak 3694 warnings [\#5075](https://github.com/chef/chef/pull/5075) ([lamont-granquist](https://github.com/lamont-granquist))
-- Adding node object to Data collector run\_converge message [\#5065](https://github.com/chef/chef/pull/5065) ([adamleff](https://github.com/adamleff))
-- Attribute API improvements [\#5029](https://github.com/chef/chef/pull/5029) ([lamont-granquist](https://github.com/lamont-granquist))
-- Remove deprecated Thread.exclusive around require call. [\#5068](https://github.com/chef/chef/pull/5068) ([maxlazio](https://github.com/maxlazio))
-- Ensure that chef-solo uses the expected repo dir [\#5059](https://github.com/chef/chef/pull/5059) ([thommay](https://github.com/thommay))
-- Expand data\_collector resource list to include all resources [\#5058](https://github.com/chef/chef/pull/5058) ([adamleff](https://github.com/adamleff))
-- Turn off fips with an empty environment var [\#5048](https://github.com/chef/chef/pull/5048) ([mwrock](https://github.com/mwrock))
-- Deprecate knife-supermarket gem [\#4896](https://github.com/chef/chef/pull/4896) ([thommay](https://github.com/thommay))
-- Update Nokogiri [\#5042](https://github.com/chef/chef/pull/5042) ([mwrock](https://github.com/mwrock))
-- Remote resource should respect sensitive flag [\#5025](https://github.com/chef/chef/pull/5025) ([PrajaktaPurohit](https://github.com/PrajaktaPurohit))
-- Convert the 3694 warning to a deprecation so it will be subject to the usual deprecation formatting \(collected at the bottom, can be made an error, etc\). [\#5022](https://github.com/chef/chef/pull/5022) ([coderanger](https://github.com/coderanger))
-- Deprecate `knife cookbook create` in favor of `chef generate cookbook`. [\#5021](https://github.com/chef/chef/pull/5021) ([tylercloke](https://github.com/tylercloke))
-
-**Fixed Bugs:**
-
-- Fixes windows_package uninstall scenarios by calling uninstall string directly [\#5050](https://github.com/chef/chef/pull/5050) ([mwrock](https://github.com/mwrock))
-- Fix gem_package idempotency [\#5046](https://github.com/chef/chef/pull/5046) ([thommay](https://github.com/thommay))
-- Undefined local variable lookup in multiplexed_dir.rb [\#5027](https://github.com/chef/chef/issues/5027) ([robdimarco](https://github.com/robdimarco))
-- Correctly write out data collector metadata file [\#5019](https://github.com/chef/chef/pull/5019) ([adamleff](https://github.com/adamleff))
-- Eliminate missing constant errors for LWRP class [\#5000](https://github.com/chef/chef/pull/5000) ([PrajaktaPurohit](https://github.com/PrajaktaPurohit))
-- Updated_resource_count to data collector should only include updated resources [\#5006](https://github.com/chef/chef/pull/5006) ([adamleff](https://github.com/adamleff))
-- Don't mask directory deletion errors [\#4991](https://github.com/chef/chef/pull/4991) ([jaymzh](https://github.com/jaymzh))
-
-## [v12.11.18](https://github.com/chef/chef/tree/v12.11.18) (2016-06-02)
-[Full Changelog](https://github.com/chef/chef/compare/v12.11.17...v12.11.18)
-
-**Implemented Enhancements:**
-
-- Creation of the new DataCollector reporter [\#4973](https://github.com/chef/chef/pull/4973) ([adamleff](https://github.com/adamleff))
-- Add systemd\_unit try-restart, reload-or-restart, reload-or-try-restart actions [\#4908](https://github.com/chef/chef/pull/4908) ([nathwill](https://github.com/nathwill))
-- RFC062 exit status chef client [\#4611](https://github.com/chef/chef/pull/4611) ([smurawski](https://github.com/smurawski))
-- Create 'universal' DSL [\#4942](https://github.com/chef/chef/pull/4942) ([lamont-granquist](https://github.com/lamont-granquist))
-- Handle numeric id for the user value in the git resource [\#4902](https://github.com/chef/chef/pull/4902) ([MichaelPereira](https://github.com/MichaelPereira))
-- RFC 31 - Default solo to local mode [\#4919](https://github.com/chef/chef/pull/4919) ([thommay](https://github.com/thommay))
-- Wire up chef handlers directly from libraries [\#4933](https://github.com/chef/chef/pull/4933) ([lamont-granquist](https://github.com/lamont-granquist))
-- Reject malformed ini content in systemd\_unit resource [\#4907](https://github.com/chef/chef/pull/4907) ([nathwill](https://github.com/nathwill))
-- Update usage of @new\_resource.destination to `cwd` within the git hwrp [\#4898](https://github.com/chef/chef/pull/4898) ([joshburt](https://github.com/joshburt))
-- Support Ruby Files in ChefFS [\#4887](https://github.com/chef/chef/pull/4887) ([thommay](https://github.com/thommay))
-- Adds a system check for fips enablement and runs in fips mode if enabled [\#4880](https://github.com/chef/chef/pull/4880) ([mwrock](https://github.com/mwrock))
-- Lazy'ing candidate\_version in package provider [\#4869](https://github.com/chef/chef/pull/4869) ([lamont-granquist](https://github.com/lamont-granquist))
-- Add systemd\_unit resource [\#4700](https://github.com/chef/chef/pull/4700) ([nathwill](https://github.com/nathwill))
-- Bump chef-zero to avoid aggressive logging [\#4878](https://github.com/chef/chef/pull/4878) ([stevendanna](https://github.com/stevendanna))
-
-**Fixed Bugs:**
-
-- Fix \#4949 and Avoid Errno::EBUSY on docker containers [\#4979](https://github.com/chef/chef/pull/4979) ([andrewjamesbrown](https://github.com/andrewjamesbrown))
-- Ensure recipe-url works right in solo [\#4957](https://github.com/chef/chef/pull/4957) ([thommay](https://github.com/thommay))
-- Fix portage provider to support version with character [\#4966](https://github.com/chef/chef/pull/4966) ([crigor](https://github.com/crigor))
-- Fixes \#4968 and only retrieves the latest version of packages from chocolatey [\#4977](https://github.com/chef/chef/pull/4977) ([mwrock](https://github.com/mwrock))
-- Update contributing doc to better reflect reality [\#4962](https://github.com/chef/chef/pull/4962) ([tas50](https://github.com/tas50))
-- Load cookbook versions correctly for knife [\#4936](https://github.com/chef/chef/pull/4936) ([thommay](https://github.com/thommay))
-- Gem metadata command needs Gem.clear\_paths [\#4929](https://github.com/chef/chef/pull/4929) ([lamont-granquist](https://github.com/lamont-granquist))
-- Fix os x profile provider for nil [\#4921](https://github.com/chef/chef/pull/4921) ([achand](https://github.com/achand))
-- Cookbook site install : tar error on windows [\#4867](https://github.com/chef/chef/pull/4867) ([willoucom](https://github.com/willoucom))
-- Fix yum\_package breakage \(the =~ operator in ruby is awful\) [\#4912](https://github.com/chef/chef/pull/4912) ([lamont-granquist](https://github.com/lamont-granquist))
-- Encode registry enumerated values and keys to utf8 instead of the local codepage [\#4906](https://github.com/chef/chef/pull/4906) ([mwrock](https://github.com/mwrock))
-- Chocolatey Package Provider chomps nil object [\#4760](https://github.com/chef/chef/pull/4760) ([svmastersamurai](https://github.com/svmastersamurai))
-- Fixes knife ssl check on windows [\#4886](https://github.com/chef/chef/pull/4886) ([mwrock](https://github.com/mwrock))
-
-## [v12.10.24](https://github.com/chef/chef/tree/v12.10.24) (2016-04-27)
-[Full Changelog](https://github.com/chef/chef/compare/v12.10.23...v12.10.24)
-
-**Fixed Bugs:**
-
-- Removing non-existent members from group should not fail [\#4812](https://github.com/chef/chef/pull/4812) ([chefsalim](https://github.com/chefsalim))
-- The easy\_install provider and resource are deprecated and will be removed in Chef 13 [\#4860](https://github.com/chef/chef/pull/4860) ([coderanger](https://github.com/coderanger))
-
-**Tech cleanup:**
-
-- Refactor ChefFS files to be files [\#4837](https://github.com/chef/chef/pull/4837) ([thommay](https://github.com/thommay))
-- Rename and add backcompat requires for ChefFS dirs [\#4830](https://github.com/chef/chef/pull/4830) ([thommay](https://github.com/thommay))
-- Refactor ChefFS directories to be directories [\#4826](https://github.com/chef/chef/pull/4826) ([thommay](https://github.com/thommay))
-- Move all ChefFS exceptions into a single file [\#4822](https://github.com/chef/chef/pull/4822) ([thommay](https://github.com/thommay))
-
-**Enhancements:**
-
-- Add layout option support for device creation to mdadm resource provider [\#4855](https://github.com/chef/chef/pull/4855) ([kbruner](https://github.com/kbruner))
-- add notifying\_block and subcontext\_block to chef [\#4818](https://github.com/chef/chef/pull/4818) ([lamont-granquist](https://github.com/lamont-granquist))
-- modernize shell\_out method syntax [\#4865](https://github.com/chef/chef/pull/4865) ([lamont-granquist](https://github.com/lamont-granquist))
-- Update rubygems provider to support local install of gems if so specified [\#4847](https://github.com/chef/chef/pull/4847) ([PrajaktaPurohit](https://github.com/PrajaktaPurohit))
-- fix details in with\_run\_context [\#4839](https://github.com/chef/chef/pull/4839) ([lamont-granquist](https://github.com/lamont-granquist))
-- Lock dependencies of chef through a `Gemfile.lock` [\#4820](https://github.com/chef/chef/pull/4820) ([jkeiser](https://github.com/jkeiser))
-- add better resource manipulation API [\#4834](https://github.com/chef/chef/pull/4834) ([lamont-granquist](https://github.com/lamont-granquist))
-- add nillable apt\_repository and nillable properties [\#4832](https://github.com/chef/chef/pull/4832) ([lamont-granquist](https://github.com/lamont-granquist))
-
-## [v12.9](https://github.com/chef/chef/tree/v12.9.38) (2016-04-09)
-[Full Changelog](https://github.com/chef/chef/compare/v12.8.2...v12.9.38)
-
-**Implemented enhancements:**
-
-- Sftp remote file support [\#4750](https://github.com/chef/chef/pull/4750) ([jkerry](https://github.com/jkerry))
-- Setting init\_command should be accepted instead of specific command overrides [\#4709](https://github.com/chef/chef/pull/4709) ([coderanger](https://github.com/coderanger))
-- Add a NoOp provider [\#4798](https://github.com/chef/chef/pull/4798) ([thommay](https://github.com/thommay))
-- Add ability to notify from inside LWRP to wrapping resource\_collections [\#4017](https://github.com/chef/chef/issues/4017)
-- Notifications from LWRPS/sub-resources can trigger resources in outer run\_context scopes [\#4741](https://github.com/chef/chef/pull/4741) ([lamont-granquist](https://github.com/lamont-granquist))
-- Improve the docs generated by knife cookbook create [\#4757](https://github.com/chef/chef/pull/4757) ([tas50](https://github.com/tas50))
-- Need Config/CLI options to move interval+splay sleep to end of client loop [\#3305](https://github.com/chef/chef/issues/3305)
-- Add optional integer argument for --daemonize option [\#4759](https://github.com/chef/chef/pull/4759) ([jrunning](https://github.com/jrunning))
-- Add shorthand :syslog and :win\_evt for log\_location config [\#4751](https://github.com/chef/chef/pull/4751) ([jrunning](https://github.com/jrunning))
-
-**Fixed bugs:**
-
-- chef\_gem and gem metadata don't play well [\#4710](https://github.com/chef/chef/issues/4710)
-- Fix cookbook metadata 'gem' command to make it useful [\#4809](https://github.com/chef/chef/pull/4809) ([lamont-granquist](https://github.com/lamont-granquist))
-- Convert timeout config to integer [\#4787](https://github.com/chef/chef/pull/4787) ([chefsalim](https://github.com/chefsalim))
-- The mount resource is not idempotent on windows [\#3861](https://github.com/chef/chef/issues/3861)
-- fix for \#4715 - unset TMPDIR in homebrew package provider [\#4716](https://github.com/chef/chef/pull/4716) ([gips0n](https://github.com/gips0n))
-- tons of "Deprecation class overwrites LWRP resource" WARNING SPAM with chefspec [\#4668](https://github.com/chef/chef/issues/4668)
-
-**Merged pull requests:**
-
-- Add apt\_repository resource [\#4782](https://github.com/chef/chef/pull/4782) ([thommay](https://github.com/thommay))
-- Point to the right license file for chef. [\#4811](https://github.com/chef/chef/pull/4811) ([sersut](https://github.com/sersut))
-- add omnibus license metadata [\#4805](https://github.com/chef/chef/pull/4805) ([patrick-wright](https://github.com/patrick-wright))
-- Add default timeout [\#4804](https://github.com/chef/chef/pull/4804) ([chefsalim](https://github.com/chefsalim))
-- Spec break on Windows due to temp dir and short path names [\#4776](https://github.com/chef/chef/pull/4776) ([adamedx](https://github.com/adamedx))
-- Require chef/version since it's used here [\#4762](https://github.com/chef/chef/pull/4762) ([jkeiser](https://github.com/jkeiser))
-- remove pry from rbx build [\#4761](https://github.com/chef/chef/pull/4761) ([lamont-granquist](https://github.com/lamont-granquist))
-- ruby 2.0.0 is EOL [\#4752](https://github.com/chef/chef/pull/4752) ([lamont-granquist](https://github.com/lamont-granquist))
-- supresses parser gem errors [\#4755](https://github.com/chef/chef/pull/4755) ([lamont-granquist](https://github.com/lamont-granquist))
-- Set inherit=false on the fallback provider constant lookup. [\#4753](https://github.com/chef/chef/pull/4753) ([coderanger](https://github.com/coderanger))
-
-**Closed issues:**
-
-- Uploading an encrypted data bag to Chef server fails [\#4815](https://github.com/chef/chef/issues/4815)
-- powershell\_script does not have PSCredential capability [\#4589](https://github.com/chef/chef/issues/4589)
-- Documentation don't include how to setup mail server during deployment of Chef server [\#4807](https://github.com/chef/chef/issues/4807)
-- Resource 'mount' and chef 12.5.1 [\#4056](https://github.com/chef/chef/issues/4056)
-- Incorrect $TMPDIR environment variable on OS X [\#4715](https://github.com/chef/chef/issues/4715)
-- group provider on suse Linux adds user multiple times [\#4689](https://github.com/chef/chef/issues/4689)
-- Unexpected error when using "knife cookbook show ...." [\#4659](https://github.com/chef/chef/issues/4659)
-
-## [12.8.1](https://github.com/chef/chef/tree/12.8.1) (2016-03-07)
-[Full Changelog](https://github.com/chef/chef/compare/12.7.2...12.8.1)
-
-**Implemented enhancements:**
-
-- Clarify the probable cause of tempfile creation failure during cookbook sync [\#2171](https://github.com/chef/chef/issues/2171)
-- Remove static libraries from Chef package [\#4654](https://github.com/chef/chef/pull/4654) ([chefsalim](https://github.com/chefsalim))
-- Have client.rb verify that FIPS mode can be enforced [\#4630](https://github.com/chef/chef/pull/4630) ([ksubrama](https://github.com/ksubrama))
-- List all of the unignored files when loading a cookbook [\#4629](https://github.com/chef/chef/pull/4629) ([danielsdeleo](https://github.com/danielsdeleo))
-- adding pry and pry-byebug to dev dependencies [\#4601](https://github.com/chef/chef/pull/4601) ([mwrock](https://github.com/mwrock))
-- Split group members on commas [\#4583](https://github.com/chef/chef/pull/4583) ([thommay](https://github.com/thommay))
-- Make tempfiles easier to read \(prepend chef to the name\) [\#4582](https://github.com/chef/chef/pull/4582) ([thommay](https://github.com/thommay))
-- Extend cookbook shadowing deprecation warnings more broadly [\#4574](https://github.com/chef/chef/pull/4574) ([lamont-granquist](https://github.com/lamont-granquist))
-- tell knife's edit\_data what the object is [\#4548](https://github.com/chef/chef/pull/4548) ([thommay](https://github.com/thommay))
-- Implement knife bootstrap client.d RFC [\#4529](https://github.com/chef/chef/pull/4529) ([jaym](https://github.com/jaym))
-- Update to Log Level when showing unencrypted databag [\#4524](https://github.com/chef/chef/pull/4524) ([PatrickWalker](https://github.com/PatrickWalker))
-- RFC-060 gem metadata MVP [\#4478](https://github.com/chef/chef/pull/4478) ([lamont-granquist](https://github.com/lamont-granquist))
-- chef-client: add --\[no\]skip-cookbook-sync option [\#4316](https://github.com/chef/chef/pull/4316) ([josb](https://github.com/josb))
-- Extend service resource to support masking [\#4307](https://github.com/chef/chef/pull/4307) ([davide125](https://github.com/davide125))
-- launchd for osx [\#4111](https://github.com/chef/chef/pull/4111) ([mikedodge04](https://github.com/mikedodge04))
-
-**Fixed bugs:**
-
-- Chef::DataBagItem.to\_hash is modifying Chef::DataBagItem.raw\_data [\#4614](https://github.com/chef/chef/issues/4614)
-- Chef 12 seeing a ton of these in debug mode [\#2396](https://github.com/chef/chef/issues/2396)
-- Data bag item hash can have name key [\#4664](https://github.com/chef/chef/pull/4664) ([chefsalim](https://github.com/chefsalim))
-- Clearer exception for loading non-existent data bag items in solo mode. [\#4655](https://github.com/chef/chef/pull/4655) ([coderanger](https://github.com/coderanger))
-- Always rehash from gem source and not existing hash file [\#4651](https://github.com/chef/chef/pull/4651) ([tyler-ball](https://github.com/tyler-ball))
-- Handle negative content length headers too. [\#4646](https://github.com/chef/chef/pull/4646) ([coderanger](https://github.com/coderanger))
-- if no module name is found for a valid dsc resource default to PSDesiredStateConfiguration [\#4638](https://github.com/chef/chef/pull/4638) ([mwrock](https://github.com/mwrock))
-- removing disabling of readline in chef-shell [\#4635](https://github.com/chef/chef/pull/4635) ([mwrock](https://github.com/mwrock))
-- Fix a bug that was causing DataBagItem.to\_hash to mutate the data bag item [\#4631](https://github.com/chef/chef/pull/4631) ([itmustbejj](https://github.com/itmustbejj))
-- ensure paths maintain utf-8ness in non ascii encodings [\#4626](https://github.com/chef/chef/pull/4626) ([mwrock](https://github.com/mwrock))
-- Fix the Chocolatey-missing error again [\#4621](https://github.com/chef/chef/pull/4621) ([randomcamel](https://github.com/randomcamel))
-- fixes exe package downloads [\#4612](https://github.com/chef/chef/pull/4612) ([mwrock](https://github.com/mwrock))
-- fallback to netmsg.dll error table if error message is not found in system errors [\#4600](https://github.com/chef/chef/pull/4600) ([mwrock](https://github.com/mwrock))
-- zypper multipackage performance fix [\#4591](https://github.com/chef/chef/pull/4591) ([lamont-granquist](https://github.com/lamont-granquist))
-- bugfix \#2865 check for validation\_key [\#4581](https://github.com/chef/chef/pull/4581) ([thommay](https://github.com/thommay))
-- remove bogus recalculation of cookbook upload failures [\#4580](https://github.com/chef/chef/pull/4580) ([thommay](https://github.com/thommay))
-- Make sure we have a valid object before calling close! [\#4579](https://github.com/chef/chef/pull/4579) ([thommay](https://github.com/thommay))
-- Fix policyfile\_zero provisioner in 12.7 [\#4571](https://github.com/chef/chef/pull/4571) ([andy-dufour](https://github.com/andy-dufour))
-- do not include source parameter when removing a chocolatey package and ensure source is used on all functional tests [\#4570](https://github.com/chef/chef/pull/4570) ([mwrock](https://github.com/mwrock))
-- Fix databag globbing issues for chef-solo on windows [\#4569](https://github.com/chef/chef/pull/4569) ([jaym](https://github.com/jaym))
-- remove Chef::Mixin::Command use [\#4566](https://github.com/chef/chef/pull/4566) ([lamont-granquist](https://github.com/lamont-granquist))
-
-## 12.7.2
-
-* [pr#4559](https://github.com/chef/chef/pull/4559) Remove learnchef acceptance tests until we make them more reliable
-* [pr#4545](https://github.com/chef/chef/pull/4545) Removing rm -rf in chef-solo recipe_url
-
-## 12.7.1
-* [**Daniel Steen**](https://github.com/dansteen)
- * [pr#3183](https://github.com/chef/chef/pull/3183) Provide more helpful error message when accidentally using --secret instead of --secret-file
-
-* [pr#4532](https://github.com/chef/chef/pull/4532) Bump Bundler + Rubygems
-* [pr#4550](https://github.com/chef/chef/pull/4550) Use a streaming request to download cookbook
-
-## 12.7.0
-
-* [**Nate Walck**](https://github.com/natewalck)
- * [pr#4078](https://github.com/chef/chef/pull/4078) Add `osx_profile` resource for OS X
-* [**Timothy Cyrus**](https://github.com/tcyrus)
- * [pr#4420](https://github.com/chef/chef/pull/4420) Update code climate badge and code climate blocks in README.md
-* [**Jordan Running**](https://github.com/jrunning)
- * [pr#4399](https://github.com/chef/chef/pull/4399) Correctly save policy_name and policy_group with `knife node edit`
-* [**Brian Goad**](https://github.com/bbbco)
- * [pr#4315](https://github.com/chef/chef/pull/4315) Add extra tests around whether to skip with multiple guards
-
-* [pr#4516](https://github.com/chef/chef/pull/4516) Return propper error messages when using windows based `mount`, `user` and `group` resources
-* [pr#4500](https://github.com/chef/chef/pull/4500) Explicitly declare directory permissions of chef install on windows to restrict rights on Windows client versions
-* [pr#4498](https://github.com/chef/chef/pull/4498) Correct major and minor OS versions for Windows 10 and add versions for Windows 2016 Server
-* [pr#4375](https://github.com/chef/chef/pull/4375) No longer try to auto discover package version of `exe` based windows packages
-* [pr#4369](https://github.com/chef/chef/pull/4396) Import omnibus-chef chef project definition and history
-* [pr#4399](https://github.com/chef/chef/pull/4399) Correctly save `policy_name` and `policy_group` with `knife node edit`
-* [pr#4278](https://github.com/chef/chef/pull/4278) make file resource use properties
-* [pr#4479](https://github.com/chef/chef/pull/4479) Remove incorrect cookbook artifact normalization
-* [pr#4470](https://github.com/chef/chef/pull/4470) Fix sh spacing issues
-* [pr#4434](https://github.com/chef/chef/pull/4434) adds EOFError message to handlers
-* [pr#4422](https://github.com/chef/chef/pull/4422) Add an apt_update resource
-* [pr#4287](https://github.com/chef/chef/pull/4287) Default Chef with FIPS OpenSSL to use sign v1.3
-* [pr#4461](https://github.com/chef/chef/pull/4461) debian-6 is EOL next month
-* [pr#4460](https://github.com/chef/chef/pull/4460) Set range of system user/group id to max of 200
-* [pr#4231](https://github.com/chef/chef/pull/4231) zypper multipackage patch
-* [pr#4459](https://github.com/chef/chef/pull/4459) use require_paths and not path so bundler grabs all paths from a git reference
-* [pr#4450](https://github.com/chef/chef/pull/4450) don't warn about ambiguous property usage
-* [pr#4445](https://github.com/chef/chef/pull/4445) Add CBGB to the repository
-* [pr#4423](https://github.com/chef/chef/pull/4423) Add deprecation warnings to Chef::REST and all json_creates
-* [pr#4439](https://github.com/chef/chef/pull/4439) Sometimes chocolately doesn't appear on the path
-* [pr#4432](https://github.com/chef/chef/pull/4432) add get_rest etc calls to ServerAPI
-* [pr#4435](https://github.com/chef/chef/pull/4435) add nokogiri to omnibus-chef
-* [pr#4419](https://github.com/chef/chef/pull/4419) explicitly adding .bat to service executable called by service in case users remove .bat from PATHEXT
-* [pr#4413](https://github.com/chef/chef/pull/4413) configure chef client windows service to the correct chef directory
-* [pr#4377](https://github.com/chef/chef/pull/4377) fixing candidate filtering and adding functional tests for chocolatey_package
-* [pr#4406](https://github.com/chef/chef/pull/4406) Updating to the latest release of net-ssh to consume https://github.com/net-ssh/net-ssh/pull/280
-* [pr#4405](https://github.com/chef/chef/pull/4405) ServerAPI will return a raw hash, so do that
-* [pr#4400](https://github.com/chef/chef/pull/4400) inflate an environment after loading it
-* [pr#4396](https://github.com/chef/chef/pull/4396) Remove duplicate initialization of @password in user_v1
-* [pr#4344](https://github.com/chef/chef/pull/4344) Warn (v. info) when reloading resources
-* [pr#4369](https://github.com/chef/chef/pull/4369) Migrate omnibus-chef project/software definitions for chef in here
-* [pr#4106](https://github.com/chef/chef/pull/4106) add chocolatey_package to core chef
-* [pr#4321](https://github.com/chef/chef/pull/4321) fix run_as_user of windows_service
-* [pr#4333](https://github.com/chef/chef/pull/4333) no longer wait on node search to refresh vault but pass created ApiCient instead
-* [pr#4325](https://github.com/chef/chef/pull/4325) Pin win32-eventlog to 0.6.3 to avoid clashing CreateEvent definition
-* [pr#4312](https://github.com/chef/chef/pull/4312) Updates the template to use omnitruck-direct.chef.io
-* [pr#4277](https://github.com/chef/chef/pull/4277) non msi packages must explicitly provide a source attribute on install
-* [pr#4309](https://github.com/chef/chef/pull/4309) tags always an array; fix set_unless
-* [pr#4278](https://github.com/chef/chef/pull/4278) make file resource use properties
-* [pr#4288](https://github.com/chef/chef/pull/4288) Fix no_proxy setting in chef-config
-* [pr#4273](https://github.com/chef/chef/pull/4273) Use signing protocol 1.1 by default
-* [pr#4520](https://github.com/chef/chef/pull/4520) Fix a few `dsc_resource` bugs
-
-## 12.6.0
-
-* [**Dave Eddy**](https://github.com/bahamas10)
- [pr#3187](https://github.com/chef/chef/pull/3187) overhaul solaris SMF service provider
-* [**Mikhail Zholobov**](https://github.com/legal90)
- - [pr#3192](https://github.com/chef/chef/pull/3192) provider/user/dscl: Set default gid to 20
- - [pr#3193](https://github.com/chef/chef/pull/3193) provider/user/dscl: Set "comment" default value
-* [**Jordan Evans**](https://github.com/jordane)
- - [pr#3263](https://github.com/chef/chef/pull/3263) `value_for_platform` should use `Chef::VersionConstraint::Platform`
- - [pr#3633](https://github.com/chef/chef/pull/3633) add the word group to `converge_by` call for group provider
-* [**Scott McGillivray**](https://github.com/thechile)
- [pr#3450](https://github.com/chef/chef/pull/3450) Fix 'knife cookbook show' to work on root files
-* [**Aubrey Holland**](https://github.com/aub)
- [pr#3986](https://github.com/chef/chef/pull/3986) fix errors when files go away during chown
-* [**James Michael DuPont**](https://github.com/h4ck3rm1k3)
- [pr#3973](https://github.com/chef/chef/pull/3973) better error reporting
-* [**Michael Pereira**](https://github.com/MichaelPereira)
- [pr#3968](https://github.com/chef/chef/pull/3968) Fix cookbook installation from supermarket on windows
-* [**Yukihiko SAWANOBORI**](https://github.com/sawanoboly)
- - [pr#3941](https://github.com/chef/chef/pull/3941) allow reboot by reboot resource with chef-apply
- - [pr#3900](https://github.com/chef/chef/pull/3900) Add new option json attributes file to bootstraping
-* [**permyakovsv**](https://github.com/permyakovsv)
- [pr#3901](https://github.com/chef/chef/pull/3901) Add tmux-split parameter to knife ssh
-* [**Evan Gilman**](https://github.com/evan2645)
- [pr#3864](https://github.com/chef/chef/pull/3864) Knife `bootstrap_environment` should use Explicit config before Implicit
-* [**Ranjib Dey**](https://github.com/ranjib)
- [pr#3834](https://github.com/chef/chef/pull/3834) Dont spit out stdout and stderr for execute resource failure, if its declared sensitive
-* [**Jeff Blaine**](https://github.com/jblaine)
- - [pr#3776](https://github.com/chef/chef/pull/3776) Changes --hide-healthy to --hide-by-mins MINS
- - [pr#3848](https://github.com/chef/chef/pull/3848) Migrate to --ssh-identity-file instead of --identity-file
-* [**dbresson**](https://github.com/dbresson)
- [pr#3650](https://github.com/chef/chef/pull/3650) Define == for node objects
-* [**Patrick Connolly**](https://github.com/patcon)
- [pr#3529](https://github.com/chef/chef/pull/3529) Allow user@hostname format for knife-bootstrap
-* [**Justin Seubert**](https://github.com/dude051)
- [pr#4160](https://github.com/chef/chef/pull/4160) Correcting regex for upstart_state
-* [**Sarah Michaelson**](https://github.com/skmichaelson)
- [pr#3810](https://github.com/chef/chef/pull/3810) GH-1909 Add validation for chef_server_url
-* [**Maxime Brugidou**](https://github.com/brugidou)
- [pr#4052](https://github.com/chef/chef/pull/4052) Add make_child_entry in ChefFS CookbookSubdir
-* [**Nathan Williams**](https://github.com/nathwill)
- [pr#3836](https://github.com/chef/chef/pull/3836) simplify service helpers
-* [**Paul Welch**](https://github.com/pwelch)
- [pr#4066](https://github.com/chef/chef/pull/4066) Fix chef-apply usage banner
-* [**Mat Schaffer**](https://github.com/matschaffer)
- [pr#4153](https://github.com/chef/chef/pull/4153) Require ShellOut before Knife::SSH definition
-* [**Donald Guy**](https://github.com/donaldguy)
- [pr#4158](https://github.com/chef/chef/pull/4158) Allow named_run_list to be loaded from config
-* [**Jos Backus**](https://github.com/josb)
- [pr#4064](https://github.com/chef/chef/pull/4064) Ensure that tags are properly initialized
-* [**John Bellone**](https://github.com/johnbellone)
- [pr#4101](https://github.com/chef/chef/pull/4101) Adds alias method upgrade_package for solaris package
-* [**Nolan Davidson**](https://github.com/nsdavidson)
- [pr#4014](https://github.com/chef/chef/pull/4014) Adding ksh resource
-
-* [pr#4193](https://github.com/chef/chef/pull/4196) support for inno, nsis, wise and installshield installer types in windows_package resource
-* [pr#4196](https://github.com/chef/chef/pull/4196) multipackage dpkg_package and bonus fixes
-* [pr#4185](https://github.com/chef/chef/pull/4185) dpkg provider cleanup
-* [pr#4165](https://github.com/chef/chef/pull/4165) Multipackage internal API improvements
-* [pr#4081](https://github.com/chef/chef/pull/4081) RFC-037: add `chef_version` and `ohai_version` metadata
-* [pr#3530](https://github.com/chef/chef/pull/3530) Allow using --sudo option with user's home folder in knife bootstrap
-* [pr#3858](https://github.com/chef/chef/pull/3858) Remove duplicate 'Accept' header in spec
-* [pr#3911](https://github.com/chef/chef/pull/3911) Avoid subclassing Struct.new
-* [pr#3990](https://github.com/chef/chef/pull/3990) Use SHA256 instead of MD5 for `registry_key` when data is not displayable
-* [pr#4034](https://github.com/chef/chef/pull/4034) add optional ruby-profiling with --profile-ruby
-* [pr#3119](https://github.com/chef/chef/pull/3119) allow removing user, even if their GID isn't resolvable
-* [pr#4068](https://github.com/chef/chef/pull/4068) update messaging from LWRP to Custom Resource in logging and spec
-* [pr#4021](https://github.com/chef/chef/pull/4021) add missing requires for Chef::DSL::Recipe to LWRPBase
-* [pr#3597](https://github.com/chef/chef/pull/3597) print STDOUT from the powershell_script
-* [pr#4091](https://github.com/chef/chef/pull/4091) Allow downloading of root_files in a chef repository
-* [pr#4112](https://github.com/chef/chef/pull/4112) Update knife bootstrap command to honor --no-color flag in chef-client run that is part of the bootstrap process.
-* [pr#4090](https://github.com/chef/chef/pull/4090) Improve detection of ChefFS-based commands in `knife rehash`
-* [pr#3991](https://github.com/chef/chef/pull/3991) Modify remote_file cache_control_data to use sha256 for its name
-* [pr#4079](https://github.com/chef/chef/pull/4079) add logger to windows service shellout
-* [pr#3966](https://github.com/chef/chef/pull/3966) Report expanded run list json tree to reporting
-* [pr#4080](https://github.com/chef/chef/pull/4080) Make property modules possible
-* [pr#4069](https://github.com/chef/chef/pull/4069) Improvements to log messages
-* [pr#4049](https://github.com/chef/chef/pull/4049) Add gemspec files to allow bundler to run from the gem
-* [pr#4029](https://github.com/chef/chef/pull/4029) Fix search result pagination
-* [pr#4048](https://github.com/chef/chef/pull/4048) Accept coercion as a way to accept nil values
-* [pr#4046](https://github.com/chef/chef/pull/4046) ignore gid in the user resource on windows
-* [pr#4118](https://github.com/chef/chef/pull/4118) Make Property.derive create derived properties of the same type
-* [pr#4133](https://github.com/chef/chef/pull/4133) Add retries to `Chef::HTTP` for transient SSL errors
-* [pr#4135](https://github.com/chef/chef/pull/4135) Windows service uses log file location from config if none is given on commandline
-* [pr#4142](https://github.com/chef/chef/pull/4142) Use the proper python interpretor for yum-dump.py on Fedora 21
-* [pr#4149](https://github.com/chef/chef/pull/4149) Handle nil run list option in knife bootstrap
-* [pr#4040](https://github.com/chef/chef/pull/4040) Implement live streaming for execute resources
-* [pr#4167](https://github.com/chef/chef/pull/4167) Add `reboot_action` to `dsc_resource`
-* [pr#4167](https://github.com/chef/chef/pull/4167) Allow `dsc_resource` to run with the LCM enabled
-* [pr#4188](https://github.com/chef/chef/pull/4188) Update `dsc_resource` to use verbose stream output
-* [pr#4200](https://github.com/chef/chef/pull/4200) Prevent inspect of PsCredential from printing out plain text password
-* [pr#4237](https://github.com/chef/chef/pull/4237) Enabling 'knife ssl check/fetch' commands to respect proxy environment variables and moving proxy environment variables export to Chef::Config
-## 12.5.1
-
-* [**Ranjib Dey**](https://github.com/ranjib):
- [pr#3588](https://github.com/chef/chef/pull/3588) Count skipped resources among total resources in doc formatter
-* [**John Kerry**](https://github.com/jkerry):
- [pr#3539](https://github.com/chef/chef/pull/3539) Fix issue: registry\_key resource is case sensitive in chef but not on windows
-* [**David Eddy**](https://github.com/bahamas10):
- - [pr#3443](https://github.com/chef/chef/pull/3443) remove extraneous space
- - [pr#3091](https://github.com/chef/chef/pull/3091) fix locking/unlocking users on SmartOS
-* [**margueritepd**](https://github.com/margueritepd):
- [pr#3693](https://github.com/chef/chef/pull/3693) Interpolate `%{path}` in verify command
-* [**Jeremy Fleischman**](https://github.com/jfly):
- [pr#3383](https://github.com/chef/chef/pull/3383) gem\_package should install to the systemwide Ruby when using ChefDK
-* [**Stefano Rivera**](https://github.com/stefanor):
- [pr#3657](https://github.com/chef/chef/pull/3657) fix upstart status\_commands
-* [**ABE Satoru**](https://github.com/polamjag):
- [pr#3764](https://github.com/chef/chef/pull/3764) uniquify chef\_repo\_path
-* [**Renan Vicente**](https://github.com/renanvicente):
- [pr#3771](https://github.com/chef/chef/pull/3771) add depth property for deploy resource
-* [**James Belchamber**](https://github.com/JamesBelchamber):
- [pr#1796](https://github.com/chef/chef/pull/1796): make mount options aware
-* [**Nate Walck**](https://github.com/natewalck):
- - [pr#3594](https://github.com/chef/chef/pull/3594): Update service provider for OSX 10.11
- - [pr#3704](https://github.com/chef/chef/pull/3704): Add SIP (OS X 10.11) support
-* [**Phil Dibowitz**](https://github.com/jaymzh):
- [pr#3805](https://github.com/chef/chef/pull/3805) LWRP parameter validators should use truthiness
-* [**Igor Shpakov**](https://github.com/Igorshp):
- [pr#3743](https://github.com/chef/chef/pull/3743) speed improvement for `remote_directory` resource
-* [**James FitzGibbon**](https://github.com/jf647):
- [pr#3027](https://github.com/chef/chef/pull/3027) Add warnings to 'knife node run list remove ...'
-* [**Backslasher**](https://github.com/backslasher):
- [pr#3172](https://github.com/chef/chef/pull/3172) Migrated deploy resource to use shell\_out instead of run\_command
-* [**Sean Walberg**](https://github.com/swalberg):
- [pr#3190](https://github.com/chef/chef/pull/3190) Allow tags to be set on a node during bootstrap
-* [**ckaushik**](https://github.com/ckaushik) and [**Sam Dunne**](https://github.com/samdunne):
- [pr#3510](https://github.com/chef/chef/pull/3510) Fix broken rendering
-of partial templates.
-* [**Simon Detheridge**](https://github.com/gh2k):
- [pr#3806](https://github.com/chef/chef/pull/3806) Replace output\_of\_command with shell\_out! in subversion provider
-* [**Joel Handwell**](https://github.com/joelhandwell):
- [pr#3821](https://github.com/chef/chef/pull/3821) Human friendly elapsed time in log
-
-* [pr#3985](https://github.com/chef/chef/pull/3985) Simplify the regex which determines the rpm version to resolve issue #3671
-* [pr#3928](https://github.com/chef/chef/pull/3928) Add named run list support when using policyfiles
-* [pr#3913](https://github.com/chef/chef/pull/3913) Add `policy_name`and `policy_group` fields to the node object
-* [pr#3875](https://github.com/chef/chef/pull/3875) Patch Win32::Registry#delete_key, #delete_value to use wide (W) APIs
-* [pr#3850](https://github.com/chef/chef/pull/3850) Patch Win32::Registry#write to fix encoding errors
-* [pr#3837](https://github.com/chef/chef/pull/3837) refactor remote_directory provider for mem+perf improvement
-* [pr#3799](https://github.com/chef/chef/pull/3799) fix supports hash issues in service providers
-* [pr#3797](https://github.com/chef/chef/pull/3797) Fix dsc_script spec failure on 64-bit Ruby
-* [pr#3817](https://github.com/chef/chef/pull/3817) Remove now-useless forcing of ruby Garbage Collector run
-* [pr#3775](https://github.com/chef/chef/pull/3775) Enable 64-bit support for Powershell and Batch scripts
-* [pr#3774](https://github.com/chef/chef/pull/3774) Add support for yum-deprecated in yum provider
-* [pr#3793](https://github.com/chef/chef/pull/3793) CHEF-5372: Support specific `run_levels` for RedHat service
-* [pr#2460](https://github.com/chef/chef/pull/2460) add privacy flag
-* [pr#1259](https://github.com/chef/chef/pull/1259) CHEF-5012: add methods for template breadcrumbs
-* [pr#3656](https://github.com/chef/chef/pull/3656) remove use of self.provides?
-* [pr#3455](https://github.com/chef/chef/pull/3455) powershell\_script: do not allow suppression of syntax errors
-* [pr#3519](https://github.com/chef/chef/pull/3519) The wording seemed odd.
-* [pr#3208](https://github.com/chef/chef/pull/3208) Missing require (require what you use).
-* [pr#3449](https://github.com/chef/chef/pull/3449) correcting minor typo in user\_edit knife action
-* [pr#3572](https://github.com/chef/chef/pull/3572) Use windows paths without case-sensitivity.
-* [pr#3666](https://github.com/chef/chef/pull/3666) Support SNI in `knife ssl check`.
-* [pr#3667](https://github.com/chef/chef/pull/3667) Change chef service to start as 'Automatic delayed start'.
-* [pr#3683](https://github.com/chef/chef/pull/3683) Correct Windows reboot command to delay in minutes, per the property.
-* [pr#3698](https://github.com/chef/chef/pull/3698) Add ability to specify dependencies in chef-service-manager.
-* [pr#3728](https://github.com/chef/chef/pull/3728) Rewrite NetLocalGroup things to use FFI
-* [pr#3754](https://github.com/chef/chef/pull/3754) Fix functional tests for group resource - fix #3728
-* [pr#3498](https://github.com/chef/chef/pull/3498) Use dpkg-deb directly rather than regex
-* [pr#3759](https://github.com/chef/chef/pull/3759) Repair service convergence test on AIX
-* [pr#3329](https://github.com/chef/chef/pull/3329) Use ifconfig target property
-* [pr#3652](https://github.com/chef/chef/pull/3652) Fix explanation for configuring audit mode in client.rb
-* [pr#3687](https://github.com/chef/chef/pull/3687) Add formatter and force-logger/formatter options to chef-apply
-* [pr#3768](https://github.com/chef/chef/pull/3768) Make reboot\_pending? look for CBS RebootPending
-* [pr#3815](https://github.com/chef/chef/pull/3815) Fix `powershell_script` validation to use correct architecture
-* [pr#3772](https://github.com/chef/chef/pull/3772) Add `ps_credential` dsl method to `dsc_script`
-* [pr#3462](https://github.com/chef/chef/pull/3462) Fix issue where `ps_credential` does not work over winrm
-
-## 12.4.1
-
-* [**Noah Kantrowitz**](https://github.com/coderanger):
- [pr#3605](https://github.com/chef/chef/pull/3605) Rework `Resource#action` to match 12.3 API
-
-* [pr#3586](https://github.com/chef/chef/issues/3586) Fix bug preventing light weight resources from being used with heavy weight providers
-* [Issue #3593](https://github.com/chef/chef/issues/3593) Fix bug where provider priority map did not take into consideration a provided block
-* [pr#3630](https://github.com/chef/chef/pull/3630) Restore Chef::User and Chef::ApiClient namespace to API V0 functionality and move new functionality into Chef::UserV1 and Chef::ApiClientV1 until Chef 13.
-* [pr#3611](https://github.com/chef/chef/pull/3611) Call `provides?` even if `provides` is not called
-* [pr#3589](https://github.com/chef/chef/pull/3589) Fix errant bashisms
-* [pr#3620](https://github.com/chef/chef/pull/3620) Fix issue where recipe names in run list mutate when version constaints are present
-* [pr#3623](https://github.com/chef/chef/pull/3623) Allow LWRPs to access the real class when accessed through `Chef::Resource` and `Chef::Provider`
-* [pr#3627](https://github.com/chef/chef/pull/3627) Separate priority map and DSL handler map so that `provides` has veto power over priority
-* [pr#3638](https://github.com/chef/chef/pull/3638) Deprecate passing more than 1 argument to create a resource
-
-## 12.4.0
-
-* [**Phil Dibowitz**](https://github.com/jaymzh):
- Fix multipackage and architectures
-* [**Igor Shpakov**](https://github.com/Igorshp):
- Always run exception handlers
- Prioritise manual ssh attribute over automatic ones for knife
-* [**Noah Kantrowitz**](https://github.com/coderanger):
- Cache service\_resource\_providers for the duration of the run. #2953
-* [**Slava Kardakov**](https://github.com/ojab):
- Fix installation of yum packages with version constraints #3155
-* [**Dave Eddy**](https://github.com/bahamas10):
- fix smartos\_package for new "pkgin" output, fixes #3112 #3165
-* [**Yukihiko SAWANOBORI**](https://github.com/sawanoboly):
- Show Chef version on chef shell prompt
-* [**Jacob Minshall**](https://github.com/minshallj):
- Ensure suid bit is preserved if group or owner changes
-* [**Tim Smith**](https://github.com/tas50):
- Convert wiki links to point to docs.chef.io
-* [**SAWANOBORI Yukihiko**](https://github.com/sawanoboly):
- Add Chef::Log::Syslog class for integrating sending logs to syslog
-* [**Pavel Yudin**](https://github.com/Kasen):
- Ensure LWRP and HWRP @action variable is consistent #3156
-* [**Dan Bjorge**](https://github.com/dbjorge):
- Fix bad Windows securable\_resource functional spec assumptions for default file owners/groups #3266
-* [**Yukihiko SAWANOBORI**](https://github.com/sawanoboly): Pass name by
- knife cil attribute [pr#3195](https://github.com/chef/chef/pull/3195)
-* [**Torben Knerr**](https://github.com/tknerr):
- Allow knife sub-command loader to match platform specific gems. [pr#3281](https://github.com/chef/chef/pull/3281)
-* [**Steve Lowe**](https://github.com/SteveLowe):
- Fix copying ntfs dacl and sacl when they are nil. [pr#3066](https://github.com/chef/chef/pull/3066)
-
-* [pr#3339](https://github.com/chef/chef/pull/3339): Powershell command wrappers to make argument passing to knife/chef-client etc. easier.
-* [pr#3720](https://github.com/chef/chef/pull/3270): Extract chef's configuration to a separate gem. Code stays in the Chef git repo.
-* [pr#3321](https://github.com/chef/chef/pull/3321): Add an integration test of chef-client with empty ENV.
-* [pr#3278](https://github.com/chef/chef/pull/3278): Switch over Windows builds to universal builds.
-* [pr#2877](https://github.com/chef/chef/pull/2877): Convert bootstrap template to use sh.
-* [Issue #3316](https://github.com/chef/chef/issues/3316): Fix idempotency issues with the `windows_package` resource
-* [pr#3295](https://github.com/chef/chef/pull/3295): Stop mutating `new_resource.checksum` in file providers. Fixes some ChecksumMismatch exceptions like [issue#3168](https://github.com/chef/chef/issues/3168)
-* [pr#3320](https://github.com/chef/chef/pull/3320): Sanitize non-UTF8 characters in the node data before doing node.save(). Works around many UTF8 exception issues reported on node.save().
-* Implemented X-Ops-Server-API-Version with a API version of 0, as well as error handling when the Chef server does not support the API version that the client supports.
-* [pr#3327](https://github.com/chef/chef/pull/3327): Fix unreliable AIX service group parsing mechanism.
-* [pr#3333](https://github.com/chef/chef/pull/3333): Fix SSL errors when connecting to private Supermarkets
-* [pr#3340](https://github.com/chef/chef/pull/3340): Allow Event dispatch subscribers to be inspected.
-* [Issue #3055](https://github.com/chef/chef/issues/3055): Fix regex parsing for recipe failures on Windows
-* [pr#3345](https://github.com/chef/chef/pull/3345): Windows Event log logger
-* [pr#3336](https://github.com/chef/chef/pull/3336): Remote file understands UNC paths
-* [pr#3269](https://github.com/chef/chef/pull/3269): Deprecate automatic recipe DSL for classes in `Chef::Resource`
-* [pr#3360](https://github.com/chef/chef/pull/3360): Add check_resource_semantics! lifecycle method to provider
-* [pr#3344](https://github.com/chef/chef/pull/3344): Rewrite Windows user resouce code to use ffi instead of win32-api
-* [pr#3318](https://github.com/chef/chef/pull/3318): Modify Windows package provider to allow for url source
-* [pr#3381](https://github.com/chef/chef/pull/3381): warn on cookbook self-deps
-* [pr#2312](https://github.com/chef/chef/pull/2312): fix `node[:recipes]` duplication, add `node[:cookbooks]` and `node[:expanded_run_list]`
-* [pr#3325](https://github.com/chef/chef/pull/3325): enforce passing a node name with validatorless bootstrapping
-* [pr#3398](https://github.com/chef/chef/pull/3398): Allow spaces in files for the `remote_file` resource
-* [Issue #3010](https://github.com/chef/chef/issues/3010) Fixed `knife user` for use with current and future versions of Chef Server 12, with continued backwards compatible support for use with Open Source Server 11.
-* [pr#3438](https://github.com/chef/chef/pull/3438) Server API V1 support. Vast improvements to and testing expansion for Chef::User, Chef::ApiClient, and related knife commands. Deprecated Open Source Server 11 user support to the Chef::OscUser and knife osc_user namespace, but with backwards compatible support via knife user.
-* [Issue #2247](https://github.com/chef/chef/issues/2247): `powershell_script` returns 0 for scripts with syntax errors
-* [pr#3080](https://github.com/chef/chef/pull/3080): Issue 2247: `powershell_script` exit status should be nonzero for syntax errors
-* [pr#3441](https://github.com/chef/chef/pull/3441): Add `powershell_out` mixin to core chef
-* [pr#3448](https://github.com/chef/chef/pull/3448): Fix `dsc_resource` to work with wmf5 april preview
-* [pr#3392](https://github.com/chef/chef/pull/3392): Comment up `Chef::Client` and privatize/deprecate unused things
-* [pr#3419](https://github.com/chef/chef/pull/3419): Fix cli issue with `chef_repo_path` when ENV variable is unset
-* [pr#3358](https://github.com/chef/chef/pull/3358): Separate audit and converge failures
-* [pr#3431](https://github.com/chef/chef/pull/3431): Fix backups on windows for the file resource
-* [pr#3397](https://github.com/chef/chef/pull/3397): Validate owner exists in directory resources
-* [pr#3418](https://github.com/chef/chef/pull/3418): Add `shell_out` mixin to Chef::Resource class for use in `not_if`/`only_if` conditionals, etc.
-* [pr#3406](https://github.com/chef/chef/pull/3406): Add wide-char 'Environment' to `broadcast_env_change` mixin for setting windows environment variables
-* [pr#3442](https://github.com/chef/chef/pull/3442): Add `resource_name` to top-level Resource class to make defining resources easier.
-* [pr#3447](https://github.com/chef/chef/pull/3447): Add `allowed_actions` and `default_action` to top-level Resource class.
-* [pr#3475](https://github.com/chef/chef/pull/3475): Fix `shell_out` timeouts in all package providers to respect timeout property on the resource.
-* [pr#3477](https://github.com/chef/chef/pull/3477): Update `zypper_package` to look like the rest of our package classes.
-* [pr#3483](https://github.com/chef/chef/pull/3483): Allow `include_recipe` from LWRP providers.
-* [pr#3495](https://github.com/chef/chef/pull/3495): Make resource name automatically determined from class name, and provide DSL for it.
-* [pr#3497](https://github.com/chef/chef/pull/3497): Issue 3485: Corruption of node's run\_context when non-default guard\_interpreter is evaluated
-* [pr#3299](https://github.com/chef/chef/pull/3299): Remove experimental warning on audit mode
-
-## 12.3.0
-
-* [pr#3160](https://github.com/chef/chef/pull/3160): Use Chef Zero in
- socketless mode for local mode, add `--no-listen` flag to disable port
- binding
-* [**Nolan Davidson**](https://github.com/nsdavidson):
- Removed after_created and added test to recipe_spec
-* [**Tim Sogard**](https://github.com/drags):
- Reset $HOME to user running chef-client when running via sudo
-* [**Torben Knerr**](https://github.com/tknerr):
- Allow for the chef gem installation to succeed without elevated privileges #3126
-* [**Mike Dodge**](https://github.com/mikedodge04)
- MacOSX services: Load LaunchAgents as console user, adding plist and
- session_type options.
-* [**Eric Herot**](https://github.com/eherot)
- Ensure knife ssh doesn't use a non-existant field for hostname #3131
-* [**Tom Hughes**](https://github.com/tomhughes)
- Ensure searches progress in the face of incomplete responses #3135
-
-* [pr#3162](https://github.com/chef/chef/pull/3162): Add
- `--minimal-ohai` flag to client/solo/apply; restricts ohai to only the
- bare minimum of plugins.
-* Ensure link's path attribute works with delayed #3130
-* gem_package, chef_gem should not shell out to using https://rubygems.org #2867
-* Add dynamic resource resolution similar to dynamic provider resolution
-* Add Chef class fascade to internal structures
-* Fix nil pointer for windows event logger #3200
-* Use partial search for knife status
-* Ensure chef/knife properly honours proxy config
-
-## 12.2.1
-* [Issue 3153](https://github.com/chef/chef/issues/3153): Fix bug where unset HOME would cause chef to crash
-
-## 12.2.0
-* Update policyfile API usage to match forthcoming Chef Server release
-* `knife ssh` now has an --exit-on-error option that allows users to
- fail-fast rather than moving on to the next machine.
-* migrate macosx, windows, openbsd, and netbsd resources to dynamic resolution
-* migrate cron and mdadm resources to dynamic resolution
-* [Issue 3096](https://github.com/chef/chef/issues/3096) Fix OpenBSD package provider installation issues
-* New `dsc_resource` resource to invoke Powershell DSC resources
-
-## 12.1.2
-* [Issue 3022](https://github.com/chef/chef/issues/3022): Homebrew Cask install fails
- FIXME (remove on 12.2.0 release): 3022 was only merged to 12-stable and #3077 or its descendant should fix this
-* [Issue 3059](https://github.com/chef/chef/issues/3059): Chef 12.1.1 yum_package silently fails
-* [Issue 3078](https://github.com/chef/chef/issues/3078): Compat break in audit-mode changes
-
-## 12.1.1
-* [**Phil Dibowitz**](https://github.com/jaymzh):
- [Issue 3008](https://github.com/chef/chef/issues/3008) Allow people to pass in `source` to package
-* [Issue 3011](https://github.com/chef/chef/issues/3011) `package` provider base should include
- `Chef::Mixin::Command` as there are still providers that use it.
-* [**Ranjib Dey**](https://github.com/ranjib):
- [Issue 3019](https://github.com/chef/chef/issues/3019) Fix data fetching when explicit attributes are passed
-
-## 12.1.0
-
-* [**Andre Elizondo**](https://github.com/andrewelizondo)
- Typo fixes
-* [**Vasiliy Tolstov**](https://github.com/vtolstov):
- cleanup cookbook path from stale files (when using chef-solo with a tarball url)
-* [**Nathan Cerny**](https://github.com/ncerny):
- Fix rubygems provider to use https instead of http.
-* [**Anshul Sharma**](https://github.com/justanshulsharma)
- removed securerandom patch
-* [**Scott Bonds**](https://github.com/bonds)
- add package support for OpenBSD
-* [**Lucy Wyman**](https://github.com/lucywyman)
- Added support for handling empty version strings to rubygems provider.
-* [**Yulian Kuncheff**](https://github.com/Daegalus)
- Correctly set the pre-release identifier during knife bootstrap.
-* [**Anshul Sharma**](https://github.com/justanshulsharma)
- `knife node run_list remove` now accepts run_list options in the same form as add
-* [**Veres Lajos**](https://github.com/vlajos)
- Typo fixes
-* [**Tim Smith**](https://github.com/tas50)
- Typo fixes
-* [Pull 2505](https://github.com/chef/chef/pull/2505) Make Chef handle URIs in a case-insensitive manner
-* [**Phil Dibowitz**](https://github.com/jaymzh):
- Drop SSL warnings now that we have a safe default
-* [Pull 2684](https://github.com/chef/chef/pull/2684) Remove ole_initialize/uninitialize which cause problems with Ruby >= 2
-* [**BinaryBabel**](https://github.com/binarybabel)
- Make knife cookbook site share prefer gnutar when packaging
-* [**Dave Eddy**](https://github.com/bahamas10)
- Support arrays for not_if and only_if
-* [**Scott Bonds**](https://github.com/bonds)
- Add service provider for OpenBSD
-* [**Alex Slynko**](https://github.com/alex-slynko-wonga)
- Change env provider to preserve ordering
-* [**Rob Redpath**](https://github.com/robredpath)
- Add --lockfile opt for chef-client and chef-solo
-* [**Josh Murphy**](https://github.com/jdmurphy)
- Check cookbooks exist in path(s) before attempting to upload them with --all
-* [**Vasiliy Tolstov**](https://github.com/vtolstov)
- add ability to fetch recipes like in chef-solo when using local-mode
-* [**Jan**](https://github.com/habermann24)
- FIX data_bag_item.rb:161: warning: circular argument reference - data_bag
-* [**David Radcliffe**](https://github.com/dwradcliffe)
- add banner for knife serve command
-* [**Yukihiko Sawanobori**](https://github.com/sawanoboly)
- use Chef::JSONCompat.parse for file_contents
-* [**Xabier de Zuazo**] (https://github.com/zuazo)
- Remove some simple Ruby 1.8 and 1.9 code
-* [**Xabier de Zuazo**] (https://github.com/zuazo)
- Remove all RSpec test filters related to Ruby 1.8 and 1.9
-* [**Xabier de Zuazo**] (https://github.com/zuazo)
- Fix knife cookbook upload messages
-* [**David Crowder**] (https://github.com/david-crowder)
- refactor to use shell_out in rpm provider
-* [**Phil Dibowitz**](https://github.com/jaymzh):
- Multi-package support
-* [**Naotoshi Seo**](https://github.com/sonots):
- Support HTTP/FTP source on rpm_package
- add json_attribs option for chef-apply command
- allow_downgrade in rpm_package
-* [**AJ Christensen**](https://github.com/fujin):
- Isolate/fix the no-fork fault. [Issue 2709](https://github.com/chef/chef/issues/2709)
-* [**Cory Stephenson**](https://github.com/Aevin1387):
- Remove comments of a service being enabled/disabled in FreeBSD. [Fixes #1791](https://github.com/chef/chef/issues/1791)
-* [**Will Albenzi**](https://github.com/walbenzi):
- CHEF-4591: Knife commands to manipulate env_run_list on nodes
-* [**Jon Cowie**](https://github.com/jonlives):
- CHEF-2911: Fix yum_package provider to respect version requirements in package name and version attribute
-* [**Anshul Sharma**](https://github.com/justanshulsharma):
- * Node::Attribute to_s should print merged attributes [Issue 1526](https://github.com/chef/chef/issues/1562)
- * Access keys attribute in `knife show` list incorrect information [Issue 1974](https://github.com/chef/chef/issues/1974)
- * Guard interpreter loading incorrect resource [Issue 2683](https://github.com/chef/chef/issues/2683)
-
-### Chef Contributions
-* ruby 1.9.3 support is dropped
-* Update Chef to use RSpec 3.2
-* Cleaned up script and execute provider + specs
-* Added deprecation warnings around the use of command attribute in script resources
-* Audit mode feature added - see the RELEASE_NOTES for details
-* shell_out now sets `LANGUAGE` and `LANG` to the `Chef::Config[:internal_locale]` in addition to `LC_ALL` forcing
-* chef_gem supports a compile_time flag and will warn if it is not set (behavior will change in the future)
-* suppress CHEF-3694 warnings on the most trivial resource cloning
-* fixed bugs in the deep_merge_cache logic introduced in 12.0.0 around `node['foo']` vs `node[:foo]` vs. `node.foo`
-* add `include_recipe "::recipe"` sugar to reference a recipe in the current cookbook
-* Add --proxy-auth option to `knife raw`
-* added Chef::Org model class for Chef Organizations in Chef 12 Server
-* `powershell_script` should now correctly get the exit code for scripts that it runs. See [Issue 2348](https://github.com/chef/chef/issues/2348)
-* Useradd functional tests fail randomly
-* Add comments to trusted_certs_content
-* fixes a bug where providers would not get defined if a top-level ruby constant with the same name was already defined (ark cookbook, chrome cookbook)
-* Fix a bug in `reboot`, `ips_package`, `paludis_package`, `windows_package` resources where `action :nothing` was not permitted
-* Use Chef::ApiClient#from_hash in `knife client create` to avoid json_class requirement. [Issue 2542](https://github.com/chef/chef/issues/2542)
-* Add support for policyfile native API (preview). These APIs are unstable, and you may be forced to delete data uploaded to them in a
- future release, so only use them for demonstration purposes.
-* Deprecation warning for 'knife cookbook test'
-* dsc_script should now correctly honor timeout. See [Issue 2831](https://github.com/chef/chef/issues/2831)
-* Added an `imports` attribute to dsc_script. This attribute allows you to specify DSC resources that need to be imported for your script.
-* Fixed error where guard resources (using :guard_interpreter) were not ran in `why_run` mode [Issue 2694](https://github.com/chef/chef/issues/2694)
-* Add `verify` method to File resource per RFC027
-* Move supermarket.getchef.com to supermarket.chef.io
-* Check with AccessCheck for permission to write to directory on Windows
-* Add declare_resource/build_resource comments, fix faulty ||=
-* Knife bootstrap creates a client and ships it to the node to implement validatorless bootstraps
-* Knife bootstrap can use the client it creates to setup chef-vault items for the node
-* windows service now has a configurable timeout
-
-## 12.0.3
-* [**Phil Dibowitz**](https://github.com/jaymzh):
-[Issue 2594](https://github.com/chef/chef/issues/2594) Restore missing require in `digester`.
-
-## 12.0.2
-* [Issue 2578](https://github.com/chef/chef/issues/2578) Check that `installed` is not empty for `keg_only` formula in Homebrew provider
-* [Issue 2609](https://github.com/chef/chef/issues/2609) Resolve the circular dependency between ProviderResolver and Resource.
-* [Issue 2596](https://github.com/chef/chef/issues/2596) Fix nodes not writing to disk
-* [Issue 2580](https://github.com/chef/chef/issues/2580) Make sure the relative paths are preserved when using link resource.
-* [Pull 2630](https://github.com/chef/chef/pull/2630) Improve knife's SSL error messaging
-* [Issue 2606](https://github.com/chef/chef/issues/2606) chef 12 ignores default_release for apt_package
-* [Issue 2602](https://github.com/chef/chef/issues/2602) Fix `subscribes` resource notifications.
-* [Issue 2578](https://github.com/chef/chef/issues/2578) Check that `installed` is not empty for `keg_only` formula in Homebrew provider.
-* [**gh2k**](https://github.com/gh2k):
- [Issue 2625](https://github.com/chef/chef/issues/2625) Fix missing `shell_out!` for `windows_package` resource
-* [**BackSlasher**](https://github.com/BackSlasher):
- [Issue 2634](https://github.com/chef/chef/issues/2634) Fix `option ':command' is not a valid option` error in subversion provider.
-* [**Seth Vargo**](https://github.com/sethvargo):
- [Issue 2345](https://github.com/chef/chef/issues/2345) Allow knife to install cookbooks with metadata.json.
-
-## 12.0.1
-
-* [Issue 2552](https://github.com/chef/chef/issues/2552) Create constant for LWRP before calling `provides`
-* [Issue 2545](https://github.com/chef/chef/issues/2545) `path` attribute of `execute` resource is restored to provide backwards compatibility with Chef 11.
-* [Issue 2565](https://github.com/chef/chef/issues/2565) Fix `Chef::Knife::Core::BootstrapContext` constructor for knife-windows compat.
-* [Issue 2566](https://github.com/chef/chef/issues/2566) Make sure Client doesn't raise error when interval is set on Windows.
-* [Issue 2560](https://github.com/chef/chef/issues/2560) Fix `uninitialized constant Windows::Constants` in `windows_eventlog`.
-* [Issue 2563](https://github.com/chef/chef/issues/2563) Make sure the Chef Client rpm packages are signed with GPG keys correctly.
-
-## 12.0.0
-
-* [**Jesse Hu**](https://github.com/jessehu):
- retry on HTTP 50X Error when calling Chef REST API
-* [**Nolan Davidson**](https://github.com/nsdavidson):
- The chef-apply command now prints usage information when called without arguments
-* [**Kazuki Saito**](https://github.com/sakazuki):
- CHEF-4933: idempotency fixes for ifconfig provider
-* [**Kirill Shirinkin**](https://github.com/Fodoj):
- The knife bootstrap command expands the path of the secret-file
-* [**Malte Swart**](https://github.com/mswart):
- [CHEF-4101] DeepMerge - support overwriting hash values with nil
-* [**James Belchamber**](https://github.com/JamesBelchamber):
- Mount provider remount action now honours options
-* [**Mark Gibbons**](https://github.com/MarkGibbons):
- Fix noauto support in Solaris Mount Provider
-* [**Jordan Evans**](https://github.com/jordane):
- support version constraints in value_for_platform
-* [**Yukihiko Sawanobori**](https://github.com/sawanoboly):
- Add environment resource attribute to scm resources
-* [**Grzesiek Kolodziejczyk**](https://github.com/grk):
- Use thread-safe OpenSSL::Digest instead of Digest
-* [**Grzesiek Kolodziejczyk**](https://github.com/grk):
- Chef::Digester converted to thread-safe Singleton mixin.
-* [**Vasiliy Tolstov**](https://github.com/vtolstov):
- Reload systemd service only if it's running, otherwise start.
-* [**Chris Jerdonek**](https://github.com/cjerdonek):
- knife diagnostic messages sent to stdout instead of stderr
-* [**Xabier de Zuazo**](https://github.com/zuazo):
- Remove the unused StreamingCookbookUploader class (CHEF-4586)
-* [**Jacob Vosmaer**](https://github.com/jacobvosmaer):
- Fix creation of non-empty FreeBSD groups (#1698)
-* [**Nathan Huff**](https://github.com/nhuff):
- Check local repository for ips package installs (#1703)
-* [**Sean Clemmer**](https://github.com/sczizzo):
- Fix "cron" resource handling of special strings (e.g. @reboot, @yearly) (#1708)
-* [**Phil Dibowitz**](https://github.com/jaymzh):
- 'group' provider on OSX properly uses 'dscl' to determine existing groups
-* [**Hugo Lopes Tavares**](https://github.com/hltbra):
- Catch StandardError in Chef::ResourceReporter#post_reporting_data (Issue 1550).
-* [**Daniel O'Connor**](https://github.com/CloCkWeRX):
- Fix regex causing DuplicateRole error (Issue 1739).
-* [**Xeron**](https://github.com/xeron):
- Ability to specify an array for data_bag_path. (CHEF-3399, CHEF-4753)
-* [**Jordan**](https://github.com/jordane):
- Use Systemd for recent Fedora and RHEL 7.
-* [**Xabier de Zuazo**](https://github.com/zuazo):
- Encrypted data bags should use different HMAC key and include the IV in the HMAC (CHEF-5356).
-* [**Pierre Ynard**](https://github.com/linkfanel):
- Don't modify variable passed to env resource when updating.
-* [**Chris Aumann**](https://github.com/chr4):
- Add "force" attribute to resource/user, pass "-f" to userdel. (Issue 1601)
-* [**Brian Cobb**](https://github.com/bcobb):
- Chef::VersionConstraint#to_s should accurately reflect constraint's behavior.
-* [**Kevin Graham**](https://github.com/kgraham):
- Do not override ShellOut:live_stream if already set.
-* [**Mike Heijmans**](https://github.com/parabuzzle):
- Change knife option --force to --delete-validators. (Issue 1652)
-* [**Pavel Yudin**](https://github.com/Kasen):
- Add Parallels Cloud Server (PCS) platform support.
-* [**tbe**](https://github.com/tbe):
- Minor fixes for the Paludis package provider:
- * only search for non-masked packages,
- * increase command timeout length for package installation.
-* [**sawanoboly**](https://github.com/sawanoboly):
- Use shared_path for deploy resource.
-* [**Victor Hahn**](https://github.com/victorhahncastell):
- Add template syntax check to files in the templates/ dir only.
-* [**Jordan**](https://github.com/jordane):
- Allow git provider to checkout existing branch names.
-* [**Eric Herot**](https://github.com/eherot):
- Add whitespace boundaries to some mount point references in mount provider.
-* [**Dave Eddy**](https://github.com/bahamas10):
- Improve the regex for /etc/rc.conf for the FreeBSD service provider
-* [**Stanislav Bogatyrev**](https://github.com/realloc):
- Fetch recipe_url before loading json_attribs in chef-solo (CHEF-5075)
-* [**Mal Graty**](https://github.com/mal):
- Workaround for a breaking change in git's shallow-clone behavior. (Issue 1563)
-* [**Dave Eddy**](https://github.com/bahamas10):
- Fix version detection in FreeBSD pkgng provider. (PR 1980)
-* [**Dan Rathbone**](https://github.com/rathers):
- Fixed gem_package resource to be able to upgrade gems when version is not set.
-* [**Jean Mertz**](https://github.com/JeanMertz):
- Made Chef Client load library folder recursively.
-* [**Eric Saxby**](https://github.com/sax):
- Made Chef Client read the non-root crontab entries as the user specified in the resource.
-* [**sawanoboly**](https://github.com/sawanoboly):
- Added `--dry-run` option to `knife cookbook site share` which displays the files that are to be uploaded to Supermarket.
-* [**Sander van Harmelen**](https://github.com/svanharmelen):
- Fixed `Chef::HTTP` to be able to follow relative redirects.
-* [**Cory Stephenson**](https://github.com/Aevin1387):
- Fixed FreeBSD port package provider to interpret FreeBSD version 10 correctly.
-* [**Brett Chalupa**](https://github.com/brettchalupa):
- Added `source_url` and `issues_url` options to metadata to be used by Supermarket.
-* [**Anshul Sharma**](https://github.com/justanshulsharma):
- Fixed Chef Client to use the `:client_name` instead of `:node_name` during initial client registration.
-* [**tbe**](https://github.com/tbe):
- Fixed Paludis package provider to be able to interpret the package category.
-* [**David Workman**](https://github.com/workmad3):
- Added a more clear error message to chef-apply when no recipe is given.
-* [**Joe Nuspl**](https://github.com/nvwls):
- Added support for `sensitive` property to the execute resource.
-* [**Nolan Davidson**](https://github.com/nsdavidson):
- Added an error message to prevent unintentional running of `exec()` in recipes.
-* [**wacky612**](https://github.com/wacky612):
- Fixed a bug in pacman package provider that was preventing the installation of `bind` package.
-* [**Ionuț Arțăriși**](https://github.com/mapleoin):
- Changed the default service provider to systemd on SLES versions 12 and higher.
-* [**Ionuț Arțăriși**](https://github.com/mapleoin):
- Changed the default group provider to gpasswd on SLES versions 12 and higher.
-* [**Noah Kantrowitz**](https://github.com/coderanger):
- Implemented [RFC017 - File Specificity Overhaul](https://github.com/chef/chef-rfc/blob/master/rfc017-file-specificity.md).
-* [**James Bence**](https://github.com/jbence):
- Improved the reliability of Git provider by making it to be more specific when selecting tags.
-* [**Jean Mertz**](https://github.com/JeanMertz):
- Changed knife upload not to validate the ruby files under files & templates directories.
-* [**Alex Pop**](https://github.com/alexpop):
- Made `knife cookbook create` to display the directory of the cookbook that is being created.
-* [**Alex Pop**](https://github.com/alexpop):
- Fixed the information debug output for the configuration file being used when running knife.
-* [**Martin Smith**](https://github.com/martinb3):
- Changed `knife cookbook site share` to make category an optional parameter when uploading cookbooks.
- It is still required when the cookbook is being uploaded for the first time but on the consequent
- uploads existing category of the cookbook will be used.
-* [**Nicolas DUPEUX**](https://github.com/vaxvms):
- Added JSON output to `knife status` command. `--medium` and `--long` output formatting parameters are now supported in knife status.
-* [**Trevor North**](https://github.com/trvrnrth):
- Removed dead code from `knife ssh`.
-* [**Nicolas Szalay**](https://github.com/rottenbytes):
- Fixed a bug preventing mounting of cgroup type devices in the mount provider.
-* [**Anshul Sharma**](https://github.com/justanshulsharma):
- Fixed inconsistent globbing in `knife from file` command.
-* [**Nicolas Szalay**](https://github.com/rottenbytes):
- Made user prompts in knife more beautiful by adding a space after Y/N prompts.
-* [**Ivan Larionov**](https://github.com/xeron):
- Made empty run_list to produce an empty array when using node.to_hash.
-* [**Siddheshwar More**](https://github.com/siddheshwar-more):
- Fixed a bug in knife bootstrap that caused config options to override command line options.
-* [**Thiago Oliveira**](https://github.com/chilicheech):
- Fixed a bug in Mac OSX group provider and made it idempotent.
-* [**liseki**](https://github.com/liseki):
- Fixed a bug in why-run mode for freebsd service resources without configured init scripts.
-* [**liseki**](https://github.com/liseki):
- Fixed a bug in freebsd service providers to load the status correctly.
-
-
-### Chef Contributions
-
-* ruby 1.9.3 support is dropped
-* Added RFC-023 Chef 12 Attribute Changes (https://github.com/chef/chef-rfc/blob/master/rfc023-chef-12-attributes-changes.md)
-* Added os/platform_family options to provides syntax on the Chef::Resource DSL
-* Added provides methods to the Chef::Provider DSL
-* Added supported?(resource, action) class method to all Providers for late-evaluation if a provider can handle a
- resource
-* Added ProviderResolver feature to handle late resolution of providers based on what kinds of support is in the
- base operating system.
-* Partial Deprecation of Chef::Platform provider mapping. The static mapping will be removed as Chef-12 progresses
- and the hooks will be completely dropped in Chef-13.
-* Default `guard_interpreter` for `powershell_script` resource set to `:powershell_script`, for `batch` to `:batch`
-* Recipe definition now returns the retval of the definition
-* Add support for Windows 10 to version helper.
-* `dsc_script` resource should honor configuration parameters when `configuration_data_script` is not set (Issue #2209)
-* Ruby has been updated to 2.1.3 along with rubygems update to 2.4.2
-* Removed shelling out to erubis/ruby for syntax checks (>= 1.9 has been able
- to do this in the ruby vm itself for awhile now and we've dropped 1.8.7 which
- could not do this and had to shell_out)
-* Report the request and response when a non-200 error code happens
-* [FEATURE] Upgrade `knife upload` and `knife download` to download
- **everything** in an organization, now including the organization definition
- itself (`knife download /org.json`) and the invitations and member list
- (`knife download /invitations.json` and `knife download /members.json`).
- Should be compatible with knife-ec-backup.
-* Make default Windows paths more backslashy
-* `knife` now prefers to load `config.rb` in preference to `knife.rb`;
-`knife.rb` will be used if `config.rb` is not found.
-* Fixed Config[:cache_path] to use path_join()
-* Updated chef-zero to 3.0, so that client tests can be run against Enterprise
- Chef as well as Open Source.
-* knife cookbook site download/list/search/share/show/unshare now uses
- supermerket.getchef.com urls
-* added Chef::ResourceCollection#insert_at API to the ResourceCollection
-* http_proxy and related config vars no longer clobber already set ENV vars
-* all http_proxy configs now set lowercase + uppercase versions of ENV vars
-* https_proxy/ftp_proxy support setting `http://` URLs (and whatever mix and match makes sense)
-* End-to-end tests for Ubuntu 12.04
-* Only run end-to-end tests when secure environment variables are present.
-* Remove recipe DSL from base provisioner (Issue 1446).
-* Enable client-side key generation by default. (Issue 1711)
-* CookbookSiteStreamingUploader now uses ssl_verify_mode config option (Issue 1518).
-* chef/json_compat now throws its own exceptions not JSON gem exceptions
-* Modify action for env raises Chef::Exceptions::Env exception on Windows (Chef Issues 1754)
-* Fix a bug in the experimental Policyfile mode that caused errors when
- using templates.
-* Disable JSON encoding of request body when non-JSON content type is
- specified.
-* Clean up FileVendor and CookbookUploader internal APIs
-* log resource now marks itself as supporting why-run
-* http_request no longer appends "?message=" query string to GET and HEAD requests
-* added shell_out commands directly to the recipe DSL
-* cookbook synchronizer deletes old files from cookbooks
-* do not clear file cache when override run list is set (CHEF-3684)
-* ruby 1.8.7/1.9.1/1.9.2 support is dropped
-* set no_lazy_load to true (CHEF-4961)
-* set file_stating_uses_destdir config option default to true (CHEF-5040)
-* remove dependency on rest-client gem
-* Add method shell_out_with_systems_locale to ShellOut.
-* chef-repo rake tasks are deprecated; print relevant information for
- each one.
-* Fix RPM package version detection (Issue 1554)
-* Don't override :default provider map if :default passed as platform (OC-11667).
-* Fix SuSE package removal failure (Issue 1732).
-* Enable Travis to run Test Kitchen with Kitchen EC2.
-* Fix a bug in reporting not to post negative duration values.
-* Add password setting support for Mac 10.7, 10.8 and 10.9 to the dscl user provider.
-* ChefSpec can find freebsd_package resource correctly when a package resource is declared on Freebsd.
-* Autodetect/decrypt encrypted data bag items with data_bag_item dsl method. (Issue 1837, Issue 1849)
-* windows_user: look up username instead of resource name (Issue #1705)
-* Remove the unused bootstrap templates that install chef from rubygems
-* Remove the Chef 10 functionality from bootstrap.
-* Deprecate --distro / --template_file options in favor of --boostrap-template
-* Add `:node_ssl_verify_mode` & `:node_verify_api_cert` options to bootstrap
- to be able to configure these settings on the bootstrapped node.
-* Add partial_search dsl method to Chef::Search::Query, add result filtering to search.
-* Transfer trusted certificates under :trusted_certs_dir during bootstrap.
-* Set :ssl_verify_mode to :verify_peer by default.
-* Add homebrew provider for package resource, use it by default on OS X (Issue #1709)
-* Add escape_glob method to PathHelper, update glob operations.
-* Verify x509 properties of certificates in the :trusted_certs_dir during knife ssl check.
-* Disable unforked interval chef-client runs.
-* Removed dependencies on the 'json' gem, replaced with ffi-yajl. Use Chef::JSONCompat library for parsing and printing.
-* Restore the deprecation logic of #valid_actions in LWRPs until Chef 13.
-* Now that we don't allow unforked chef-client interval runs, remove the reloading of previously defined LWRPs.
-* Use shell_out to determine Chef::Config[:internal_locale], fix CentOS locale detection bug.
-* `only_if` and `not_if` attributes of `execute` resource now inherits the parent resource's
- attributes when set to a `String`.
-* Retain the original value of `retries` for resources and display the original value when the run fails.
-* Added service provider for AIX.
-* The Windows env provider will delete elements even if they are only in ENV (and not in the registry)
-* Allow events to be logged to Windows Event Log
-* Fixed bug in env resource where a value containing the delimiter could never correctly match the existing values
-* More intelligent service check for systemd on Ubuntu 14.10.
-
-## 11.16.4
-
-* Windows omnibus installer security updates for redistributed bash.exe / sh.exe
- vulnerabilities ("Shellshock") CVE-2014-6271, CVE-2014-6271, CVE-2014-6278,
- CVE-2014-7186, CVE-2014-7187.
-* Fix bug on Windows where using the env resource on path could render the path unusable.
-* Chef Client now retries when it gets 50X from Chef Server.
-* Chef Client 11.16.4 can use the policyfiles generated with Chef DK 0.3.0.
-
-## 11.16.2
-
-* [**Phil Dibowitz**](https://github.com/jaymzh):
- Fix a regression in whyrun_safe_ruby_block.
-
-## 11.16.0
-
-* Fix a bug in user dscl provider to enable managing password and other properties at the same time.
-* Add `dsc_script` resource to Chef for PowerShell DSC support on Windows
-
-## 11.14.6:
-
-* Modify action for env raises Chef::Exceptions::Env exception on Windows (Chef Issues 1754)
-* Fix RPM package version detection (Issue 1554)
-* Fix a bug in reporting not to post negative duration values.
-* Add password setting support for Mac 10.7, 10.8 and 10.9 to the dscl user provider.
-* ChefSpec can find freebsd_package resource correctly when a package resource is declared on Freebsd.
-* http_proxy and related config vars no longer clobber already set ENV vars
-* all http_proxy configs now set lowercase + uppercase versions of ENV vars
-* https_proxy/ftp_proxy support setting `http://` URLs (and whatever mix and match makes sense)
-
-## 11.14.2
-
-* [**Jess Mink**](https://github.com/jmink):
- Symlinks to directories should be swingable on windows (CHEF-3960)
-* [**Phil Dibowitz**](https://github.com/jaymzh):
- SIGTERM will once-more kill a non-daemonized chef-client (CHEF-5172)
-* [**Pierre Ynard**](https://github.com/linkfanel):
- chef-service-manager should run as a non-interactive service (CHEF-5150)
-* [**Tensibai Zhaoying**](https://github.com/Tensibai):
- Fix file:// URI support in remote\_file on windows (CHEF-4472)
-* [**John Dyer**](https://github.com/johntdyer):
- Catch HTTPServerException for 404 in remote_file retry (CHEF-5116)
-* [**Pavel Yudin**](https://github.com/Kasen):
- Providers are now set correctly on CloudLinux. (CHEF-5182)
-* [**Joe Richards**](https://github.com/viyh):
- Made -E option to work with single lettered environments. (CHEF-3075)
-* [**Jimmy McCrory**](https://github.com/JimmyMcCrory):
- Added a 'knife node environment set' command. (CHEF-1910)
-* [**Hongbin Lu**](https://github.com/hongbin):
- Made bootstrap report authentication exceptions. (CHEF-5161)
-* [**Richard Manyanza**](https://github.com/liseki):
- Made `freebsd_package` resource use the brand new "pkgng" package
- manager when available.(CHEF-4637)
-* [**Nikhil Benesch**](https://github.com/benesch):
- Implemented a threaded download queue for synchronizing cookbooks. (CHEF-4423)
-* [**Chulki Lee**](https://github.com/chulkilee):
- Raise an error when source is accidentally passed to apt_package (CHEF-5113)
-* [**Cam Cope**](https://github.com/ccope):
- Add an open_timeout when opening an http connection (CHEF-5152)
-* [**Sander van Harmelen**](https://github.com/svanharmelen):
- Allow environment variables set on Windows to be used immediately (CHEF-5174)
-* [**Luke Amdor**](https://github.com/rubbish):
- Add an option to configure the chef-zero port (CHEF-5228)
-* [**Ricardo Signes**](https://github.com/rjbs):
- Added support for the usermod provider on OmniOS
-* [**Anand Suresh**](https://github.com/anandsuresh):
- Only modify password when one has been specified. (CHEF-5327)
-* [**Stephan Renatus**](https://github.com/srenatus):
- Add exception when JSON parsing fails. (CHEF-5309)
-* [**Xabier de Zuazo**](https://github.com/zuazo):
- OK to exclude space in dependencies in metadata.rb. (CHEF-4298)
-* [**Łukasz Jagiełło**](https://github.com/ljagiello):
- Allow cookbook names with leading underscores. (CHEF-4562)
-* [**Michael Bernstein**](https://github.com/mrb):
- Add Code Climate badge to README.
-* [**Phil Sturgeon**](https://github.com/philsturgeon):
- Documentation that -E is not respected by knife ssh [search]. (CHEF-4778)
-* [**Stephan Renatus**](https://github.com/srenatus):
- Fix resource_spec.rb.
-* [**Sander van Harmelen**](https://github.com/svanharmelen):
- Ensure URI compliant urls. (CHEF-5261)
-* [**Robby Dyer**](https://github.com/robbydyer):
- Correctly detect when rpm_package does not exist in upgrade action. (CHEF-5273)
-* [**Sergey Sergeev**](https://github.com/zhirafovod):
- Hide sensitive data output on chef-client error (CHEF-5098)
-* [**Mark Vanderwiel**](https://github.com/kramvan1):
- Add config option :yum-lock-timeout for yum-dump.py
-* [**Peter Fern**](https://github.com/pdf):
- Convert APT package resource to use `provides :package`, add timeout parameter.
-* [**Xabier de Zuazo**](https://github.com/zuazo):
- Fix Chef::User#list API error when inflate=true. (CHEF-5328)
-* [**Raphaël Valyi**](https://github.com/rvalyi):
- Use git resource status checking to reduce shell_out system calls.
-* [**Eric Krupnik**](https://github.com/ekrupnik):
- Added .project to git ignore list.
-* [**Ryan Cragun**](https://github.com/ryancragun):
- Support override_runlist CLI option in shef/chef-shell. (CHEF-5314)
-* [**Cam Cope**](https://github.com/ccope):
- Fix updating user passwords on Solaris. (CHEF-5247)
-* [**Ben Somers**](https://github.com/bensomers):
- Enable storage of roles in subdirectories for chef-solo. (CHEF-4193)
-* [**Robert Tarrall**](https://github.com/tarrall):
- Fix Upstart provider with parameters. (CHEF-5265)
-* [**Klaas Jan Wierenga**](https://github.com/kjwierenga):
- Don't pass on default HTTP port(80) in Host header. (CHEF-5355)
-* [**MarkGibbons**](https://github.com/MarkGibbons):
- Allow for undefined solaris services in the service resource. (CHEF-5347)
-* [**Allan Espinosa**](https://github.com/aespinosa):
- Properly knife bootstrap on ArchLinux. (CHEF-5366)
-* [**Matt Hoyle**](https://github.com/deployable):
- Made windows service resource to handle transitory states. (CHEF-5319, CHEF-4791)
-* [**Brett cave**](https://github.com/brettcave):
- Add Dir.pwd as fallback for default user_home if home directory is not set. (CHEF-5365)
-* [**Caleb Tennis**](https://github.com/ctennis):
- Add support for automatically using the Systemd service provider when available. (CHEF-3637)
-* [**Matt Hoyle**](https://github.com/deployable):
- Add timeout for Chef::Provider::Service::Windows. (CHEF-1165)
-* [**Jesse Hu**](https://github.com/jessehu):
- knife[:attribute] in knife.rb should not override --attribute (CHEF-5158)
-* [**Vasiliy Tolstov**](https://github.com/vtolstov):
- Added the initial exherbo linux support for Chef providers.
-
-* Fix knife cookbook site share on windows (CHEF-4994)
-* YAJL Allows Invalid JSON File Sending To The Server (CHEF-4899)
-* YAJL Silently Ingesting Invalid JSON and "Normalizing" Incorrectly (CHEF-4565)
-* Update rpm provider checking regex to allow for special characters (CHEF-4893)
-* Allow for spaces in selinux controlled directories (CHEF-5095)
-* Windows batch resource run action fails: " TypeError: can't convert nil into String" (CHEF-5287)
-* Log resource always triggers notifications (CHEF-4028)
-* Prevent tracing? from throwing an exception when first starting chef-shell.
-* Use Upstart provider on Ubuntu 13.10+. (CHEF-5276)
-* Cleaned up mount provider superclass
-* Added "knife serve" to bring up local mode as a server
-* Print nested LWRPs with indentation in doc formatter output
-* Make local mode stable enough to run chef-pedant
-* Wrap code in block context when syntax checking so `return` is valid
- (CHEF-5199)
-* Quote git resource rev\_pattern to prevent glob matching files (CHEF-4940)
-* User resource now only prints the name during why-run runs. (CHEF-5180)
-* Set --run-lock-timeout to wait/bail if another client has the runlock (CHEF-5074)
-* remote\_file's source attribute does not support DelayedEvaluators (CHEF-5162)
-* `option` attribute of mount resource now supports lazy evaluation. (CHEF-5163)
-* `force_unlink` now only unlinks if the file already exists. (CHEF-5015)
-* `chef_gem` resource now uses omnibus gem binary. (CHEF-5092)
-* chef-full template gets knife options to override install script url, add wget/curl cli options, and custom install commands (CHEF-4697)
-* knife now bootstraps node with the latest current version of chef-client. (CHEF-4911)
-* Add config options for attribute whitelisting in node.save. (CHEF-3811)
-* Use user's .chef as a fallback cache path if /var/chef is not accessible. (CHEF-5259)
-* Fixed Ruby 2.0 Windows compatibility issues around ruby-wmi gem by replacing it with wmi-lite gem.
-* Set proxy environment variables if preset in config. (CHEF-4712)
-* Automatically enable verify_api_cert when running chef-client in local-mode. (Chef Issues 1464)
-* Add helper to warn for broken [windows] paths. (CHEF-5322)
-* Send md5 checksummed data for registry key if data type is binary, dword, or qword. (Chef-5323)
-* Add warning if host resembles winrm command and knife-windows is not present.
-* Use FFI binders to attach :SendMessageTimeout to avoid DL deprecation warning. (ChefDK Issues 69)
-* Use 'guest' user on AIX for RSpec tests. (OC-9954)
-* Added DelayedEvaluator support in LWRP using the `lazy {}` key
-* Fixed a bug where nested resources that inherited from Resource::LWRPBase
- would not share the same actions/default_action as their parent
-* Raise error if a guard_interpreter is specified and a block is passed to a guard (conditional)
-* Allow specifying a guard_interpreter after a conditional on a resource (Fixes #1943) \ No newline at end of file
diff --git a/MAINTAINERS.md b/MAINTAINERS.md
index f58cb17c40..536d9b6629 100644
--- a/MAINTAINERS.md
+++ b/MAINTAINERS.md
@@ -63,7 +63,6 @@ To mention the team, use @chef/provisioning
* [John Keiser](https://github.com/jkeiser)
* [JJ Asghar](https://github.com/jjasghar)
-* [João Cravo](https://github.com/joaogbcravo)
* [Stuart Preston](https://github.com/stuartpreston)
* [Harley Alaniz](https://github.com/thehar)
@@ -196,7 +195,7 @@ To mention the team, use @chef/client-freebsd
### Maintainers
* [Cory Stephenson](https://github.com/Aevin1387)
-* [David Aronsohn](https://github.com/tbunnyman)
+* [David Aronsohn](https://github.com/OnlyHaveCans)
* [Bryant Lippert](https://github.com/AgentMeerkat)
## OpenBSD
diff --git a/MAINTAINERS.toml b/MAINTAINERS.toml
index e93680d6a9..ce4f514d89 100644
--- a/MAINTAINERS.toml
+++ b/MAINTAINERS.toml
@@ -68,7 +68,6 @@ Chef Provisioning and Drivers. Supported Drivers are listed in the [README](htt
maintainers = [
"jkeiser",
"jjasghar",
- "joaogbcravo",
"stuartpreston",
"thehar"
]
@@ -186,7 +185,7 @@ The specific components of Chef related to a given platform - including (but not
maintainers = [
"Aevin1387",
- "tBunnyMan",
+ "OnlyHaveCans",
"AgentMeerkat"
]
@@ -294,9 +293,9 @@ The specific components of Chef related to a given platform - including (but not
Name = "Steven Danna"
GitHub = "stevendanna"
- [people.tBunnyMan]
+ [people.OnlyHaveCans]
Name = "David Aronsohn"
- GitHub = "tbunnyman"
+ GitHub = "OnlyHaveCans"
IRC = "tBunnyMan"
Twitter = "OnlyHaveCans"
@@ -354,11 +353,6 @@ The specific components of Chef related to a given platform - including (but not
Twitter = "jjasghar"
IRC = "j^2"
- [people.joaogbcravo]
- Name = "João Cravo"
- GitHub = "joaogbcravo"
- Twitter = "joaogbcravo"
-
[people.thehar]
Name = "Harley Alaniz"
GitHub = "thehar"
diff --git a/README.md b/README.md
index ee00e53af6..74824623fc 100644
--- a/README.md
+++ b/README.md
@@ -5,7 +5,11 @@
[![Gem Version](https://badge.fury.io/rb/chef.svg)](https://badge.fury.io/rb/chef)
[![](https://img.shields.io/badge/Release%20Policy-Cadence%20Release-brightgreen.svg)](https://github.com/chef/chef-rfc/blob/master/rfc086-chef-oss-project-policies.md#cadence-release)
-Want to try Chef? Get started with [learnchef](https://learn.chef.io)
+## Getting Started
+
+Want to try Chef?
+For Chef user, please refer to [Quick Start](https://docs.chef.io/quick_start.html)
+For more details, please refer to [learnchef](https://learn.chef.io)
- Documentation: <https://docs.chef.io>
- Source: <https://github.com/chef/chef/tree/master>
@@ -37,7 +41,7 @@ to report issues against in the Chef docs in the
If you can't determine the appropriate place to report an issue, then please open it
against the repository you think best fits and it will be directed to the appropriate project.
-## Installing From Git
+## Installing From Git for Developers
**NOTE:** As a Chef user, please download the omnibus package of [Chef](https://downloads.chef.io/chef) or [Chef-DK](https://downloads.chef.io/chef)
diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md
index bd52f579ed..3690e12a67 100644
--- a/RELEASE_NOTES.md
+++ b/RELEASE_NOTES.md
@@ -1,7 +1,348 @@
_This file holds "in progress" release notes for the current release under development and is intended for consumption by the Chef Documentation team. Please see <https://docs.chef.io/release_notes.html> for the official Chef release notes._
+# Chef Client Release Notes 13.4:
+
+## Security release of Ruby
+
+Chef Client 13.4 includes Ruby 2.4.2 to fix the following CVEs:
+ * CVE-2017-0898
+ * CVE-2017-10784
+ * CVE-2017-14033
+ * CVE-2017-14064
+
+## Security release of RubyGems
+
+Chef Client 13.4 includes RubyGems 2.6.13 to fix the following CVEs:
+ * CVE-2017-0899
+ * CVE-2017-0900
+ * CVE-2017-0901
+ * CVE-2017-0902
+
+## Ifconfig provider on Red Hat now supports additional properties
+
+It is now possible to set `ETHTOOL_OPTS`, `BONDING_OPTS`, `MASTER` and
+`SLAVE` properties on interfaces on Red Hat compatible systems. See https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Deployment_Guide/s1-networkscripts-interfaces.html for further information
+
+### Properties
+
+* `ethtool\_opts`<br/>
+ **Ruby types:** String</br>
+ **Platforms:** Fedora, RHEL, Amazon Linux
+ A string containing arguments to ethtool. The string will be wrapped
+ in double quotes, so ensure that any needed quotes in the property
+ are surrounded by single quotes
+
+* `bonding\_opts`<br/>
+ **Ruby types:** String</br>
+ **Platforms:** Fedora, RHEL, Amazon Linux
+ A string containing configuration parameters for the bonding device.
+
+* `master`<br/>
+ **Ruby types:** String</br>
+ **Platforms:** Fedora, RHEL, Amazon Linux
+ The channel bonding interface that this interface is linked to.
+
+* `slave`<br/>
+ **Ruby types:** String</br>
+ **Platforms:** Fedora, RHEL, Amazon Linux
+ Whether the interface is controlled by the channel bonding interface
+ defined by `master`, above.
+
+## Chef Vault is now included
+
+Chef Client 13.4 now includes the `chef-vault` gem, making it easier for
+users of chef-vault to use their encrypted items.
+
+## Windows `remote_file` resource with alternate credentials
+
+The `remote_file` resource now supports the use of credentials on Windows when accessing a remote UNC path on Windows such as `\\myserver\myshare\mydirectory\myfile.txt`. This
+allows access to the file at that path location even if the Chef client process identity does not have permission to access the file. The new properties `remote_user`, `remote_domain`, and `remote_password` may be used to specify credentials with access to the remote file so that it may be read.
+
+**Note**: This feature is mainly used for accessing files between two nodes in different domains and having different user accounts.
+In case the two nodes are in same domain, `remote_file` resource does not need `remote_user` and `remote_password` specified because the user has the same access on both systems through the domain.
+
+### Properties
+
+The following properties are new for the `remote_file` resource:
+
+* `remote_user`</br>
+ **Ruby types:** String</br>
+ *Windows only:* The user name of a user with access to the remote file specified by the `source` property. Default value: `nil`. The user name may optionally be specifed with a domain, i.e. `domain\user` or `user@my.dns.domain.com` via Universal Principal Name (UPN) format. It can also be specified without a domain simply as `user` if the domain is instead specified using the `remote_domain` attribute. Note that this property is ignored if `source` is not a UNC path. If this property is specified, the `remote_password` property **must** be specified.
+
+* `remote_password`</br>
+ **Ruby types** String</br>
+ *Windows only:* The password of the user specified by the `remote_user` property. Default value: `nil`. This property is mandatory if `remote_user` is specified and may only be specified if `remote_user` is specified. The `sensitive` property for this resource will automatically be set to `true` if `remote_password` is specified.
+
+* `remote_domain`</br>
+ **Ruby types** String</br>
+ *Windows only:* The domain of the user user specified by the `remote_user` property. Default value: `nil`. If not specified, the user and password properties specified by the `remote_user` and `remote_password` properties will be used to authenticate that user against the domain in which the system hosting the UNC path specified via `source` is joined, or if that system is not joined to a domain it will authenticate the user as a local account on that system. An alternative way to specify the domain is to leave this property unspecified and specify the domain as part of the `remote_user` property.
+
+### Examples
+
+Accessing file from a (different) domain account
+
+```ruby
+remote_file "E://domain_test.txt" do
+ source "\\\\myserver\\myshare\\mydirectory\\myfile.txt"
+ remote_domain "domain"
+ remote_user "username"
+ remote_password "password"
+end
+```
+OR
+```ruby
+remote_file "E://domain_test.txt" do
+ source "\\\\myserver\\myshare\\mydirectory\\myfile.txt"
+ remote_user "domain\\username"
+ remote_password "password"
+end
+```
+
+Accessing file using a local account on the remote machine
+
+```ruby
+remote_file "E://domain_test.txt" do
+ source "\\\\myserver\\myshare\\mydirectory\\myfile.txt"
+ remote_domain "."
+ remote_user "username"
+ remote_password "password"
+end
+```
+OR
+```ruby
+remote_file "E://domain_test.txt" do
+ source "\\\\myserver\\myshare\\mydirectory\\myfile.txt"
+ remote_user ".\\username"
+ remote_password "password"
+end
+```
+
+## windows_path resource
+
+`windows_path` resource has been moved to core chef from windows cookbook. Use the `windows_path` resource to manage the path environment variable on Microsoft Windows.
+
+### Actions
+
+- `:add` - Add an item to the system path
+- `:remove` - Remove an item from the system path
+
+### Properties
+
+- `path` - Name attribute. The name of the value to add to the system path
+
+### Examples
+
+Add Sysinternals to the system path
+
+```ruby
+windows_path 'C:\Sysinternals' do
+ action :add
+end
+```
+
+Remove 7-Zip from the system path
+
+```ruby
+windows_path 'C:\7-Zip' do
+ action :remove
+end
+```
+
+## Ohai Release Notes 13.4
+
+### Windows EC2 Detection
+
+Detection of nodes running in EC2 has been greatly improved and should now detect nodes 100% of the time including nodes that have been migrated to EC2 or were built with custom AMIs.
+
+### Azure Metadata Endpoint Detection
+
+Ohai now polls the new Azure metadata endpoint, giving us additional configuration details on nodes running in Azure
+
+Sample data now available under azure:
+
+```javascript
+{
+ "metadata": {
+ "compute": {
+ "location": "westus",
+ "name": "timtest",
+ "offer": "UbuntuServer",
+ "osType": "Linux",
+ "platformFaultDomain": "0",
+ "platformUpdateDomain": "0",
+ "publisher": "Canonical",
+ "sku": "17.04",
+ "version": "17.04.201706191",
+ "vmId": "8d523242-71cf-4dff-94c3-1bf660878743",
+ "vmSize": "Standard_DS1_v2"
+ },
+ "network": {
+ "interfaces": {
+ "000D3A33AF03": {
+ "mac": "000D3A33AF03",
+ "public_ipv6": [
+
+ ],
+ "public_ipv4": [
+ "52.160.95.99",
+ "23.99.10.211"
+ ],
+ "local_ipv6": [
+
+ ],
+ "local_ipv4": [
+ "10.0.1.5",
+ "10.0.1.4",
+ "10.0.1.7"
+ ]
+ }
+ },
+ "public_ipv4": [
+ "52.160.95.99",
+ "23.99.10.211"
+ ],
+ "local_ipv4": [
+ "10.0.1.5",
+ "10.0.1.4",
+ "10.0.1.7"
+ ],
+ "public_ipv6": [
+
+ ],
+ "local_ipv6": [
+
+ ]
+ }
+ }
+}
+```
+
+### Package Plugin Supports Arch Linux
+
+The Package plugin has been updated to include package information on Arch Linux systems.
+
+
# Chef Client Release Notes 13.3:
+## Unprivileged Symlink Creation on Windows
+
+Chef can now create symlinks without privilege escalation, which allows for the creation of symlinks on Windows 10 Creator Update.
+
+## nokogiri Gem
+
+The nokogiri gem is once again bundled with the omnibus install of Chef
+
+## zypper_package Options
+
+It is now possible to pass additional options to the zypper in the zypper_package resource. This can be used to pass any zypper CLI option
+
+### Example:
+
+```ruby
+zypper_package 'foo' do
+ options '--user-provided'
+end
+```
+
+## windows_task Improvements
+
+The `windows_task` resource now properly allows updating the configuration of a scheduled task when using the `:create` action. Additionally the previous `:change` action from the windows cookbook has been aliased to `:create` to provide backwards compatibility.
+
+## apt_preference Resource
+
+The apt_preference resource has been ported from the apt cookbook. This resource allows for the creation of APT preference files controlling which packages take priority during installation.
+
+Further information regarding apt-pinning is available via <https://wiki.debian.org/AptPreferences> and <https://manpages.debian.org/stretch/apt/apt_preferences.5.en.html>
+
+### Actions
+
+- `:add`: creates a preferences file under /etc/apt/preferences.d
+- `:remove`: Removes the file, therefore unpin the package
+
+### Properties
+
+- `package_name`: name attribute. The name of the package
+- `glob`: Pin by glob() expression or regexp surrounded by /.
+- `pin`: The package version/repository to pin
+- `pin_priority`: The pinning priority aka "the highest package version wins"
+
+### Examples
+
+Pin libmysqlclient16 to version 5.1.49-3:
+
+```ruby
+apt_preference 'libmysqlclient16' do
+ pin 'version 5.1.49-3'
+ pin_priority '700'
+end
+```
+
+Unpin libmysqlclient16:
+
+```ruby
+apt_preference 'libmysqlclient16' do
+ action :remove
+end
+```
+
+Pin all packages from dotdeb.org:
+
+```ruby
+apt_preference 'dotdeb' do
+ glob '*'
+ pin 'origin packages.dotdeb.org'
+ pin_priority '700'
+end
+```
+
+## zypper_repository Resource
+
+The zypper_repository resource allows for the creation of Zypper package repositories on SUSE Enterprise Linux and openSUSE systems. This resource maintains full compatibility with the resource in the existing [zypper](https://supermarket.chef.io/cookbooks/zypper) cookbooks
+
+### Actions
+
+- `:add` - adds a repo
+- `:delete` - removes a repo
+
+### Properties
+
+- `repo_name` - repository name if different from the resource name (name property)
+- `type` - the repository type. default: 'NONE'
+- `description` - the description of the repo that will be shown in `zypper repos`
+- `baseurl` - the base url of the repo
+- `path` - the relative path from the `baseurl`
+- `mirrorlist` - the url to the mirrorlist to use
+- `gpgcheck` - should we gpg check the repo (true/false). default: true
+- `gpgkey` - location of repo key to import
+- `priority` - priority of the repo. default: 99
+- `autorefresh` - should the repository be automatically refreshed (true/false). default: true
+- `keeppackages` - should packages be saved (true/false). default: false
+- `refresh_cache` - should package cache be refreshed (true/false). default: true
+- `enabled` - should this repository be enabled (true/false). default: true
+- `mode` - the file mode of the repository file. default: "0644"
+
+### Examples
+
+Add the Apache repository for openSUSE Leap 42.2
+
+```ruby
+zypper_repository 'apache' do
+ baseurl 'http://download.opensuse.org/repositories/Apache'
+ path '/openSUSE_Leap_42.2'
+ type 'rpm-md'
+ priority '100'
+end
+```
+
+## Ohai Release Notes 13.3:
+
+### Additional Platform Support
+
+Ohai now properly detects the [F5 Big-IP](https://www.f5.com/) platform and platform_version.
+
+- platform: bigip
+- platform_family: rhel
+
# Chef Client Release Notes 13.2:
## Properly send policyfile data
@@ -12,15 +353,13 @@ When sending events back to the Chef Server, we now correctly expand the run_lis
When Chef performs a reconfigure, it re-reads the configuration files. It also re-opens its log files, which facilitates log file rotation.
-Chef normally will reconfigure when sent a HUP signal. As of this release if you send a HUP signal while it is converging, the reconfigure
-happens at the end of the run. This is avoids potential Ruby issues when the configuration file contains additional Ruby code that is executed.
-While the daemon is sleeping between runs, sending a SIGHUP will still cause an immediate reconfigure.
+Chef normally will reconfigure when sent a HUP signal. As of this release if you send a HUP signal while it is converging, the reconfigure happens at the end of the run. This is avoids potential Ruby issues when the configuration file contains additional Ruby code that is executed. While the daemon is sleeping between runs, sending a SIGHUP will still cause an immediate reconfigure.
Additionally, Chef now always performs a reconfigure after every run when daemonized.
## New Deprecations
-### Explicit property methods
+### Explicit property methods
<https://docs.chef.io/deprecations_namespace_collisions.html>
@@ -74,12 +413,9 @@ In Chef/Ohai 14 (April 2018) we will remove the IpScopes plugin. The data return
## Socketless local mode by default
-For security reasons we are switching Local Mode to use socketless connections
-by default. This prevents potential attacks where an unprivileged user or process
-connects to the internal Zero server for the converge and changes data.
+For security reasons we are switching Local Mode to use socketless connections by default. This prevents potential attacks where an unprivileged user or process connects to the internal Zero server for the converge and changes data.
-If you use Chef Provisioning with Local Mode, you may need to pass `--listen` to
-`chef-client`.
+If you use Chef Provisioning with Local Mode, you may need to pass `--listen` to `chef-client`.
## New Deprecations
@@ -93,29 +429,21 @@ In Chef/Ohai 14 (April 2018) we will remove support for loading Ohai v6 plugins,
## Rubygems provider sources behavior changed.
-The behavior of `gem_package` and `chef_gem` is now to always apply the `Chef::Config[:rubygems_uri]` sources, which may be a
-String uri or an Array of Strings. If additional sources are put on the resource with the `source` property those are added
-to the configured `:rubygems_uri` sources.
+The behavior of `gem_package` and `chef_gem` is now to always apply the `Chef::Config[:rubygems_url]` sources, which may be a String uri or an Array of Strings. If additional sources are put on the resource with the `source` property those are added to the configured `:rubygems_url` sources.
-This should enable easier setup of rubygems mirrors particularly in "airgapped" environments through the use of the global config
-variable. It also means that an admin may force all rubygems.org traffic to an internal mirror, while still being able to
-consume external cookbooks which have resources which add other mirrors unchanged (in a non-airgapped environment).
+This should enable easier setup of rubygems mirrors particularly in "airgapped" environments through the use of the global config variable. It also means that an admin may force all rubygems.org traffic to an internal mirror, while still being able to consume external cookbooks which have resources which add other mirrors unchanged (in a non-airgapped environment).
-In the case where a resource must force the use of only the specified source(s), then the `include_default_source` property
-has been added -- setting it to false will remove the `Chef::Config[:rubygems_url]` setting from the list of sources for
-that resource.
+In the case where a resource must force the use of only the specified source(s), then the `include_default_source` property has been added -- setting it to false will remove the `Chef::Config[:rubygems_url]` setting from the list of sources for that resource.
The behavior of the `clear_sources` property is now to only add `--clear-sources` and has no magic side effects on the source options.
## Ruby version upgraded to 2.4.1
-We've upgraded to the latest stable release of the Ruby programming
-language. See the Ruby [2.4.0 Release Notes](https://www.ruby-lang.org/en/news/2016/12/25/ruby-2-4-0-released/) for an overview of what's new in the language.
+We've upgraded to the latest stable release of the Ruby programming language. See the Ruby [2.4.0 Release Notes](https://www.ruby-lang.org/en/news/2016/12/25/ruby-2-4-0-released/) for an overview of what's new in the language.
## Resource can now declare a default name
-The core `apt_update` resource can now be declared without any name argument, no need for `apt_update "this string doesn't matter but
-why do i have to type it?"`.
+The core `apt_update` resource can now be declared without any name argument, no need for `apt_update "this string doesn't matter but why do i have to type it?"`.
This can be used by any other resource by just overriding the name property and supplying a default:
@@ -123,36 +451,27 @@ This can be used by any other resource by just overriding the name property and
property :name, String, default: ""
```
-Notifications to resources with empty strings as their name is also supported via either the bare resource name (`apt_update` --
-matches what the user types in the DSL) or with empty brackets (`apt_update[]` -- matches the resource notification pattern).
+Notifications to resources with empty strings as their name is also supported via either the bare resource name (`apt_update` -- matches what the user types in the DSL) or with empty brackets (`apt_update[]` -- matches the resource notification pattern).
## The knife ssh command applies the same fuzzifier as knife search node
-A bare name to knife search node will search for the name in `tags`, `roles`, `fqdn`, `addresses`, `policy_name` or `policy_group` fields and will
-match when given partial strings (available since Chef 11). The `knife ssh` search term has been similarly extended so that the
-search API matches in both cases. The node search fuzzifier has also been extracted out to a `fuzz` option to Chef::Search::Query for re-use
-elsewhere.
+A bare name to knife search node will search for the name in `tags`, `roles`, `fqdn`, `addresses`, `policy_name` or `policy_group` fields and will match when given partial strings (available since Chef 11). The `knife ssh` search term has been similarly extended so that the search API matches in both cases. The node search fuzzifier has also been extracted out to a `fuzz` option to Chef::Search::Query for re-use elsewhere.
## Cookbook root aliases
-Rather than `attributes/default.rb`, cookbooks can now use `attributes.rb` in
-the root of the cookbook. Similarly for a single default recipe, cookbooks can
-use `recipe.rb` in the root of the cookbook.
+Rather than `attributes/default.rb`, cookbooks can now use `attributes.rb` in the root of the cookbook. Similarly for a single default recipe, cookbooks can use `recipe.rb` in the root of the cookbook.
## knife ssh can now connect to gateways with ssh key authentication
-The new `gateway_identity_file` option allows the operator to specify
-the key to access ssh gateways with.
+The new `gateway_identity_file` option allows the operator to specify the key to access ssh gateways with.
## Windows Task resource added
-The `windows_task` resource has been ported from the windows cookbook,
-and many bugs have been fixed.
+The `windows_task` resource has been ported from the windows cookbook, and many bugs have been fixed.
## Solaris SMF services can now been started recursively
-It is now possible to load Solaris services recursively, by ensuring the
-new `options` property of the `service` resource contains `-r`.
+It is now possible to load Solaris services recursively, by ensuring the new `options` property of the `service` resource contains `-r`.
## It's now possible to blacklist node attributes
@@ -160,9 +479,7 @@ This is the inverse of the pre-existing whitelisting functionality.
## The guard interpreter for `powershell_script` is Powershell, again
-When writing `not_if` or `only_if` statements, by default we now run
-those statements using powershell, rather than forcing the user to set
-`guard_interpreter` each time.
+When writing `not_if` or `only_if` statements, by default we now run those statements using powershell, rather than forcing the user to set `guard_interpreter` each time.
## Zypper GPG checks by default
@@ -170,9 +487,7 @@ Zypper now defaults to performing gpg checks of packages.
## The InSpec gem is now shipped by default
-The `inspec` and `train` gems are shipped by default in the chef omnibus
-package, making it easier for users in airgapped environments to use
-InSpec.
+The `inspec` and `train` gems are shipped by default in the chef omnibus package, making it easier for users in airgapped environments to use InSpec.
## Properly support managing Sys-V services on Debian systemd hosts
@@ -182,36 +497,29 @@ Chef now properly supports managing sys-v services on hosts running systemd. Pre
### Resource Cloning has been removed
-When Chef compiles resources, it will no longer attempt to merge the
-properties of previously compiled resources with the same name and type
-in to the new resource. See [the deprecation page](https://docs.chef.io/deprecations_resource_cloning.html) for further information.
+When Chef compiles resources, it will no longer attempt to merge the properties of previously compiled resources with the same name and type in to the new resource. See [the deprecation page](https://docs.chef.io/deprecations_resource_cloning.html) for further information.
### It is an error to specify both `default` and `name_property` on a property
-Chef 12 made this work by picking the first option it found, but it was
-always an error and has now been disallowed.
+Chef 12 made this work by picking the first option it found, but it was always an error and has now been disallowed.
### The path property of the execute resource has been removed
-It was never implemented in the provider, so it was always a no-op to use it, the remediation is
-to simply delete it.
+It was never implemented in the provider, so it was always a no-op to use it, the remediation is to simply delete it.
### Using the command property on any script resource (including bash, etc) is now a hard error
-This was always a usage mistake. The command property was used internally by the script resource and was not intended to be exposed
-to users. Users should use the code property instead (or use the command property on an execute resource to execute a single command).
+This was always a usage mistake. The command property was used internally by the script resource and was not intended to be exposed to users. Users should use the code property instead (or use the command property on an execute resource to execute a single command).
### Omitting the code property on any script resource (including bash, etc) is now a hard error
-It is possible that this was being used as a no-op resource, but the log resource is a better choice for that until we get a null
-resource added. Omitting the code property or mixing up the code property with the command property are also common usage mistakes
-that we need to catch and error on.
+It is possible that this was being used as a no-op resource, but the log resource is a better choice for that until we get a null resource added. Omitting the code property or mixing up the code property with the command property are also common usage mistakes that we need to catch and error on.
-### The chef\_gem resource defaults to not run at compile time
+### The chef_gem resource defaults to not run at compile time
The `compile_time true` flag may still be used to force compile time.
-### The Chef::Config[:chef\_gem\_compile\_time] config option has been removed
+### The Chef::Config[:chef_gem_compile_time] config option has been removed
In order to for community cookbooks to behave consistently across all users this optional flag has been removed.
@@ -221,8 +529,7 @@ The remediation is to set the manage_home and non_unique properties directly.
### Using relative paths in the `creates` property of an execute resource with specifying a `cwd` is now a hard error
-Without a declared cwd the relative path was (most likely?) relative to wherever chef-client happened to be invoked which is
-not deterministic or easy to intuit behavior.
+Without a declared cwd the relative path was (most likely?) relative to wherever chef-client happened to be invoked which is not deterministic or easy to intuit behavior.
### Chef::PolicyBuilder::ExpandNodeObject#load_node has been removed
@@ -246,21 +553,15 @@ Exceptions not decending from StandardError (e.g. LoadError, SecurityError, Syst
### Removed deprecated `method_missing` access from the Chef::Node object
-Previously, the syntax `node.foo.bar` could be used to mean `node["foo"]["bar"]`, but this API had sharp edges where methods collided
-with the core ruby Object class (e.g. `node.class`) and where it collided with our own ability to extend the `Chef::Node` API. This
-method access has been deprecated for some time, and has been removed in Chef-13.
+Previously, the syntax `node.foo.bar` could be used to mean `node["foo"]["bar"]`, but this API had sharp edges where methods collided with the core ruby Object class (e.g. `node.class`) and where it collided with our own ability to extend the `Chef::Node` API. This method access has been deprecated for some time, and has been removed in Chef-13.
### Changed `declare_resource` API
-Dropped the `create_if_missing` parameter that was immediately supplanted by the `edit_resource` API (most likely nobody ever used
-this) and converted the `created_at` parameter from an optional positional parameter to a named parameter. These changes are unlikely
-to affect any cookbook code.
+Dropped the `create_if_missing` parameter that was immediately supplanted by the `edit_resource` API (most likely nobody ever used this) and converted the `created_at` parameter from an optional positional parameter to a named parameter. These changes are unlikely to affect any cookbook code.
### Node deep-duping fixes
-The `node.to_hash`/`node.to_h` and `node.dup` APIs have been fixed so that they correctly deep-dup the node data structure including every
-string value. This results in a mutable copy of the immutable merged node structure. This is correct behavior, but is now more expensive
-and may break some poor code (which would have been buggy and difficult to follow code with odd side effects before).
+The `node.to_hash`/`node.to_h` and `node.dup` APIs have been fixed so that they correctly deep-dup the node data structure including every string value. This results in a mutable copy of the immutable merged node structure. This is correct behavior, but is now more expensive and may break some poor code (which would have been buggy and difficult to follow code with odd side effects before).
For example:
@@ -270,15 +571,11 @@ n = node.to_hash # or node.dup
n["foo"] << "buzz"
```
-before this would have mutated the original string in-place so that `node["foo"]` and `node.default["foo"]` would have changed to "fizzbuzz"
-while now they remain "fizz" and only the mutable `n["foo"]` copy is changed to "fizzbuzz".
+before this would have mutated the original string in-place so that `node["foo"]` and `node.default["foo"]` would have changed to "fizzbuzz" while now they remain "fizz" and only the mutable `n["foo"]` copy is changed to "fizzbuzz".
### Freezing immutable merged attributes
-Since Chef 11 merged node attributes have been intended to be immutable but the merged strings have not been frozen. In Chef 13, in the
-process of merging the node attributes strings and other simple objects are dup'd and frozen. In order to get a mutable copy, you can
-now correctly use the `node.dup` or `node.to_hash` methods, or you should mutate the object correctly through its precedence level like
-`node.default["some_string"] << "appending_this"`.
+Since Chef 11 merged node attributes have been intended to be immutable but the merged strings have not been frozen. In Chef 13, in the process of merging the node attributes strings and other simple objects are dup'd and frozen. In order to get a mutable copy, you can now correctly use the `node.dup` or `node.to_hash` methods, or you should mutate the object correctly through its precedence level like `node.default["some_string"] << "appending_this"`.
### The Chef::REST API has been removed
@@ -286,20 +583,15 @@ It has been fully replaced with `Chef::ServerAPI` in chef-client code.
### Properties overriding methods now raise an error
-Defining a property that overrides methods defined on the base ruby `Object` or on `Chef::Resource` itself can cause large amounts of
-confusion. A simple example is `property :hash` which overrides the Object#hash method which will confuse ruby when the Custom Resource
-is placed into the Chef::ResourceCollection which uses a Hash internally which expects to call Object#hash to get a unique id for the
-object. Attempting to create `property :action` would also override the Chef::Resource#action method which is unlikely to end well for
-the user. Overriding inherited properties is still supported.
+Defining a property that overrides methods defined on the base ruby `Object` or on `Chef::Resource` itself can cause large amounts of confusion. A simple example is `property :hash` which overrides the Object#hash method which will confuse ruby when the Custom Resource is placed into the Chef::ResourceCollection which uses a Hash internally which expects to call Object#hash to get a unique id for the object. Attempting to create `property :action` would also override the Chef::Resource#action method which is unlikely to end well for the user. Overriding inherited properties is still supported.
### `chef-shell` now supports solo and legacy solo modes
-Running `chef-shell -s` or `chef-shell --solo` will give you an experience consistent with `chef-solo`. `chef-shell --solo-legacy-mode`
-will give you an experience consistent with `chef-solo --legacy-mode`.
+Running `chef-shell -s` or `chef-shell --solo` will give you an experience consistent with `chef-solo`. `chef-shell --solo-legacy-mode` will give you an experience consistent with `chef-solo --legacy-mode`.
### Chef::Platform.set and related methods have been removed
-The deprecated code has been removed. All providers and resources should now be using Chef >= 12.0 `provides` syntax.
+The deprecated code has been removed. All providers and resources should now be using Chef >= 12.0 `provides` syntax.
### Remove `sort` option for the Search API
@@ -315,52 +607,33 @@ The core of chef hasn't used this to implement the Recipe DSL since 12.5.1 and i
### Simplify Recipe DSL wiring
-Support for actions with spaces and hyphens in the action name has been dropped. Resources and property names with spaces and hyphens
-most likely never worked in Chef-12. UTF-8 characters have always been supported and still are.
+Support for actions with spaces and hyphens in the action name has been dropped. Resources and property names with spaces and hyphens most likely never worked in Chef-12\. UTF-8 characters have always been supported and still are.
### `easy_install` resource has been removed
-The Python `easy_install` package installer has been deprecated for many years,
-so we have removed support for it. No specific replacement for `pip` is being
-included with Chef at this time, but a `pip`-based `python_package` resource is
-available in the [`poise-python`](https://github.com/poise/poise-python) cookbooks.
+The Python `easy_install` package installer has been deprecated for many years, so we have removed support for it. No specific replacement for `pip` is being included with Chef at this time, but a `pip`-based `python_package` resource is available in the [`poise-python`](https://github.com/poise/poise-python) cookbooks.
### Removal of run_command and popen4 APIs
-All the APIs in chef/mixlib/command have been removed. They were deprecated by mixlib-shellout and the shell_out mixin API.
+All the APIs in chef/mixlib/command have been removed. They were deprecated by mixlib-shellout and the shell_out mixin API.
### Iconv has been removed from the ruby libraries and chef omnibus build
-The ruby Iconv library was replaced by the Encoding library in ruby 1.9.x and since the deprecation of ruby 1.8.7 there has been no need
-for the Iconv library but we have carried it forwards as a dependency since removing it might break some chef code out there which used
-this library. It has now been removed from the ruby build. This also removes LGPLv3 code from the omnibus build and reduces build
-headaches from porting iconv to every platform we ship chef-client on.
+The ruby Iconv library was replaced by the Encoding library in ruby 1.9.x and since the deprecation of ruby 1.8.7 there has been no need for the Iconv library but we have carried it forwards as a dependency since removing it might break some chef code out there which used this library. It has now been removed from the ruby build. This also removes LGPLv3 code from the omnibus build and reduces build headaches from porting iconv to every platform we ship chef-client on.
-This will also affect nokogiri, but that gem natively supports UTF-8, UTF-16LE/BE, ISO-8851-1(Latin-1), ASCII and "HTML" encodings. Users
-who really need to write something like Shift-JIS inside of XML will need to either maintain their own nokogiri installs or will need to
-convert to using UTF-8.
+This will also affect nokogiri, but that gem natively supports UTF-8, UTF-16LE/BE, ISO-8851-1(Latin-1), ASCII and "HTML" encodings. Users who really need to write something like Shift-JIS inside of XML will need to either maintain their own nokogiri installs or will need to convert to using UTF-8.
### Deprecated cookbook metadata has been removed
-The `recommends`, `suggests`, `conflicts`, `replaces` and `grouping`
-metadata fields are no longer supported, and have been removed, since
-they were never used. Chef will ignore them in existing `metadata.rb`
-files, but we recommend that you remove them. This was proposed in RFC 85.
+The `recommends`, `suggests`, `conflicts`, `replaces` and `grouping` metadata fields are no longer supported, and have been removed, since they were never used. Chef will ignore them in existing `metadata.rb` files, but we recommend that you remove them. This was proposed in RFC 85.
### All unignored cookbook files will now be uploaded.
-We now treat every file under a cookbook directory as belonging to a
-cookbook, unless that file is ignored with a `chefignore` file. This is
-a change from the previous behaviour where only files in certain
-directories, such as `recipes` or `templates`, were treated as special.
-This change allows chef to support new classes of files, such as Ohai
-plugins or Inspec tests, without having to make changes to the cookbook
-format to support them.
+We now treat every file under a cookbook directory as belonging to a cookbook, unless that file is ignored with a `chefignore` file. This is a change from the previous behaviour where only files in certain directories, such as `recipes` or `templates`, were treated as special. This change allows chef to support new classes of files, such as Ohai plugins or Inspec tests, without having to make changes to the cookbook format to support them.
### DSL-based custom resources and providers no longer get module constants
-Up until now, creating a `mycook/resources/thing.rb` would create a `Chef::Resources::MycookThing` name to access the resource class object.
-This const is no longer created for resources and providers. You can access resource classes through the resolver API like:
+Up until now, creating a `mycook/resources/thing.rb` would create a `Chef::Resources::MycookThing` name to access the resource class object. This const is no longer created for resources and providers. You can access resource classes through the resolver API like:
```ruby
Chef::Resource.resource_for_node(:mycook_thing, node)
@@ -380,9 +653,7 @@ A resource declaring something like:
property :x, default: {}
```
-will now see the default value set to be immutable. This prevents cases of
-modifying the default in one resource affecting others. If you want a per-resource
-mutable default value, define it inside a `lazy{}` helper like:
+will now see the default value set to be immutable. This prevents cases of modifying the default in one resource affecting others. If you want a per-resource mutable default value, define it inside a `lazy{}` helper like:
```ruby
property :x, default: lazy { {} }
@@ -396,17 +667,11 @@ some_resource "name_one" do
end
```
-The fix for sending notifications to multipackage resources involved changing the API which inserts resources into the resource collection slightly
-so that it no longer directly takes the string which is typed into the DSL but reads the (possibly coerced) name off of the resource after it is
-built. The end result is that the above resource will be named `some_resource[name_two]` instead of `some_resource[name_one]`. Note that setting
-the name (*not* the `name_property`, but actually renaming the resource) is very uncommon. The fix is to simply name the resource correctly in
-the first place (`some_resource "name_two" do ...`)
+The fix for sending notifications to multipackage resources involved changing the API which inserts resources into the resource collection slightly so that it no longer directly takes the string which is typed into the DSL but reads the (possibly coerced) name off of the resource after it is built. The end result is that the above resource will be named `some_resource[name_two]` instead of `some_resource[name_one]`. Note that setting the name (_not_ the `name_property`, but actually renaming the resource) is very uncommon. The fix is to simply name the resource correctly in the first place (`some_resource "name_two" do ...`)
### `use_inline_resources` is always enabled
-The `use_inline_resources` provider mode is always enabled when using the
-`action :name do ... end` syntax. You can remove the `use_inline_resources`
-line.
+The `use_inline_resources` provider mode is always enabled when using the `action :name do ... end` syntax. You can remove the `use_inline_resources` line.
### `knife cookbook site vendor` has been removed
@@ -418,55 +683,42 @@ Please use `chef generate cookbook` from the ChefDK instead.
### Verify commands no longer support "%{file}"
-Chef has always recommended `%{path}`, and `%{file}` has now been
-removed.
+Chef has always recommended `%{path}`, and `%{file}` has now been removed.
### The `partial_search` recipe method has been removed
-The `partial_search` method has been fully replaced by the
-`filter_result` argument to `search`, and has now been removed.
+The `partial_search` method has been fully replaced by the `filter_result` argument to `search`, and has now been removed.
### The logger and formatter settings are more predictable
-The default now is the formatter. There is no more automatic switching to the logger when logging or when output
-is sent to a pipe. The logger needs to be specifically requested with `--force-logger` or it will not show up.
+The default now is the formatter. There is no more automatic switching to the logger when logging or when output is sent to a pipe. The logger needs to be specifically requested with `--force-logger` or it will not show up.
The `--force-formatter` option does still exist, although it will probably be deprecated in the future.
If your logfiles switch to the formatter, you need to include `--force-logger` for your daemonized runs.
-Redirecting output to a file with `chef-client > /tmp/chef.out` now captures the same output as invoking it directly on the command
-line with no redirection.
+Redirecting output to a file with `chef-client > /tmp/chef.out` now captures the same output as invoking it directly on the command line with no redirection.
### Path Sanity disabled by default and modified
-The chef client itself no long modifies its `ENV['PATH']` variable directly. When using the `shell_out` API now, in addition to
-setting up LANG/LANGUAGE/LC_ALL variables that API will also inject certain system paths and the ruby bindir and gemdirs into
-the PATH (or Path on Windows). The `shell_out_with_systems_locale` API still does not mangle any environment variables. During
-the Chef-13 lifecycle changes will be made to prep Chef-14 to switch so that `shell_out` by default behaves like
-`shell_out_with_systems_locale`. A new flag will get introduced to call `shell_out(..., internal: [true|false])` to either
-get the forced locale and path settings ("internal") or not. When that is introduced in Chef 13.x the default will be `true`
-(backwards-compat with 13.0) and that default will change in 14.0 to 'false'.
+The chef client itself no long modifies its `ENV['PATH']` variable directly. When using the `shell_out` API now, in addition to setting up LANG/LANGUAGE/LC_ALL variables that API will also inject certain system paths and the ruby bindir and gemdirs into the PATH (or Path on Windows). The `shell_out_with_systems_locale` API still does not mangle any environment variables. During the Chef-13 lifecycle changes will be made to prep Chef-14 to switch so that `shell_out` by default behaves like `shell_out_with_systems_locale`. A new flag will get introduced to call `shell_out(..., internal: [true|false])` to either get the forced locale and path settings ("internal") or not. When that is introduced in Chef 13.x the default will be `true` (backwards-compat with 13.0) and that default will change in 14.0 to 'false'.
-The PATH changes have also been tweaked so that the ruby bindir and gemdir PATHS are prepended instead of appended to the PATH.
-Some system directories are still appended.
+The PATH changes have also been tweaked so that the ruby bindir and gemdir PATHS are prepended instead of appended to the PATH. Some system directories are still appended.
Some examples of changes:
-* `which ruby` in 12.x will return any system ruby and fall back to the embedded ruby if using omnibus
-* `which ruby` in 13.x will return any system ruby and will not find the embedded ruby if using omnibus
-* `shell_out_with_systems_locale("which ruby")` behaves the same as `which ruby` above
-* `shell_out("which ruby")` in 12.x will return any system ruby and fall back to the embedded ruby if using omnibus
-* `shell_out("which ruby")` in 13.x will always return the omnibus ruby first (but will find the system ruby if not using omnibus)
+- `which ruby` in 12.x will return any system ruby and fall back to the embedded ruby if using omnibus
+- `which ruby` in 13.x will return any system ruby and will not find the embedded ruby if using omnibus
+- `shell_out_with_systems_locale("which ruby")` behaves the same as `which ruby` above
+- `shell_out("which ruby")` in 12.x will return any system ruby and fall back to the embedded ruby if using omnibus
+- `shell_out("which ruby")` in 13.x will always return the omnibus ruby first (but will find the system ruby if not using omnibus)
The PATH in `shell_out` can also be overridden:
-* `shell_out("which ruby", env: { "PATH" => nil })` - behaves like shell_out_with_systems_locale()
-* `shell_out("which ruby", env: { "PATH" => [...include PATH string here...] })` - set it arbitrarily however you need
+- `shell_out("which ruby", env: { "PATH" => nil })` - behaves like shell_out_with_systems_locale()
+- `shell_out("which ruby", env: { "PATH" => [...include PATH string here...] })` - set it arbitrarily however you need
-Since most providers which launch custom user commands use `shell_out_with_systems_locale` (service, execute, script, etc) the behavior
-will be that those commands that used to be having embedded omnibus paths injected into them no longer will. Generally this will
-fix more problems than it solves, but may causes issues for some use cases.
+Since most providers which launch custom user commands use `shell_out_with_systems_locale` (service, execute, script, etc) the behavior will be that those commands that used to be having embedded omnibus paths injected into them no longer will. Generally this will fix more problems than it solves, but may causes issues for some use cases.
### Default guard clauses (`not_if`/`only_if`) do not change the PATH or other env vars
@@ -474,7 +726,6 @@ The implementation switched to `shell_out_with_systems_locale` to match `execute
### Chef Client will now exit using the RFC062 defined exit codes
-Chef Client will only exit with exit codes defined in RFC 062. This allows other tooling to respond to how a Chef run completes. Attempting to exit Chef Client with an unsupported exit code (either via `Chef::Application.fatal!` or `Chef::Application.exit!`) will result in an exit code of 1 (GENERIC_FAILURE) and a warning in the event log.
-
-When Chef Client is running as a forked process on unix systems, the standardized exit codes are used by the child process. To actually have Chef Client return the standard exit code, `client_fork false` will need to be set in Chef Client's configuration file.
+Chef Client will only exit with exit codes defined in RFC 062\. This allows other tooling to respond to how a Chef run completes. Attempting to exit Chef Client with an unsupported exit code (either via `Chef::Application.fatal!` or `Chef::Application.exit!`) will result in an exit code of 1 (GENERIC_FAILURE) and a warning in the event log.
+When Chef Client is running as a forked process on unix systems, the standardized exit codes are used by the child process. To actually have Chef Client return the standard exit code, `client_fork false` will need to be set in Chef Client's configuration file.
diff --git a/Rakefile b/Rakefile
index f6e6758820..2ec934c432 100644
--- a/Rakefile
+++ b/Rakefile
@@ -27,9 +27,7 @@ require_relative "tasks/rspec"
require_relative "tasks/maintainers"
require_relative "tasks/cbgb"
require_relative "tasks/dependencies"
-require_relative "tasks/changelog"
require_relative "tasks/announce"
-require_relative "tasks/version"
ChefConfig::PackageTask.new(File.expand_path("..", __FILE__), "Chef", "chef") do |package|
package.component_paths = ["chef-config"]
@@ -51,15 +49,6 @@ task :register_eventlog do
end
end
-desc "Keep the Dockerfile up-to-date"
-task :update_dockerfile do
- require "mixlib/install"
- latest_stable_version = Mixlib::Install.available_versions("chef", "stable").last
- text = File.read("Dockerfile")
- new_text = text.gsub(/^ARG VERSION=[\d\.]+$/, "ARG VERSION=#{latest_stable_version}")
- File.open("Dockerfile", "w+") { |f| f.write(new_text) }
-end
-
begin
require "chefstyle"
require "rubocop/rake_task"
diff --git a/VERSION b/VERSION
index 8e846c4dd8..c402902cc8 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-13.3.1 \ No newline at end of file
+13.4.33 \ No newline at end of file
diff --git a/acceptance/Gemfile.lock b/acceptance/Gemfile.lock
index eb139cc225..80db23bc4f 100644
--- a/acceptance/Gemfile.lock
+++ b/acceptance/Gemfile.lock
@@ -128,7 +128,7 @@ GEM
mixlib-shellout
mixlib-versioning
mixlib-log (1.7.1)
- mixlib-shellout (2.2.7)
+ mixlib-shellout (2.3.2)
mixlib-versioning (1.1.0)
molinillo (0.5.7)
multi_json (1.12.1)
diff --git a/acceptance/data-collector/.acceptance/data-collector-test/files/default/api.rb b/acceptance/data-collector/.acceptance/data-collector-test/files/default/api.rb
index 3fb2c730b0..fcfc704d29 100644
--- a/acceptance/data-collector/.acceptance/data-collector-test/files/default/api.rb
+++ b/acceptance/data-collector/.acceptance/data-collector-test/files/default/api.rb
@@ -17,35 +17,51 @@ module ApiHelpers
end
class Counter
- def self.reset
- @@counters = Hash.new { |h, k| h[k] = 0 }
- end
+ class << self
+ attr_accessor :counters
- def self.increment(payload)
- counter_name = ApiHelpers.payload_type(payload)
- @@counters[counter_name] += 1
- end
+ def counters
+ @counters ||= Hash.new { |h, k| h[k] = 0 }
+ end
+
+ def reset
+ @counters = nil
+ end
+
+ def increment(payload)
+ counter_name = ApiHelpers.payload_type(payload)
+ counters[counter_name] += 1
+ end
- def self.to_json
- @@counters.to_json
+ def to_json
+ counters.to_json
+ end
end
end
class MessageCache
include ApiHelpers
- def self.reset
- @@message_cache = {}
- end
+ class << self
+ attr_accessor :message_cache
- def self.store(payload)
- cache_key = ApiHelpers.payload_type(payload)
+ def message_cache
+ @message_cache ||= {}
+ end
- @@message_cache[cache_key] = payload
- end
+ def reset
+ @message_cache = nil
+ end
+
+ def store(payload)
+ cache_key = ApiHelpers.payload_type(payload)
+
+ message_cache[cache_key] = payload
+ end
- def self.fetch(cache_key)
- @@message_cache[cache_key].to_json
+ def fetch(cache_key)
+ message_cache[cache_key].to_json
+ end
end
end
diff --git a/acceptance/data-collector/.acceptance/data-collector-test/recipes/default.rb b/acceptance/data-collector/.acceptance/data-collector-test/recipes/default.rb
index 20b945db9b..61915c54b7 100644
--- a/acceptance/data-collector/.acceptance/data-collector-test/recipes/default.rb
+++ b/acceptance/data-collector/.acceptance/data-collector-test/recipes/default.rb
@@ -1,3 +1,6 @@
+
+embedded_path = "/opt/chef/embedded/bin:#{ENV["PATH"]}"
+
api_root_dir = "/var/opt/data_collector_api"
directory api_root_dir do
@@ -14,6 +17,7 @@ cookbook_file ::File.join(api_root_dir, "api.rb")
execute "bundle install --binstubs" do
cwd api_root_dir
+ environment({ "PATH" => embedded_path })
end
pid_file = "/var/run/api.pid"
@@ -21,11 +25,13 @@ running_pid = ::File.exist?(pid_file) ? ::File.read(pid_file).strip : nil
execute "kill existing API process" do
command "kill #{running_pid}"
+ environment({ "PATH" => embedded_path })
not_if { running_pid.nil? }
end
execute "start API" do
command "bin/rackup -D -P #{pid_file}"
+ environment({ "PATH" => embedded_path })
cwd api_root_dir
end
diff --git a/appveyor.yml b/appveyor.yml
index c809811bb1..de947203c1 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -1,13 +1,13 @@
version: "master-{build}"
-os: Windows Server 2012 R2
+os: Visual Studio 2015
platform:
- x64
environment:
matrix:
- - ruby_version: "23-x64"
- - ruby_version: "23"
+ - ruby_version: "24-x64"
+ - ruby_version: "24"
clone_folder: c:\projects\chef
clone_depth: 1
diff --git a/chef-config/lib/chef-config/version.rb b/chef-config/lib/chef-config/version.rb
index ea61b842c4..509d76cf8c 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.3.1"
+ VERSION = "13.4.33"
end
#
diff --git a/kitchen-tests/.kitchen.travis.yml b/kitchen-tests/.kitchen.travis.yml
index 658851beb6..720f034cb5 100644
--- a/kitchen-tests/.kitchen.travis.yml
+++ b/kitchen-tests/.kitchen.travis.yml
@@ -31,38 +31,35 @@ verifier:
platforms:
- name: debian-7
driver:
- image: debian:7
+ image: dokken/debian-7
pid_one_command: /sbin/init
intermediate_instructions:
- RUN /usr/bin/apt-get update
- - RUN /usr/bin/apt-get -y install zlib1g-dev sudo net-tools wget ca-certificates
+ - RUN /usr/bin/apt-get -y install sudo
- RUN /bin/mkdir /var/run/sshd
- name: debian-8
driver:
- image: debian:8
+ image: dokken/debian-8
pid_one_command: /bin/systemd
intermediate_instructions:
- RUN /usr/bin/apt-get update
- - RUN /usr/bin/apt-get -y install zlib1g-dev sudo net-tools wget ca-certificates
+ - RUN /usr/bin/apt-get -y install sudo
-- name: centos-5
+- name: debian-9
driver:
- image: centos:5
- platform: rhel
- run_command: /sbin/init
+ image: dokken/debian-9
+ pid_one_command: /bin/systemd
intermediate_instructions:
- - RUN yum clean all
- - RUN yum install -y which initscripts net-tools sudo wget
- - RUN sed -i -e "s/Defaults.*requiretty.*/Defaults !requiretty/g" /etc/sudoers
+ - RUN /usr/bin/apt-get update
+ - RUN /usr/bin/apt-get -y install sudo
- name: centos-6
driver:
- image: centos:6
+ image: dokken/centos-6
run_command: /sbin/init
intermediate_instructions:
- - RUN yum clean all
- - RUN yum -y install which initscripts net-tools sudo wget
+ - RUN yum -y install sudo
- RUN sed -i -e "s/Defaults.*requiretty.*/Defaults !requiretty/g" /etc/sudoers
attributes:
chef_client:
@@ -70,56 +67,51 @@ platforms:
- name: centos-7
driver:
- image: centos:7
+ image: dokken/centos-7
pid_one_command: /usr/lib/systemd/systemd
intermediate_instructions:
- - RUN yum clean all
- - RUN yum -y install which initscripts net-tools sudo wget
+ - RUN yum -y install sudo
- RUN sed -i -e "s/Defaults.*requiretty.*/Defaults !requiretty/g" /etc/sudoers
- name: fedora-latest
driver:
- image: fedora:latest
+ image: dokken/fedora-latest
pid_one_command: /usr/lib/systemd/systemd
intermediate_instructions:
- - RUN dnf -y install yum which initscripts rpm-build zlib-devel net-tools sudo wget
- - RUN yum makecache
+ - RUN dnf -y install sudo
- RUN sed -i -e "s/Defaults.*requiretty.*/Defaults !requiretty/g" /etc/sudoers
- name: ubuntu-14.04
driver:
- image: ubuntu-upstart:14.04
+ image: dokken/ubuntu-14.04
pid_one_command: /sbin/init
intermediate_instructions:
- RUN /usr/bin/apt-get update
- - RUN /usr/bin/apt-get -y install zlib1g-dev sudo net-tools wget ca-certificates
+ - RUN /usr/bin/apt-get -y install sudo
- name: ubuntu-16.04
driver:
- image: ubuntu:16.04
+ image: dokken/ubuntu-16.04
pid_one_command: /bin/systemd
intermediate_instructions:
- RUN /usr/bin/apt-get update
- - RUN /usr/bin/apt-get -y install zlib1g-dev sudo net-tools wget ca-certificates
+ - RUN /usr/bin/apt-get -y install sudo
-- name: opensuse-13.2
+- name: opensuse-leap
driver:
- image: opensuse:13.2
+ image: dokken/opensuse-leap
pid_one_command: /bin/systemd
- intermediate_instructions:
- - RUN zypper refresh
- name: amazonlinux
driver:
- image: amazonlinux:latest
+ image: dokken/amazonlinux
pid_one_command: /sbin/init
intermediate_instructions:
- - RUN yum clean all
- - RUN yum -y install which initscripts net-tools sudo wget
+ - RUN yum -y install sudo
- RUN sed -i -e "s/Defaults.*requiretty.*/Defaults !requiretty/g" /etc/sudoers
suites:
- - name: webapp
+ - name: base
run_list:
- recipe[base::default]
- name: awesome_customers_ubuntu
diff --git a/kitchen-tests/.kitchen.yml b/kitchen-tests/.kitchen.yml
index 87981781db..4e570b125e 100644
--- a/kitchen-tests/.kitchen.yml
+++ b/kitchen-tests/.kitchen.yml
@@ -24,13 +24,11 @@ provisioner:
platforms:
- name: ubuntu-14.04
- name: ubuntu-16.04
- - name: centos-7.2
- - name: centos-6.7
- # needs fixing for 5.11
- # - name: centos-5.11
+ - name: centos-7
+ - name: centos-6
suites:
- - name: webapp
+ - name: base
run_list:
- recipe[base::default]
- name: awesome_customers_ubuntu
diff --git a/kitchen-tests/Berksfile b/kitchen-tests/Berksfile
index 9a2df463fc..22f838d83e 100644
--- a/kitchen-tests/Berksfile
+++ b/kitchen-tests/Berksfile
@@ -1,12 +1,7 @@
source "https://supermarket.chef.io"
-#cookbook "webapp", path: "cookbooks/webapp"
cookbook "base", path: "cookbooks/base"
-cookbook "php", "~> 1.5.0"
-
-cookbook "resolver", github: "chef-cookbooks/resolver"
-
# Disabled pending updating these test cases for Chef 13.
# cookbook "awesome_customers_ubuntu_wrapper", path: "cookbooks/awesome_customers_ubuntu_wrapper"
# cookbook "awesome_customers_ubuntu", github: "lamont-granquist/awesome_customers_ubuntu", branch: "lcg/bump-mysql-version"
diff --git a/kitchen-tests/Berksfile.lock b/kitchen-tests/Berksfile.lock
index 3d6e8d15c0..6cd1308fcd 100644
--- a/kitchen-tests/Berksfile.lock
+++ b/kitchen-tests/Berksfile.lock
@@ -1,13 +1,9 @@
DEPENDENCIES
base
path: cookbooks/base
- php (~> 1.5.0)
- resolver
- git: https://github.com/chef-cookbooks/resolver.git
- revision: 4ab8cb0dfee3696fb8a1e4398e95bff9f33fd6ab
GRAPH
- apt (6.0.1)
+ apt (6.1.4)
base (0.1.0)
apt (>= 0.0.0)
build-essential (>= 0.0.0)
@@ -23,50 +19,35 @@ GRAPH
sudo (>= 0.0.0)
ubuntu (>= 0.0.0)
users (>= 0.0.0)
- build-essential (8.0.0)
+ build-essential (8.0.3)
mingw (>= 1.1)
seven_zip (>= 0.0.0)
- chef-client (8.0.0)
- cron (>= 1.7.0)
+ chef-client (8.1.8)
+ cron (>= 2.0.0)
logrotate (>= 1.9.0)
- windows (>= 1.42.0)
- chef_hostname (0.5.0)
- compat_resource (12.16.3)
- cron (4.1.0)
+ windows (>= 2.0.0)
+ chef_hostname (0.6.1)
+ compat_resource (12.19.0)
+ cron (4.1.3)
compat_resource (>= 0.0.0)
- iis (5.1.0)
- windows (>= 2.0)
- iptables (4.0.1)
- logrotate (2.1.0)
- compat_resource (>= 0.0.0)
- mingw (2.0.0)
+ iptables (4.2.1)
+ logrotate (2.2.0)
+ mingw (2.0.1)
seven_zip (>= 0.0.0)
multipackage (4.0.0)
compat_resource (>= 0.0.0)
- mysql (8.3.1)
nscd (5.0.0)
- ntp (3.3.1)
- ohai (5.0.2)
- openssh (2.2.0)
+ ntp (3.5.2)
+ ohai (5.2.0)
+ openssh (2.5.0)
iptables (>= 1.0)
- php (1.5.0)
- build-essential (>= 0.0.0)
- iis (>= 0.0.0)
- mysql (>= 0.0.0)
- windows (>= 0.0.0)
- xml (>= 0.0.0)
- yum-epel (>= 0.0.0)
resolver (2.0.1)
- selinux (1.0.3)
+ selinux (2.1.0)
seven_zip (2.0.2)
windows (>= 1.2.2)
- sudo (3.3.1)
+ sudo (3.5.3)
ubuntu (2.0.1)
apt (>= 0.0.0)
- users (4.0.3)
- windows (3.0.4)
+ users (5.1.0)
+ windows (3.1.2)
ohai (>= 4.0.0)
- xml (3.1.1)
- build-essential (>= 0.0.0)
- yum-epel (2.1.1)
- compat_resource (>= 12.16.3)
diff --git a/kitchen-tests/cookbooks/base/Berksfile b/kitchen-tests/cookbooks/base/Berksfile
index ba11c46c1d..967b9a78b6 100644
--- a/kitchen-tests/cookbooks/base/Berksfile
+++ b/kitchen-tests/cookbooks/base/Berksfile
@@ -1,5 +1,3 @@
source "https://supermarket.chef.io"
metadata
-
-cookbook "apt"
diff --git a/kitchen-tests/cookbooks/base/README.md b/kitchen-tests/cookbooks/base/README.md
index f19ab46735..2889a2d0dc 100644
--- a/kitchen-tests/cookbooks/base/README.md
+++ b/kitchen-tests/cookbooks/base/README.md
@@ -1,3 +1,3 @@
-# webapp
+# base
-TODO: Enter the cookbook description here.
+A standard chef "base" cookbook that performs various base system configuration tasks using common community cookbooks.
diff --git a/kitchen-tests/cookbooks/base/metadata.rb b/kitchen-tests/cookbooks/base/metadata.rb
index d29665d598..9a85a0e24b 100644
--- a/kitchen-tests/cookbooks/base/metadata.rb
+++ b/kitchen-tests/cookbooks/base/metadata.rb
@@ -22,3 +22,14 @@ depends "selinux"
depends "sudo"
depends "ubuntu"
depends "users"
+
+supports "ubuntu"
+supports "debian"
+supports "redhat"
+supports "opensuse"
+supports "fedora"
+supports "amazon"
+
+chef_version ">= 13"
+issues_url "https://github.com/chef/chef/issues"
+source_url "https://github.com/chef/chef"
diff --git a/kitchen-tests/cookbooks/base/recipes/default.rb b/kitchen-tests/cookbooks/base/recipes/default.rb
index d8dbb9fe41..bc98981d5d 100644
--- a/kitchen-tests/cookbooks/base/recipes/default.rb
+++ b/kitchen-tests/cookbooks/base/recipes/default.rb
@@ -1,5 +1,5 @@
#
-# Cookbook:: webapp
+# Cookbook:: base
# Recipe:: default
#
# Copyright:: 2014-2017, Chef Software, Inc.
@@ -7,12 +7,12 @@
hostname "chef-travis-ci.chef.io"
-if node["platform_family"] == "debian"
+if platform_family?("debian")
include_recipe "ubuntu"
- apt_update "packages"
+ apt_update
end
-if %w{rhel fedora}.include?(node["platform_family"])
+if platform_family?("rhel", "fedora", "amazon")
include_recipe "selinux::disabled"
end
@@ -23,7 +23,7 @@ yum_repository "epel" do
gpgkey "https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-#{node['platform_version'].to_i}"
gpgcheck true
mirrorlist "https://mirrors.fedoraproject.org/metalink?repo=epel-#{node['platform_version'].to_i}&arch=$basearch"
- only_if { node["platform_family"] == "rhel" && node["platform"] != "amazon" }
+ only_if { platform_family?("rhel") }
end
include_recipe "build-essential"
@@ -34,7 +34,10 @@ include_recipe "ntp"
include_recipe "resolver"
-include_recipe "users::sysadmins"
+users_manage "sysadmin" do
+ group_id 2300
+ action [:create]
+end
include_recipe "sudo"
diff --git a/kitchen-tests/cookbooks/base/recipes/packages.rb b/kitchen-tests/cookbooks/base/recipes/packages.rb
index bb5fa7bb71..a448936acd 100644
--- a/kitchen-tests/cookbooks/base/recipes/packages.rb
+++ b/kitchen-tests/cookbooks/base/recipes/packages.rb
@@ -1,5 +1,5 @@
#
-# Cookbook:: webapp
+# Cookbook:: base
# Recipe:: packages
#
# Copyright:: 2014-2017, Chef Software, Inc.
diff --git a/kitchen-tests/cookbooks/base/recipes/tests.rb b/kitchen-tests/cookbooks/base/recipes/tests.rb
index 8b90b48c5d..c6095eaeb5 100644
--- a/kitchen-tests/cookbooks/base/recipes/tests.rb
+++ b/kitchen-tests/cookbooks/base/recipes/tests.rb
@@ -1,5 +1,5 @@
#
-# Cookbook:: webapp
+# Cookbook:: base
# Recipe:: tests
#
# Copyright:: 2014-2017, Chef Software, Inc.
diff --git a/kitchen-tests/cookbooks/webapp/Berksfile b/kitchen-tests/cookbooks/webapp/Berksfile
deleted file mode 100644
index ba11c46c1d..0000000000
--- a/kitchen-tests/cookbooks/webapp/Berksfile
+++ /dev/null
@@ -1,5 +0,0 @@
-source "https://supermarket.chef.io"
-
-metadata
-
-cookbook "apt"
diff --git a/kitchen-tests/cookbooks/webapp/README.md b/kitchen-tests/cookbooks/webapp/README.md
deleted file mode 100644
index f19ab46735..0000000000
--- a/kitchen-tests/cookbooks/webapp/README.md
+++ /dev/null
@@ -1,3 +0,0 @@
-# webapp
-
-TODO: Enter the cookbook description here.
diff --git a/kitchen-tests/cookbooks/webapp/attributes/default.rb b/kitchen-tests/cookbooks/webapp/attributes/default.rb
deleted file mode 100644
index 2ff7a6c5ff..0000000000
--- a/kitchen-tests/cookbooks/webapp/attributes/default.rb
+++ /dev/null
@@ -1,14 +0,0 @@
-default["apache"]["remote_host_ip"] = "127.0.0.1"
-
-default["webapp"]["database"] = "webapp"
-default["webapp"]["db_username"] = "webapp"
-default["webapp"]["path"] = "/srv/webapp"
-
-# XXX: apache2 cookbook 2.0.0 has bugs around changing the mpm and then attempting a graceful restart
-# which fails and leaves the service down.
-case node["platform"]
-when "ubuntu"
- if node["platform_version"].to_f >= 14.04
- default[:apache][:mpm] = "event"
- end
-end
diff --git a/kitchen-tests/cookbooks/webapp/metadata.rb b/kitchen-tests/cookbooks/webapp/metadata.rb
deleted file mode 100644
index f560159fd8..0000000000
--- a/kitchen-tests/cookbooks/webapp/metadata.rb
+++ /dev/null
@@ -1,12 +0,0 @@
-name "webapp"
-maintainer ""
-maintainer_email ""
-license "Apache-2.0"
-description "Installs/Configures webapp"
-long_description "Installs/Configures webapp"
-version "0.1.0"
-
-depends "apache2", "~> 3.2.2"
-depends "database", "~> 2.3.1"
-depends "mysql", "~> 5.6.3"
-depends "php", "~> 1.5.0"
diff --git a/kitchen-tests/cookbooks/webapp/recipes/default.rb b/kitchen-tests/cookbooks/webapp/recipes/default.rb
deleted file mode 100644
index 2b3459b794..0000000000
--- a/kitchen-tests/cookbooks/webapp/recipes/default.rb
+++ /dev/null
@@ -1,64 +0,0 @@
-#
-# Cookbook Name:: webapp
-# Recipe:: default
-#
-# Copyright (C) 2014
-#
-
-include_recipe "apache2"
-include_recipe "database::mysql"
-include_recipe "php"
-
-creds = Hash.new
-%w{mysql webapp}.each do |item_name|
- creds[item_name] = data_bag_item("passwords", item_name)
-end
-
-web_app "webapp" do
- server_name "localhost"
- server_aliases [node["fqdn"], node["hostname"], "localhost.localdomain"]
- docroot node["webapp"]["path"]
- cookbook "apache2"
-end
-
-mysql_service "default" do
- server_root_password creds["mysql"]["server_root_password"]
- server_repl_password creds["mysql"]["server_repl_password"]
-end
-
-mysql_database node["webapp"]["database"] do
- connection ({
- :host => "localhost",
- :username => "root",
- :password => creds["mysql"]["server_root_password"],
- })
- action :create
-end
-
-mysql_database_user node["webapp"]["db_username"] do
- connection ({
- :host => "localhost",
- :username => "root",
- :password => creds["mysql"]["server_root_password"],
- })
- password creds["webapp"]["db_password"]
- database_name node["webapp"]["database"]
- privileges [:select, :update, :insert, :create, :delete]
- action :grant
-end
-
-directory node["webapp"]["path"] do
- owner "root"
- group "root"
- mode "0755"
- action :create
- recursive true
-end
-
-template "#{node['webapp']['path']}/index.html" do
- source "index.html.erb"
-end
-
-template "#{node['webapp']['path']}/index.php" do
- source "index.php.erb"
-end
diff --git a/kitchen-tests/cookbooks/webapp/templates/index.html.erb b/kitchen-tests/cookbooks/webapp/templates/index.html.erb
deleted file mode 100644
index 6da0629b9e..0000000000
--- a/kitchen-tests/cookbooks/webapp/templates/index.html.erb
+++ /dev/null
@@ -1,5 +0,0 @@
-<html>
- <body>
- <h1>Hello, World!</h1>
- </body>
-</html>
diff --git a/kitchen-tests/cookbooks/webapp/templates/index.php.erb b/kitchen-tests/cookbooks/webapp/templates/index.php.erb
deleted file mode 100644
index b08b076614..0000000000
--- a/kitchen-tests/cookbooks/webapp/templates/index.php.erb
+++ /dev/null
@@ -1,8 +0,0 @@
-<html>
- <head>
- <title>PHP Test</title>
- </head>
- <body>
- <?php echo '<p>Hello, World!</p>'; ?>
- </body>
-</html>
diff --git a/kitchen-tests/data_bags/passwords/webapp.json b/kitchen-tests/data_bags/passwords/webapp.json
deleted file mode 100644
index 43c0ae1ced..0000000000
--- a/kitchen-tests/data_bags/passwords/webapp.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "id": "webapp",
- "db_password": "supersecretdbpassword"
-}
diff --git a/kitchen-tests/test/fixtures/platforms/centos/5.json b/kitchen-tests/test/fixtures/platforms/centos/5.json
deleted file mode 100644
index 9d324a2f03..0000000000
--- a/kitchen-tests/test/fixtures/platforms/centos/5.json
+++ /dev/null
@@ -1,14 +0,0 @@
-{
- "apache": {
- "package": "httpd",
- "service_name": "httpd"
- },
- "mysql": {
- "server_package": "mysql-server",
- "client_package": "mysql",
- "service_name": "mysqld"
- },
- "php" : {
- "package": "php53"
- }
-}
diff --git a/kitchen-tests/test/fixtures/platforms/centos/6.json b/kitchen-tests/test/fixtures/platforms/centos/6.json
deleted file mode 100644
index 4f74a3ed4a..0000000000
--- a/kitchen-tests/test/fixtures/platforms/centos/6.json
+++ /dev/null
@@ -1,14 +0,0 @@
-{
- "apache": {
- "package": "httpd",
- "service_name": "httpd"
- },
- "mysql": {
- "server_package": "mysql-server",
- "client_package": "mysql",
- "service_name": "mysqld"
- },
- "php" : {
- "package": "php"
- }
-}
diff --git a/kitchen-tests/test/fixtures/platforms/ubuntu/10.04.json b/kitchen-tests/test/fixtures/platforms/ubuntu/10.04.json
deleted file mode 100644
index a9677c7ca5..0000000000
--- a/kitchen-tests/test/fixtures/platforms/ubuntu/10.04.json
+++ /dev/null
@@ -1,14 +0,0 @@
-{
- "apache": {
- "package": "apache2",
- "service_name": "apache2"
- },
- "mysql": {
- "server_package": "mysql-server-5.1",
- "client_package": "mysql-client-5.1",
- "service_name": "mysql"
- },
- "php" : {
- "package": "php5"
- }
-}
diff --git a/kitchen-tests/test/fixtures/platforms/ubuntu/12.04.json b/kitchen-tests/test/fixtures/platforms/ubuntu/12.04.json
deleted file mode 100644
index eab46db2e5..0000000000
--- a/kitchen-tests/test/fixtures/platforms/ubuntu/12.04.json
+++ /dev/null
@@ -1,14 +0,0 @@
-{
- "apache": {
- "package": "apache2",
- "service_name": "apache2"
- },
- "mysql": {
- "server_package": "mysql-server-5.5",
- "client_package": "mysql-client-5.5",
- "service_name": "mysql"
- },
- "php" : {
- "package": "php5"
- }
-}
diff --git a/kitchen-tests/test/fixtures/platforms/ubuntu/14.04.json b/kitchen-tests/test/fixtures/platforms/ubuntu/14.04.json
deleted file mode 100644
index eab46db2e5..0000000000
--- a/kitchen-tests/test/fixtures/platforms/ubuntu/14.04.json
+++ /dev/null
@@ -1,14 +0,0 @@
-{
- "apache": {
- "package": "apache2",
- "service_name": "apache2"
- },
- "mysql": {
- "server_package": "mysql-server-5.5",
- "client_package": "mysql-client-5.5",
- "service_name": "mysql"
- },
- "php" : {
- "package": "php5"
- }
-}
diff --git a/kitchen-tests/test/fixtures/platforms/ubuntu/14.10.json b/kitchen-tests/test/fixtures/platforms/ubuntu/14.10.json
deleted file mode 100644
index eab46db2e5..0000000000
--- a/kitchen-tests/test/fixtures/platforms/ubuntu/14.10.json
+++ /dev/null
@@ -1,14 +0,0 @@
-{
- "apache": {
- "package": "apache2",
- "service_name": "apache2"
- },
- "mysql": {
- "server_package": "mysql-server-5.5",
- "client_package": "mysql-client-5.5",
- "service_name": "mysql"
- },
- "php" : {
- "package": "php5"
- }
-}
diff --git a/kitchen-tests/test/fixtures/serverspec_helper.rb b/kitchen-tests/test/fixtures/serverspec_helper.rb
deleted file mode 100644
index feb4c21200..0000000000
--- a/kitchen-tests/test/fixtures/serverspec_helper.rb
+++ /dev/null
@@ -1,32 +0,0 @@
-# Shamelessly copied from https://github.com/onehealth-cookbooks/apache2/blob/master/test/fixtures/serverspec_helper.rb
-# The commented-out platforms in the osmapping hash can be added once we have added them into
-# our .kitchen.yml and .kitchen.travis.yml and added the appropriate JSON under test/fixtures/platforms.
-
-require "serverspec"
-require "json"
-require "ffi_yajl"
-
-set :backend, :exec
-
-include Specinfra::Helper::Properties
-
-require "pp"
-pp os
-
-def load_nodestub
- case os[:family]
- when "ubuntu", "debian"
- platform = os[:family]
- platform_version = os[:release]
- when "redhat"
- platform = "centos"
- platform_version = os[:release].to_i
- end
- FFI_Yajl::Parser.parse(IO.read("#{ENV['BUSSER_ROOT']}/../kitchen/data/platforms/#{platform}/#{platform_version}.json"), :symbolize_names => true)
-end
-
-# centos-59 doesn't have /sbin in the default path,
-# so we must ensure it's on serverspec's path
-set :path, "$PATH:/sbin"
-
-set_property load_nodestub
diff --git a/kitchen-tests/test/integration/webapp/default_spec.rb b/kitchen-tests/test/integration/webapp/default_spec.rb
deleted file mode 100644
index f7ce2a2c7c..0000000000
--- a/kitchen-tests/test/integration/webapp/default_spec.rb
+++ /dev/null
@@ -1,118 +0,0 @@
-#describe port(80) do
-# it { should be_listening }
-# its('processes') {should include 'http'}
-#end
-#
-#describe command("curl http://localhost/index.html") do
-# its("stdout") { should match /Hello, World!/ }
-#end
-
-case os[:family]
-when "debian", "ubuntu"
- ssh_package = "openssh-client"
- ssh_service = "ssh"
- ntp_service = "ntp"
-when "centos", "redhat", "fedora", "amazon"
- ssh_package = "openssh-clients"
- ssh_service = "sshd"
- ntp_service = "ntpd"
-else
- raise "i don't know the family #{os[:family]}"
-end
-
-describe package("nscd") do
- it { should be_installed }
-end
-
-describe service("nscd") do
- # broken?
- # it { should be_enabled }
- it { should be_installed }
- it { should be_running }
-end
-
-describe package(ssh_package) do
- it { should be_installed }
-end
-
-describe service(ssh_service) do
- it { should be_enabled }
- it { should be_installed }
- it { should be_running }
-end
-
-describe sshd_config do
- its("Protocol") { should cmp 2 }
- its("GssapiAuthentication") { should cmp "no" }
- its("UseDns") { should cmp "no" }
-end
-
-describe ssh_config do
- its("StrictHostKeyChecking") { should cmp "no" }
- its("GssapiAuthentication") { should cmp "no" }
-end
-
-describe package("ntp") do
- it { should be_installed }
-end
-
-describe service(ntp_service) do
- # broken?
- # it { should be_enabled }
- it { should be_installed }
- it { should be_running }
-end
-
-describe service("chef-client") do
- it { should be_enabled }
- it { should be_installed }
- it { should be_running }
-end
-
-describe file("/etc/resolv.conf") do
- its("content") { should match /search\s+chef.io/ }
- its("content") { should match /nameserver\s+8.8.8.8/ }
- its("content") { should match /nameserver\s+8.8.4.4/ }
-end
-
-describe package("gcc") do
- it { should be_installed }
-end
-
-describe package("flex") do
- it { should be_installed }
-end
-
-describe package("bison") do
- it { should be_installed }
-end
-
-describe package("autoconf") do
- it { should be_installed }
-end
-
-%w{lsof tcpdump strace zsh dmidecode ltrace bc curl wget telnet subversion git traceroute htop tmux }.each do |pkg|
- describe package pkg do
- it { should be_installed }
- end
-end
-
-describe etc_group.where(group_name: "sysadmin") do
- its("users") { should include "adam" }
- its("gids") { should eq [2300] }
-end
-
-describe passwd.users("adam") do
- its("uids") { should eq ["666"] }
-end
-
-describe ntp_conf do
- its("server") { should_not eq nil }
-end
-
-## busted inside of docker containers?
-#describe port(22) do
-# it { should be_listening }
-# its("protocols") { should include "tcp" }
-# its("processes") { should eq ["sshd"] }
-#end
diff --git a/lib/chef/cookbook/metadata.rb b/lib/chef/cookbook/metadata.rb
index 5efadd6f62..b23c01e622 100644
--- a/lib/chef/cookbook/metadata.rb
+++ b/lib/chef/cookbook/metadata.rb
@@ -100,8 +100,8 @@ class Chef
@long_description = ""
@license = "All rights reserved"
- @maintainer = nil
- @maintainer_email = nil
+ @maintainer = ""
+ @maintainer_email = ""
@platforms = Mash.new
@dependencies = Mash.new
diff --git a/lib/chef/deprecation/warnings.rb b/lib/chef/deprecation/warnings.rb
index f5feb91063..c227739a8d 100644
--- a/lib/chef/deprecation/warnings.rb
+++ b/lib/chef/deprecation/warnings.rb
@@ -20,10 +20,12 @@ class Chef
module Deprecation
module Warnings
+ require "chef/version"
+
def add_deprecation_warnings_for(method_names)
method_names.each do |name|
define_method(name) do |*args|
- message = "Method '#{name}' of '#{self.class}' is deprecated. It will be removed in Chef 13."
+ message = "Method '#{name}' of '#{self.class}' is deprecated. It will be removed in Chef #{Chef::VERSION.to_i.next}."
message << " Please update your cookbooks accordingly."
Chef.deprecated(:internal_api, message)
super(*args)
diff --git a/lib/chef/exceptions.rb b/lib/chef/exceptions.rb
index 91402bc6c2..a73062b676 100644
--- a/lib/chef/exceptions.rb
+++ b/lib/chef/exceptions.rb
@@ -515,7 +515,7 @@ This error is most often caused by network issues (proxies, etc) outside of chef
"Resource #{r['Name']} is a binary resource"
end
end
- super "Found multiple matching resources. #{matches_info.join("\n")}"
+ super "Found multiple resources matching #{matches_info[0]["Module"]["Name"]}:\n#{(matches_info.map { |f| f["Module"]["Version"] }).uniq.join("\n")}"
end
end
diff --git a/lib/chef/http.rb b/lib/chef/http.rb
index c741dcca97..14dd8b93a5 100644
--- a/lib/chef/http.rb
+++ b/lib/chef/http.rb
@@ -5,7 +5,7 @@
# Author:: Christopher Brown (<cb@chef.io>)
# Author:: Christopher Walters (<cw@chef.io>)
# Author:: Daniel DeLeo (<dan@chef.io>)
-# Copyright:: Copyright 2009-2016 Chef Software, Inc.
+# Copyright:: Copyright 2009-2017, Chef Software Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -144,9 +144,9 @@ class Chef
def request(method, path, headers = {}, data = false)
http_attempts ||= 0
url = create_url(path)
- method, url, headers, data = apply_request_middleware(method, url, headers, data)
+ processed_method, url, processed_headers, processed_data = apply_request_middleware(method, url, headers, data)
- response, rest_request, return_value = send_http_request(method, url, headers, data)
+ response, rest_request, return_value = send_http_request(processed_method, url, processed_headers, processed_data)
response, rest_request, return_value = apply_response_middleware(response, rest_request, return_value)
response.error! unless success_response?(response)
@@ -157,7 +157,6 @@ class Chef
response = e.response
if response.kind_of?(Net::HTTPNotAcceptable) && version_retries - http_attempts > 0
Chef::Log.debug("Negotiating protocol version with #{url}, retry #{http_attempts}/#{version_retries}")
- sleep(http_retry_delay)
retry
else
raise
@@ -176,11 +175,12 @@ class Chef
url = create_url(path)
response, rest_request, return_value = nil, nil, nil
tempfile = nil
+ data = nil
method = :GET
- method, url, headers, data = apply_request_middleware(method, url, headers, data)
+ method, url, processed_headers, data = apply_request_middleware(method, url, headers, data)
- response, rest_request, return_value = send_http_request(method, url, headers, data) do |http_response|
+ response, rest_request, return_value = send_http_request(method, url, processed_headers, data) do |http_response|
if http_response.kind_of?(Net::HTTPSuccess)
tempfile = stream_to_tempfile(url, http_response, &progress_block)
end
@@ -196,7 +196,6 @@ class Chef
response = e.response
if response.kind_of?(Net::HTTPNotAcceptable) && version_retries - http_attempts > 0
Chef::Log.debug("Negotiating protocol version with #{url}, retry #{http_attempts}/#{version_retries}")
- sleep(http_retry_delay)
retry
else
raise
@@ -223,11 +222,12 @@ class Chef
url = create_url(path)
response, rest_request, return_value = nil, nil, nil
tempfile = nil
+ data = nil
method = :GET
- method, url, headers, data = apply_request_middleware(method, url, headers, data)
+ method, url, processed_headers, data = apply_request_middleware(method, url, headers, data)
- response, rest_request, return_value = send_http_request(method, url, headers, data) do |http_response|
+ response, rest_request, return_value = send_http_request(method, url, processed_headers, data) do |http_response|
if http_response.kind_of?(Net::HTTPSuccess)
tempfile = stream_to_tempfile(url, http_response)
end
@@ -252,7 +252,6 @@ class Chef
response = e.response
if response.kind_of?(Net::HTTPNotAcceptable) && version_retries - http_attempts > 0
Chef::Log.debug("Negotiating protocol version with #{url}, retry #{http_attempts}/#{version_retries}")
- sleep(http_retry_delay)
retry
else
raise
diff --git a/lib/chef/http/api_versions.rb b/lib/chef/http/api_versions.rb
index 674d8f85a7..6c5ede40aa 100644
--- a/lib/chef/http/api_versions.rb
+++ b/lib/chef/http/api_versions.rb
@@ -37,6 +37,8 @@ class Chef
end
if http_response.key?("x-ops-server-api-version")
ServerAPIVersions.instance.set_versions(JSONCompat.parse(http_response["x-ops-server-api-version"]))
+ else
+ ServerAPIVersions.instance.unversioned!
end
[http_response, rest_request, return_value]
end
diff --git a/lib/chef/http/http_request.rb b/lib/chef/http/http_request.rb
index 20c46aaa8d..7fc1acb889 100644
--- a/lib/chef/http/http_request.rb
+++ b/lib/chef/http/http_request.rb
@@ -49,6 +49,7 @@ class Chef
ENCODING_GZIP_DEFLATE = "gzip;q=1.0,deflate;q=0.6,identity;q=0.3".freeze
GET = "get".freeze
+ PATCH = "patch".freeze
PUT = "put".freeze
POST = "post".freeze
DELETE = "delete".freeze
@@ -161,6 +162,8 @@ class Chef
Net::HTTP::Post.new(req_path, headers)
when PUT
Net::HTTP::Put.new(req_path, headers)
+ when PATCH
+ Net::HTTP::Patch.new(req_path, headers)
when DELETE
Net::HTTP::Delete.new(req_path, headers)
when HEAD
diff --git a/lib/chef/knife/core/bootstrap_context.rb b/lib/chef/knife/core/bootstrap_context.rb
index c395ebcfa0..9b16b94910 100644
--- a/lib/chef/knife/core/bootstrap_context.rb
+++ b/lib/chef/knife/core/bootstrap_context.rb
@@ -223,6 +223,7 @@ validation_client_name "#{@chef_config[:validation_client_name]}"
attributes[:run_list] = @run_list
end
+ attributes.delete(:run_list) if attributes[:policy_name] && !attributes[:policy_name].empty?
attributes.merge!(:tags => @config[:tags]) if @config[:tags] && !@config[:tags].empty?
end
end
diff --git a/lib/chef/knife/core/status_presenter.rb b/lib/chef/knife/core/status_presenter.rb
index df6c2fe942..f55f9abcbb 100644
--- a/lib/chef/knife/core/status_presenter.rb
+++ b/lib/chef/knife/core/status_presenter.rb
@@ -123,7 +123,7 @@ class Chef
line_parts << run_list if run_list
if node["platform"]
- platform = node["platform"]
+ platform = node["platform"].dup
if node["platform_version"]
platform << " #{node['platform_version']}"
end
diff --git a/lib/chef/knife/core/ui.rb b/lib/chef/knife/core/ui.rb
index d809a8fc45..484c3ab3de 100644
--- a/lib/chef/knife/core/ui.rb
+++ b/lib/chef/knife/core/ui.rb
@@ -172,7 +172,7 @@ class Chef
tf.sync = true
tf.puts output
tf.close
- raise "Please set EDITOR environment variable" unless system("#{config[:editor]} #{tf.path}")
+ raise "Please set EDITOR environment variable. See https://docs.chef.io/knife_using.html for details." unless system("#{config[:editor]} #{tf.path}")
output = IO.read(tf.path)
end
diff --git a/lib/chef/knife/search.rb b/lib/chef/knife/search.rb
index c4c3380734..2a68ec5108 100644
--- a/lib/chef/knife/search.rb
+++ b/lib/chef/knife/search.rb
@@ -91,6 +91,8 @@ class Chef
search_args[:filter_result] = create_result_filter(config[:filter_result])
elsif (not ui.config[:attribute].nil?) && (not ui.config[:attribute].empty?)
search_args[:filter_result] = create_result_filter_from_attributes(ui.config[:attribute])
+ elsif config[:id_only]
+ search_args[:filter_result] = create_result_filter_from_attributes([])
end
begin
diff --git a/lib/chef/knife/ssh.rb b/lib/chef/knife/ssh.rb
index 380a60fdd6..ae14ce9954 100644
--- a/lib/chef/knife/ssh.rb
+++ b/lib/chef/knife/ssh.rb
@@ -273,6 +273,10 @@ class Chef
opts[:paranoid] = false
opts[:user_known_hosts_file] = "/dev/null"
end
+ if ssh_config[:keepalive]
+ opts[:keepalive] = true
+ opts[:keepalive_interval] = ssh_config[:keepalive_interval]
+ end
end
end
diff --git a/lib/chef/mash.rb b/lib/chef/mash.rb
index 4e4f06634d..8b9e115dd1 100644
--- a/lib/chef/mash.rb
+++ b/lib/chef/mash.rb
@@ -105,6 +105,12 @@ class Mash < Hash
regular_writer(convert_key(key), convert_value(value))
end
+ # internal API for use by Chef's deep merge cache
+ # @api private
+ def internal_set(key, value)
+ regular_writer(key, convert_value(value))
+ end
+
# @param other_hash<Hash>
# A hash to update values in the mash with. The keys and the values will be
# converted to Mash format.
diff --git a/lib/chef/mixin/deep_merge.rb b/lib/chef/mixin/deep_merge.rb
index 7016b08ff7..9ec2b397d4 100644
--- a/lib/chef/mixin/deep_merge.rb
+++ b/lib/chef/mixin/deep_merge.rb
@@ -64,7 +64,7 @@ class Chef
when Hash
if dest.kind_of?(Hash)
source.each do |src_key, src_value|
- if dest[src_key]
+ if dest.key?(src_key)
dest[src_key] = deep_merge!(src_value, dest[src_key])
else # dest[src_key] doesn't exist so we take whatever source has
dest[src_key] = src_value
diff --git a/lib/chef/mixin/user_context.rb b/lib/chef/mixin/user_context.rb
new file mode 100644
index 0000000000..40a72912a3
--- /dev/null
+++ b/lib/chef/mixin/user_context.rb
@@ -0,0 +1,52 @@
+#
+# Author:: Adam Edwards (<adamed@chef.io>)
+# Copyright:: Copyright (c) 2016 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 "chef/util/windows/logon_session" if Chef::Platform.windows?
+
+class Chef
+ module Mixin
+ module UserContext
+
+ def with_user_context(user, password, domain = nil, &block)
+ if node["platform_family"] != "windows"
+ raise Exceptions::UnsupportedPlatform, "User context impersonation is supported only on the Windows platform"
+ end
+
+ if ! block_given?
+ raise ArgumentError, "You must supply a block to `with_user_context`"
+ end
+
+ login_session = nil
+
+ begin
+ if user
+ logon_session = Chef::Util::Windows::LogonSession.new(user, password, domain)
+ logon_session.open
+ logon_session.set_user_context
+ end
+ yield
+ ensure
+ logon_session.close if logon_session
+ end
+ end
+
+ protected(:with_user_context)
+
+ end
+ end
+end
diff --git a/lib/chef/node/attribute.rb b/lib/chef/node/attribute.rb
index 57d1b0a4d3..2998866bb2 100644
--- a/lib/chef/node/attribute.rb
+++ b/lib/chef/node/attribute.rb
@@ -399,7 +399,7 @@ class Chef
#
def merged_attributes(*path)
- immutablize(merge_all(path))
+ merge_all(path)
end
def combined_override(*path)
@@ -536,15 +536,10 @@ class Chef
apply_path(@automatic, path),
]
- components.map! do |component|
- safe_dup(component)
- end
-
- return nil if components.compact.empty?
-
- components.inject(ImmutableMash.new({}, self, __node__, :merged)) do |merged, component|
- Chef::Mixin::DeepMerge.hash_only_merge!(merged, component)
+ ret = components.inject(NIL) do |merged, component|
+ hash_only_merge!(merged, component)
end
+ ret == NIL ? nil : ret
end
# Deep merge the default attribute levels with array merging.
@@ -554,10 +549,11 @@ class Chef
# @param path [Array] Array of args to method chain to descend into the node object
# @return [attr] Deep Merged values (may be VividMash, Hash, Array, etc) from the node object
def merge_defaults(path)
- DEFAULT_COMPONENTS.inject(nil) do |merged, component_ivar|
+ ret = DEFAULT_COMPONENTS.inject(NIL) do |merged, component_ivar|
component_value = apply_path(instance_variable_get(component_ivar), path)
- Chef::Mixin::DeepMerge.deep_merge(component_value, merged)
+ deep_merge!(merged, component_value)
end
+ ret == NIL ? nil : ret
end
# Deep merge the override attribute levels with array merging.
@@ -567,10 +563,11 @@ class Chef
# @param path [Array] Array of args to method chain to descend into the node object
# @return [attr] Deep Merged values (may be VividMash, Hash, Array, etc) from the node object
def merge_overrides(path)
- OVERRIDE_COMPONENTS.inject(nil) do |merged, component_ivar|
+ ret = OVERRIDE_COMPONENTS.inject(NIL) do |merged, component_ivar|
component_value = apply_path(instance_variable_get(component_ivar), path)
- Chef::Mixin::DeepMerge.deep_merge(component_value, merged)
+ deep_merge!(merged, component_value)
end
+ ret == NIL ? nil : ret
end
# needed for __path__
@@ -578,7 +575,76 @@ class Chef
key.kind_of?(Symbol) ? key.to_s : key
end
- end
+ NIL = Object.new
+
+ # @api private
+ def deep_merge!(merge_onto, merge_with)
+ # If there are two Hashes, recursively merge.
+ if merge_onto.kind_of?(Hash) && merge_with.kind_of?(Hash)
+ merge_with.each do |key, merge_with_value|
+ value =
+ if merge_onto.has_key?(key)
+ deep_merge!(safe_dup(merge_onto[key]), merge_with_value)
+ else
+ merge_with_value
+ end
+
+ # internal_set bypasses converting keys, does convert values and allows writing to immutable mashes
+ merge_onto.internal_set(key, value)
+ end
+ merge_onto
+
+ elsif merge_onto.kind_of?(Array) && merge_with.kind_of?(Array)
+ merge_onto |= merge_with
+
+ # If merge_with is nil, don't replace merge_onto
+ elsif merge_with.nil?
+ merge_onto
+
+ # In all other cases, replace merge_onto with merge_with
+ else
+ if merge_with.kind_of?(Hash)
+ Chef::Node::VividMash.new(merge_with)
+ elsif merge_with.kind_of?(Array)
+ Chef::Node::AttrArray.new(merge_with)
+ else
+ merge_with
+ end
+ end
+ end
+ # @api private
+ def hash_only_merge!(merge_onto, merge_with)
+ # If there are two Hashes, recursively merge.
+ if merge_onto.kind_of?(Hash) && merge_with.kind_of?(Hash)
+ merge_with.each do |key, merge_with_value|
+ value =
+ if merge_onto.has_key?(key)
+ hash_only_merge!(safe_dup(merge_onto[key]), merge_with_value)
+ else
+ merge_with_value
+ end
+
+ # internal_set bypasses converting keys, does convert values and allows writing to immutable mashes
+ merge_onto.internal_set(key, value)
+ end
+ merge_onto
+
+ # If merge_with is nil, don't replace merge_onto
+ elsif merge_with.nil?
+ merge_onto
+
+ # In all other cases, replace merge_onto with merge_with
+ else
+ if merge_with.kind_of?(Hash)
+ Chef::Node::ImmutableMash.new(merge_with)
+ elsif merge_with.kind_of?(Array)
+ Chef::Node::ImmutableArray.new(merge_with)
+ else
+ merge_with
+ end
+ end
+ end
+ end
end
end
diff --git a/lib/chef/node/immutable_collections.rb b/lib/chef/node/immutable_collections.rb
index be9285a755..848e12d2df 100644
--- a/lib/chef/node/immutable_collections.rb
+++ b/lib/chef/node/immutable_collections.rb
@@ -30,16 +30,22 @@ class Chef
e
end
- def immutablize(value)
+ def convert_value(value)
case value
when Hash
ImmutableMash.new(value, __root__, __node__, __precedence__)
when Array
ImmutableArray.new(value, __root__, __node__, __precedence__)
+ when ImmutableMash, ImmutableArray
+ value
else
safe_dup(value).freeze
end
end
+
+ def immutablize(value)
+ convert_value(value)
+ end
end
# == ImmutableArray
@@ -90,7 +96,9 @@ class Chef
alias_method :to_array, :to_a
- # for consistency's sake -- integers 'converted' to integers
+ private
+
+ # needed for __path__
def convert_key(key)
key
end
@@ -115,31 +123,20 @@ class Chef
include Immutablize
include CommonAPI
- alias :internal_set :[]=
- private :internal_set
+ # this is for deep_merge usage, chef users must never touch this API
+ # @api private
+ def internal_set(key, value)
+ regular_writer(key, convert_value(value))
+ end
def initialize(mash_data = {})
mash_data.each do |key, value|
- internal_set(key, immutablize(value))
+ internal_set(key, value)
end
end
- def public_method_that_only_deep_merge_should_use(key, value)
- internal_set(key, immutablize(value))
- end
-
alias :attribute? :has_key?
- # Mash uses #convert_value to mashify values on input.
- # Since we're handling this ourselves, override it to be a no-op
- #
- # FIXME? this seems wrong to do and i think is responsible for
- # #dup needing to be more complicated than Mash.new(self)?
- #
- def convert_value(value)
- value
- end
-
# NOTE: #default and #default= are likely to be pretty confusing. For a
# regular ruby Hash, they control what value is returned for, e.g.,
# hash[:no_such_key] #=> hash.default
diff --git a/lib/chef/provider/apt_preference.rb b/lib/chef/provider/apt_preference.rb
new file mode 100644
index 0000000000..ff4ea02ff0
--- /dev/null
+++ b/lib/chef/provider/apt_preference.rb
@@ -0,0 +1,94 @@
+#
+# Author:: Tim Smith (<tsmith@chef.io>)
+# Copyright:: 2016-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 "chef/provider"
+require "chef/dsl/declare_resource"
+require "chef/provider/noop"
+require "chef/log"
+
+class Chef
+ class Provider
+ class AptPreference < Chef::Provider
+ provides :apt_preference, os: "linux", platform_family: "debian"
+
+ APT_PREFERENCE_DIR = "/etc/apt/preferences.d".freeze
+
+ def load_current_resource
+ end
+
+ action :add do
+ preference = build_pref(
+ new_resource.glob || new_resource.package_name,
+ new_resource.pin,
+ new_resource.pin_priority
+ )
+
+ declare_resource(:directory, APT_PREFERENCE_DIR) do
+ mode "0755"
+ action :create
+ end
+
+ sanitized_prefname = safe_name(new_resource.package_name)
+
+ # cleanup any existing pref files w/o the sanitized name (created by old apt cookbook)
+ if (sanitized_prefname != new_resource.package_name) && ::File.exist?("#{APT_PREFERENCE_DIR}/#{new_resource.package_name}.pref")
+ Chef::Log.warn "Replacing legacy #{new_resource.package_name}.pref with #{sanitized_prefname}.pref in #{APT_PREFERENCE_DIR}"
+ declare_resource(:file, "#{APT_PREFERENCE_DIR}/#{new_resource.package_name}.pref") do
+ action :delete
+ end
+ end
+
+ # cleanup any existing pref files without the .pref extension (created by old apt cookbook)
+ if ::File.exist?("#{APT_PREFERENCE_DIR}/#{new_resource.package_name}")
+ Chef::Log.warn "Replacing legacy #{new_resource.package_name} with #{sanitized_prefname}.pref in #{APT_PREFERENCE_DIR}"
+ declare_resource(:file, "#{APT_PREFERENCE_DIR}/#{new_resource.package_name}") do
+ action :delete
+ end
+ end
+
+ declare_resource(:file, "#{APT_PREFERENCE_DIR}/#{sanitized_prefname}.pref") do
+ mode "0644"
+ content preference
+ action :create
+ end
+ end
+
+ action :remove do
+ sanitized_prefname = safe_name(new_resource.package_name)
+
+ if ::File.exist?("#{APT_PREFERENCE_DIR}/#{sanitized_prefname}.pref")
+ Chef::Log.info "Un-pinning #{sanitized_prefname} from #{APT_PREFERENCE_DIR}"
+ declare_resource(:file, "#{APT_PREFERENCE_DIR}/#{sanitized_prefname}.pref") do
+ action :delete
+ end
+ end
+ end
+
+ # Build preferences.d file contents
+ def build_pref(package_name, pin, pin_priority)
+ "Package: #{package_name}\nPin: #{pin}\nPin-Priority: #{pin_priority}\n"
+ end
+
+ def safe_name(name)
+ name.tr(".", "_").gsub("*", "wildcard")
+ end
+ end
+ end
+end
+
+Chef::Provider::Noop.provides :apt_preference
diff --git a/lib/chef/provider/apt_repository.rb b/lib/chef/provider/apt_repository.rb
index 05172c9f98..2d86a6fce4 100644
--- a/lib/chef/provider/apt_repository.rb
+++ b/lib/chef/provider/apt_repository.rb
@@ -19,7 +19,6 @@
require "chef/resource"
require "chef/dsl/declare_resource"
require "chef/mixin/shell_out"
-require "chef/mixin/which"
require "chef/http/simple"
require "chef/provider/noop"
@@ -27,11 +26,8 @@ class Chef
class Provider
class AptRepository < Chef::Provider
include Chef::Mixin::ShellOut
- extend Chef::Mixin::Which
- provides :apt_repository do
- which("apt-get")
- end
+ provides :apt_repository, os: "linux", platform_family: "debian"
LIST_APT_KEYS = "apt-key list".freeze
LIST_APT_KEY_FINGERPRINTS = "apt-key adv --list-public-keys --with-fingerprint --with-colons".freeze
@@ -41,10 +37,12 @@ class Chef
action :add do
unless new_resource.key.nil?
- if is_key_id?(new_resource.key) && !has_cookbook_file?(new_resource.key)
- install_key_from_keyserver
- else
- install_key_from_uri
+ new_resource.key.each do |k|
+ if is_key_id?(k) && !has_cookbook_file?(k)
+ install_key_from_keyserver(k)
+ else
+ install_key_from_uri(k)
+ end
end
end
@@ -151,19 +149,19 @@ class Chef
(installed_keys & proposed_keys).sort == proposed_keys.sort
end
- def install_key_from_uri
- key_name = new_resource.key.gsub(/[^0-9A-Za-z\-]/, "_")
+ def install_key_from_uri(key)
+ key_name = key.gsub(/[^0-9A-Za-z\-]/, "_")
cached_keyfile = ::File.join(Chef::Config[:file_cache_path], key_name)
- type = if new_resource.key.start_with?("http")
+ type = if key.start_with?("http")
:remote_file
- elsif has_cookbook_file?(new_resource.key)
+ elsif has_cookbook_file?(key)
:cookbook_file
else
raise Chef::Exceptions::FileNotFound, "Cannot locate key file"
end
declare_resource(type, cached_keyfile) do
- source new_resource.key
+ source key
mode "0644"
sensitive new_resource.sensitive
action :create
@@ -181,7 +179,7 @@ class Chef
end
end
- def install_key_from_keyserver(key = new_resource.key, keyserver = new_resource.keyserver)
+ def install_key_from_keyserver(key, keyserver = new_resource.keyserver)
cmd = "apt-key adv --recv"
cmd << " --keyserver-options http-proxy=#{new_resource.key_proxy}" if new_resource.key_proxy
cmd << " --keyserver "
diff --git a/lib/chef/provider/apt_update.rb b/lib/chef/provider/apt_update.rb
index 670f3ad7f6..bfd9603e4e 100644
--- a/lib/chef/provider/apt_update.rb
+++ b/lib/chef/provider/apt_update.rb
@@ -18,16 +18,12 @@
require "chef/provider"
require "chef/provider/noop"
-require "chef/mixin/which"
+require "chef/dsl/declare_resource"
class Chef
class Provider
class AptUpdate < Chef::Provider
- extend Chef::Mixin::Which
-
- provides :apt_update do
- which("apt-get")
- end
+ provides :apt_update, os: "linux", platform_family: "debian"
APT_CONF_DIR = "/etc/apt/apt.conf.d"
STAMP_DIR = "/var/lib/apt/periodic"
diff --git a/lib/chef/provider/execute.rb b/lib/chef/provider/execute.rb
index d19a95b4ae..d5a0bdfa11 100644
--- a/lib/chef/provider/execute.rb
+++ b/lib/chef/provider/execute.rb
@@ -27,7 +27,7 @@ class Chef
provides :execute
- def_delegators :new_resource, :command, :returns, :environment, :user, :domain, :password, :group, :cwd, :umask, :creates
+ def_delegators :new_resource, :command, :returns, :environment, :user, :domain, :password, :group, :cwd, :umask, :creates, :elevated
def load_current_resource
current_resource = Chef::Resource::Execute.new(new_resource.name)
@@ -102,6 +102,7 @@ class Chef
opts[:live_stream] = STDOUT
end
end
+ opts[:elevated] = elevated if elevated
opts
end
diff --git a/lib/chef/provider/git.rb b/lib/chef/provider/git.rb
index db83e0aea6..bdbeca5941 100644
--- a/lib/chef/provider/git.rb
+++ b/lib/chef/provider/git.rb
@@ -28,6 +28,8 @@ class Chef
extend Forwardable
provides :git
+ GIT_VERSION_PATTERN = Regexp.compile('git version (\d+\.\d+.\d+)')
+
def_delegator :new_resource, :destination, :cwd
def load_current_resource
@@ -103,8 +105,21 @@ class Chef
end
end
- def git_minor_version
- @git_minor_version ||= Gem::Version.new( git("--version").stdout.split.last )
+ def git_has_single_branch_option?
+ @git_has_single_branch_option ||= !git_gem_version.nil? && git_gem_version >= Gem::Version.new("1.7.10")
+ end
+
+ def git_gem_version
+ return @git_gem_version if defined?(@git_gem_version)
+ output = git("--version").stdout
+ match = GIT_VERSION_PATTERN.match(output)
+ if match
+ @git_gem_version = Gem::Version.new(match[1])
+ else
+ Chef::Log.warn "Unable to parse git version from '#{output}'"
+ @git_gem_version = nil
+ end
+ @git_gem_version
end
def existing_git_clone?
@@ -142,7 +157,7 @@ class Chef
clone_cmd = ["clone"]
clone_cmd << "-o #{remote}" unless remote == "origin"
clone_cmd << "--depth #{new_resource.depth}" if new_resource.depth
- clone_cmd << "--no-single-branch" if new_resource.depth && git_minor_version >= Gem::Version.new("1.7.10")
+ clone_cmd << "--no-single-branch" if new_resource.depth && git_has_single_branch_option?
clone_cmd << "\"#{new_resource.repository}\""
clone_cmd << "\"#{cwd}\""
@@ -285,6 +300,8 @@ class Chef
refs.find_all { |m| m[1] == pattern }
end
+ alias git_minor_version git_gem_version
+
private
def run_options(run_opts = {})
diff --git a/lib/chef/provider/http_request.rb b/lib/chef/provider/http_request.rb
index 8370c2375c..cafdc1e007 100644
--- a/lib/chef/provider/http_request.rb
+++ b/lib/chef/provider/http_request.rb
@@ -62,6 +62,20 @@ class Chef
end
end
+ # Send a PATCH request to new_resource.url, with the message as the payload
+ def action_patch
+ converge_by("#{new_resource} PATCH to #{new_resource.url}") do
+ message = check_message(new_resource.message)
+ body = @http.patch(
+ "#{new_resource.url}",
+ message,
+ new_resource.headers
+ )
+ Chef::Log.info("#{new_resource} PATCH to #{new_resource.url} successful")
+ Chef::Log.debug("#{new_resource} PATCH request response: #{body}")
+ end
+ end
+
# Send a PUT request to new_resource.url, with the message as the payload
def action_put
converge_by("#{new_resource} PUT to #{new_resource.url}") do
diff --git a/lib/chef/provider/ifconfig/redhat.rb b/lib/chef/provider/ifconfig/redhat.rb
index 8af9f10f67..bf3d979e86 100644
--- a/lib/chef/provider/ifconfig/redhat.rb
+++ b/lib/chef/provider/ifconfig/redhat.rb
@@ -38,6 +38,10 @@ class Chef
<% if new_resource.hwaddr %>HWADDR=<%= new_resource.hwaddr %><% end %>
<% if new_resource.metric %>METRIC=<%= new_resource.metric %><% end %>
<% if new_resource.mtu %>MTU=<%= new_resource.mtu %><% end %>
+<% if new_resource.ethtool_opts %>ETHTOOL_OPTS="<%= new_resource.ethtool_opts %>"<% end %>
+<% if new_resource.bonding_opts %>BONDING_OPTS="<%= new_resource.bonding_opts %>"<% end %>
+<% if new_resource.master %>MASTER=<%= new_resource.master %><% end %>
+<% if new_resource.slave %>SLAVE=<%= new_resource.slave %><% end %>
}
@config_path = "/etc/sysconfig/network-scripts/ifcfg-#{new_resource.device}"
end
diff --git a/lib/chef/provider/launchd.rb b/lib/chef/provider/launchd.rb
index 9c368c2b48..8281410d42 100644
--- a/lib/chef/provider/launchd.rb
+++ b/lib/chef/provider/launchd.rb
@@ -90,6 +90,7 @@ class Chef
end
def manage_plist(action)
+ return unless manage_agent?(action)
if source
res = cookbook_file_resource
else
@@ -101,11 +102,30 @@ class Chef
end
def manage_service(action)
+ return unless manage_agent?(action)
res = service_resource
res.run_action(action)
new_resource.updated_by_last_action(true) if res.updated?
end
+ def manage_agent?(action)
+ # Gets UID of console_user and converts to string.
+ console_user = Etc.getpwuid(::File.stat("/dev/console").uid).name
+ root = console_user == "root"
+ agent = type == "agent"
+ invalid_action = [:delete, :disable, :enable, :restart].include?(action)
+ lltstype = ""
+ if new_resource.limit_load_to_session_type
+ lltstype = new_resource.limit_load_to_session_type
+ end
+ invalid_type = lltstype != "LoginWindow"
+ if root && agent && invalid_action && invalid_type
+ Chef::Log.debug("#{label}: Aqua LaunchAgents shouldn't be loaded as root")
+ return false
+ end
+ true
+ end
+
def service_resource
res = Chef::Resource::MacosxService.new(label, run_context)
res.name(label) if label
diff --git a/lib/chef/provider/package.rb b/lib/chef/provider/package.rb
index 4b73f47ed3..4810728524 100644
--- a/lib/chef/provider/package.rb
+++ b/lib/chef/provider/package.rb
@@ -311,18 +311,19 @@ class Chef
#
# This MUST have 'equality' semantics -- the exact thing matches the exact thing.
#
- # The current_version should probably be dropped out of the method signature, it should
- # always be the first argument.
- #
# The name is not just bad, but i find it completely misleading, consider:
#
# target_version_already_installed?(current_version, new_version)
# target_version_already_installed?(current_version, candidate_version)
#
- # which of those is the 'target_version'? i'd say the new_version and i'm confused when
+ # Which of those is the 'target_version'? I'd say the new_version and I'm confused when
# i see it called with the candidate_version.
#
- # `current_version_equals?(version)` would be a better name
+ # `version_equals?(v1, v2)` would be a better name.
+ #
+ # Note that most likely we need a spaceship operator on versions that subclasses can implement
+ # and we should have `version_compare(v1, v2)` that returns `v1 <=> v2`.
+ #
def target_version_already_installed?(current_version, target_version)
return false unless current_version && target_version
current_version == target_version
@@ -333,10 +334,8 @@ class Chef
#
# Subclasses MAY override this to provide fuzzy matching on the resource ('>=' and '~>' stuff)
#
- # This should only ever be offered the same arguments (so they should most likely be
- # removed from the method signature).
+ # `version_satisfied_by?(version, constraint)` might be a better name to make this generic.
#
- # `new_version_satisfied?()` might be a better name
def version_requirement_satisfied?(current_version, new_version)
target_version_already_installed?(current_version, new_version)
end
diff --git a/lib/chef/provider/package/dnf.rb b/lib/chef/provider/package/dnf.rb
index 42d679c940..31279e8312 100644
--- a/lib/chef/provider/package/dnf.rb
+++ b/lib/chef/provider/package/dnf.rb
@@ -35,10 +35,12 @@ class Chef
use_multipackage_api
use_package_name_for_source
- provides :package, platform_family: %w{rhel fedora amazon} do
+ provides :package, platform_family: %w{fedora amazon} do
which("dnf") && shell_out("rpm -q dnf").stdout =~ /^dnf-[1-9]/
end
+ provides :package, platform_family: %w{rhel}, platform_version: ">= 8"
+
provides :dnf_package, os: "linux"
#
diff --git a/lib/chef/provider/package/dnf/dnf_helper.py b/lib/chef/provider/package/dnf/dnf_helper.py
index ef08bb54c2..eb4d238f65 100644
--- a/lib/chef/provider/package/dnf/dnf_helper.py
+++ b/lib/chef/provider/package/dnf/dnf_helper.py
@@ -72,7 +72,6 @@ def exit_handler(signal, frame):
signal.signal(signal.SIGINT, exit_handler)
signal.signal(signal.SIGHUP, exit_handler)
signal.signal(signal.SIGPIPE, exit_handler)
-signal.signal(signal.SIGCHLD, exit_handler)
while 1:
# kill self if we get orphaned (tragic)
diff --git a/lib/chef/provider/package/windows/registry_uninstall_entry.rb b/lib/chef/provider/package/windows/registry_uninstall_entry.rb
index 03f6ff318e..64889e1649 100644
--- a/lib/chef/provider/package/windows/registry_uninstall_entry.rb
+++ b/lib/chef/provider/package/windows/registry_uninstall_entry.rb
@@ -40,7 +40,7 @@ class Chef
begin
entry = reg.open(key, desired)
display_name = read_registry_property(entry, "DisplayName")
- if display_name == package_name
+ if display_name.to_s.rstrip == package_name
quiet_uninstall_string = RegistryUninstallEntry.read_registry_property(entry, "QuietUninstallString")
entries.push(quiet_uninstall_string_key?(quiet_uninstall_string, hkey, key, entry))
end
diff --git a/lib/chef/provider/package/zypper.rb b/lib/chef/provider/package/zypper.rb
index 7b8fd6c426..41e8433046 100644
--- a/lib/chef/provider/package/zypper.rb
+++ b/lib/chef/provider/package/zypper.rb
@@ -103,7 +103,7 @@ class Chef
end
def install_package(name, version)
- zypper_package("install", "--auto-agree-with-licenses", name, version)
+ zypper_package("install", *options, "--auto-agree-with-licenses", name, version)
end
def upgrade_package(name, version)
@@ -112,19 +112,19 @@ class Chef
end
def remove_package(name, version)
- zypper_package("remove", name, version)
+ zypper_package("remove", *options, name, version)
end
def purge_package(name, version)
- zypper_package("remove", "--clean-deps", name, version)
+ zypper_package("remove", *options, "--clean-deps", name, version)
end
def lock_package(name, version)
- zypper_package("addlock", name, version)
+ zypper_package("addlock", *options, name, version)
end
def unlock_package(name, version)
- zypper_package("removelock", name, version)
+ zypper_package("removelock", *options, name, version)
end
private
diff --git a/lib/chef/provider/remote_file.rb b/lib/chef/provider/remote_file.rb
index c0a0f9433c..d2de3d0b5f 100644
--- a/lib/chef/provider/remote_file.rb
+++ b/lib/chef/provider/remote_file.rb
@@ -29,6 +29,25 @@ class Chef
super
end
+ def define_resource_requirements
+ [ new_resource.remote_user, new_resource.remote_domain,
+ new_resource.remote_password ].each do |prop|
+ requirements.assert(:all_actions) do |a|
+ a.assertion do
+ if prop
+ node[:platform_family] == "windows"
+ else
+ true
+ end
+ end
+ a.failure_message Chef::Exceptions::UnsupportedPlatform, "'remote_user', 'remote_domain' and 'remote_password' properties are supported only for Windows platform"
+ a.whyrun("Assuming that the platform is Windows while passing 'remote_user', 'remote_domain' and 'remote_password' properties")
+ end
+ end
+
+ super
+ end
+
def load_current_resource
@current_resource = Chef::Resource::RemoteFile.new(new_resource.name)
super
diff --git a/lib/chef/provider/remote_file/fetcher.rb b/lib/chef/provider/remote_file/fetcher.rb
index 563d135d6a..3011dd80a0 100644
--- a/lib/chef/provider/remote_file/fetcher.rb
+++ b/lib/chef/provider/remote_file/fetcher.rb
@@ -24,6 +24,9 @@ class Chef
def self.for_resource(uri, new_resource, current_resource)
if network_share?(uri)
+ if !Chef::Platform.windows?
+ raise Exceptions::UnsupportedPlatform, "Fetching the file on a network share is supported only on the Windows platform. Please change your source: #{uri}"
+ end
Chef::Provider::RemoteFile::NetworkFile.new(uri, new_resource, current_resource)
else
case uri.scheme
diff --git a/lib/chef/provider/remote_file/network_file.rb b/lib/chef/provider/remote_file/network_file.rb
index 44046132a9..a08bfd2453 100644
--- a/lib/chef/provider/remote_file/network_file.rb
+++ b/lib/chef/provider/remote_file/network_file.rb
@@ -19,14 +19,18 @@
require "uri"
require "tempfile"
require "chef/provider/remote_file"
+require "chef/mixin/user_context"
class Chef
class Provider
class RemoteFile
class NetworkFile
+ include Chef::Mixin::UserContext
attr_reader :new_resource
+ TRANSFER_CHUNK_SIZE = 1048576
+
def initialize(source, new_resource, current_resource)
@new_resource = new_resource
@source = source
@@ -35,13 +39,22 @@ class Chef
# Fetches the file on a network share, returning a Tempfile-like File handle
# windows only
def fetch
- tempfile = Chef::FileContentManagement::Tempfile.new(new_resource).tempfile
- Chef::Log.debug("#{new_resource} staging #{@source} to #{tempfile.path}")
- FileUtils.cp(@source, tempfile.path)
- tempfile.close if tempfile
+ begin
+ tempfile = Chef::FileContentManagement::Tempfile.new(new_resource).tempfile
+ Chef::Log.debug("#{new_resource} staging #{@source} to #{tempfile.path}")
+
+ with_user_context(new_resource.remote_user, new_resource.remote_password, new_resource.remote_domain) do
+ ::File.open(@source, "rb") do |remote_file|
+ while data = remote_file.read(TRANSFER_CHUNK_SIZE)
+ tempfile.write(data)
+ end
+ end
+ end
+ ensure
+ tempfile.close if tempfile
+ end
tempfile
end
-
end
end
end
diff --git a/lib/chef/provider/route.rb b/lib/chef/provider/route.rb
index 59d516be6a..2439f45eda 100644
--- a/lib/chef/provider/route.rb
+++ b/lib/chef/provider/route.rb
@@ -86,7 +86,9 @@ class Chef
self.is_running = false
# cidr or quad dot mask
- new_ip = if new_resource.netmask
+ new_ip = if new_resource.target == "default"
+ IPAddr.new(new_resource.gateway)
+ elsif new_resource.netmask
IPAddr.new("#{new_resource.target}/#{new_resource.netmask}")
else
IPAddr.new(new_resource.target)
@@ -180,12 +182,29 @@ class Chef
end
end
conf.each do |k, v|
- network_file_name = "/etc/sysconfig/network-scripts/route-#{k}"
- converge_by("write route route.#{k}\n#{conf[k]} to #{network_file_name}") do
- network_file = ::File.new(network_file_name, "w")
- network_file.puts(conf[k])
- Chef::Log.debug("#{new_resource} writing route.#{k}\n#{conf[k]}")
- network_file.close
+ if new_resource.target == "default"
+ network_file_name = "/etc/sysconfig/network"
+ converge_by("write route default route to #{network_file_name}") do
+ Chef::Log.debug("#{new_resource} writing default route #{new_resource.gateway} to #{network_file_name}")
+ if ::File.exists?(network_file_name)
+ network_file = ::Chef::Util::FileEdit.new(network_file_name)
+ network_file.search_file_replace_line /^GATEWAY=/, "GATEWAY=#{new_resource.gateway}"
+ network_file.insert_line_if_no_match /^GATEWAY=/, "GATEWAY=#{new_resource.gateway}"
+ network_file.write_file
+ else
+ network_file = ::File.new(network_file_name, "w")
+ network_file.puts("GATEWAY=#{new_resource.gateway}")
+ network_file.close
+ end
+ end
+ else
+ network_file_name = "/etc/sysconfig/network-scripts/route-#{k}"
+ converge_by("write route route.#{k}\n#{conf[k]} to #{network_file_name}") do
+ network_file = ::File.new(network_file_name, "w")
+ network_file.puts(conf[k])
+ Chef::Log.debug("#{new_resource} writing route.#{k}\n#{conf[k]}")
+ network_file.close
+ end
end
end
end
diff --git a/lib/chef/provider/service/macosx.rb b/lib/chef/provider/service/macosx.rb
index 4056b72649..9dc7b81a29 100644
--- a/lib/chef/provider/service/macosx.rb
+++ b/lib/chef/provider/service/macosx.rb
@@ -52,17 +52,18 @@ class Chef
@plist_size = 0
@plist = @new_resource.plist ? @new_resource.plist : find_service_plist
@service_label = find_service_label
- # LauchAgents should be loaded as the console user.
+ # LaunchAgents should be loaded as the console user.
@console_user = @plist ? @plist.include?("LaunchAgents") : false
@session_type = @new_resource.session_type
if @console_user
- @console_user = Etc.getlogin
+ @console_user = Etc.getpwuid(::File.stat("/dev/console").uid).name
Chef::Log.debug("#{new_resource} console_user: '#{@console_user}'")
cmd = "su "
param = this_version_or_newer?("10.10") ? "" : "-l "
+ param = "-l " if this_version_or_newer?("10.12")
@base_user_cmd = cmd + param + "#{@console_user} -c"
- # Default LauchAgent session should be Aqua
+ # Default LaunchAgent session should be Aqua
@session_type = "Aqua" if @session_type.nil?
end
diff --git a/lib/chef/provider/service/systemd.rb b/lib/chef/provider/service/systemd.rb
index deec25b187..2da35b3b9e 100644
--- a/lib/chef/provider/service/systemd.rb
+++ b/lib/chef/provider/service/systemd.rb
@@ -20,6 +20,7 @@
require "chef/resource/service"
require "chef/provider/service/simple"
require "chef/mixin/which"
+require "shellwords"
class Chef::Provider::Service::Systemd < Chef::Provider::Service::Simple
@@ -100,7 +101,7 @@ class Chef::Provider::Service::Systemd < Chef::Provider::Service::Simple
super
else
options, args = get_systemctl_options_args
- shell_out_with_systems_locale!("#{systemctl_path} #{args} start #{new_resource.service_name}", options)
+ shell_out_with_systems_locale!("#{systemctl_path} #{args} start #{Shellwords.escape(new_resource.service_name)}", options)
end
end
end
@@ -113,7 +114,7 @@ class Chef::Provider::Service::Systemd < Chef::Provider::Service::Simple
super
else
options, args = get_systemctl_options_args
- shell_out_with_systems_locale!("#{systemctl_path} #{args} stop #{new_resource.service_name}", options)
+ shell_out_with_systems_locale!("#{systemctl_path} #{args} stop #{Shellwords.escape(new_resource.service_name)}", options)
end
end
end
@@ -123,7 +124,7 @@ class Chef::Provider::Service::Systemd < Chef::Provider::Service::Simple
super
else
options, args = get_systemctl_options_args
- shell_out_with_systems_locale!("#{systemctl_path} #{args} restart #{new_resource.service_name}", options)
+ shell_out_with_systems_locale!("#{systemctl_path} #{args} restart #{Shellwords.escape(new_resource.service_name)}", options)
end
end
@@ -133,7 +134,7 @@ class Chef::Provider::Service::Systemd < Chef::Provider::Service::Simple
else
if current_resource.running
options, args = get_systemctl_options_args
- shell_out_with_systems_locale!("#{systemctl_path} #{args} reload #{new_resource.service_name}", options)
+ shell_out_with_systems_locale!("#{systemctl_path} #{args} reload #{Shellwords.escape(new_resource.service_name)}", options)
else
start_service
end
@@ -142,37 +143,37 @@ class Chef::Provider::Service::Systemd < Chef::Provider::Service::Simple
def enable_service
options, args = get_systemctl_options_args
- shell_out!("#{systemctl_path} #{args} enable #{new_resource.service_name}", options)
+ shell_out!("#{systemctl_path} #{args} enable #{Shellwords.escape(new_resource.service_name)}", options)
end
def disable_service
options, args = get_systemctl_options_args
- shell_out!("#{systemctl_path} #{args} disable #{new_resource.service_name}", options)
+ shell_out!("#{systemctl_path} #{args} disable #{Shellwords.escape(new_resource.service_name)}", options)
end
def mask_service
options, args = get_systemctl_options_args
- shell_out!("#{systemctl_path} #{args} mask #{new_resource.service_name}", options)
+ shell_out!("#{systemctl_path} #{args} mask #{Shellwords.escape(new_resource.service_name)}", options)
end
def unmask_service
options, args = get_systemctl_options_args
- shell_out!("#{systemctl_path} #{args} unmask #{new_resource.service_name}", options)
+ shell_out!("#{systemctl_path} #{args} unmask #{Shellwords.escape(new_resource.service_name)}", options)
end
def is_active?
options, args = get_systemctl_options_args
- shell_out("#{systemctl_path} #{args} is-active #{new_resource.service_name} --quiet", options).exitstatus == 0
+ shell_out("#{systemctl_path} #{args} is-active #{Shellwords.escape(new_resource.service_name)} --quiet", options).exitstatus == 0
end
def is_enabled?
options, args = get_systemctl_options_args
- shell_out("#{systemctl_path} #{args} is-enabled #{new_resource.service_name} --quiet", options).exitstatus == 0
+ shell_out("#{systemctl_path} #{args} is-enabled #{Shellwords.escape(new_resource.service_name)} --quiet", options).exitstatus == 0
end
def is_masked?
options, args = get_systemctl_options_args
- s = shell_out("#{systemctl_path} #{args} is-enabled #{new_resource.service_name}", options)
+ s = shell_out("#{systemctl_path} #{args} is-enabled #{Shellwords.escape(new_resource.service_name)}", options)
s.exitstatus != 0 && s.stdout.include?("masked")
end
diff --git a/lib/chef/provider/support/yum_repo.erb b/lib/chef/provider/support/yum_repo.erb
index 6f1325573d..f60d8688da 100644
--- a/lib/chef/provider/support/yum_repo.erb
+++ b/lib/chef/provider/support/yum_repo.erb
@@ -61,6 +61,9 @@ keepalive=1
<% if @config.metadata_expire %>
metadata_expire=<%= @config.metadata_expire %>
<% end %>
+<% if @config.metalink %>
+metalink=<%= @config.metalink %>
+<% end %>
<% if @config.mirrorlist %>
mirrorlist=<%= @config.mirrorlist %>
<% end %>
@@ -112,6 +115,9 @@ sslclientkey=<%= @config.sslclientkey %>
<% unless @config.sslverify.nil? %>
sslverify=<%= ( @config.sslverify ) ? 'true' : 'false' %>
<% end %>
+<% if @config.throttle %>
+throttle=<%= @config.throttle %>
+<% end %>
<% if @config.timeout %>
timeout=<%= @config.timeout %>
<% end %>
diff --git a/lib/chef/provider/support/zypper_repo.erb b/lib/chef/provider/support/zypper_repo.erb
new file mode 100644
index 0000000000..6d508fa77f
--- /dev/null
+++ b/lib/chef/provider/support/zypper_repo.erb
@@ -0,0 +1,17 @@
+# This file was generated by Chef
+# Do NOT modify this file by hand.
+
+[<%= @config.repo_name %>]
+<% %w{ type enabled autorefresh gpgcheck gpgkey baseurl mirrorlist path priority keeppackages mode refresh_cache }.each do |prop| -%>
+<% next if @config.send(prop.to_sym).nil? -%>
+<%= prop %>=<%=
+ case @config.send(prop.to_sym)
+ when TrueClass
+ '1'
+ when FalseClass
+ '0'
+ else
+ @config.send(prop.to_sym)
+ end %>
+<% end -%>
+name=<%= @config.description || @config.repo_name %>
diff --git a/lib/chef/provider/systemd_unit.rb b/lib/chef/provider/systemd_unit.rb
index 143efe7b91..a2ef64044b 100644
--- a/lib/chef/provider/systemd_unit.rb
+++ b/lib/chef/provider/systemd_unit.rb
@@ -22,6 +22,7 @@ require "chef/mixin/shell_out"
require "chef/resource/file"
require "chef/resource/file/verification/systemd_unit"
require "iniparse"
+require "shellwords"
class Chef
class Provider
@@ -203,11 +204,11 @@ class Chef
end
def systemctl_execute!(action, unit)
- shell_out_with_systems_locale!("#{systemctl_cmd} #{action} #{unit}", systemctl_opts)
+ shell_out_with_systems_locale!("#{systemctl_cmd} #{action} #{Shellwords.escape(unit)}", systemctl_opts)
end
def systemctl_execute(action, unit)
- shell_out("#{systemctl_cmd} #{action} #{unit}", systemctl_opts)
+ shell_out("#{systemctl_cmd} #{action} #{Shellwords.escape(unit)}", systemctl_opts)
end
def systemctl_cmd
diff --git a/lib/chef/provider/windows_path.rb b/lib/chef/provider/windows_path.rb
new file mode 100644
index 0000000000..b31789b4b9
--- /dev/null
+++ b/lib/chef/provider/windows_path.rb
@@ -0,0 +1,62 @@
+#
+# Author:: Nimisha Sharad (<nimisha.sharad@msystechnologies.com>)
+# Copyright:: Copyright 2008-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 "chef/mixin/windows_env_helper" if Chef::Platform.windows?
+require "chef/mixin/wide_string"
+require "chef/exceptions"
+
+class Chef
+ class Provider
+ class WindowsPath < Chef::Provider
+
+ include Chef::Mixin::WindowsEnvHelper if Chef::Platform.windows?
+
+ def load_current_resource
+ @current_resource = Chef::Resource::WindowsPath.new(new_resource.name)
+ @current_resource.path(new_resource.path)
+ @current_resource
+ end
+
+ action :add do
+ # The windows Env provider does not correctly expand variables in
+ # 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
+ end
+ end
+
+ action :remove do
+ # The windows Env provider does not correctly expand variables in
+ # the PATH environment variable. Ruby expects these to be expanded.
+ #
+ path = expand_path(new_resource.path)
+ declare_resource(:env, "path") do
+ action :delete
+ delim ::File::PATH_SEPARATOR
+ value path.tr("/", '\\')
+ end
+ end
+ end
+ end
+end
diff --git a/lib/chef/provider/windows_task.rb b/lib/chef/provider/windows_task.rb
index a96d4b2b7e..8703c30da9 100644
--- a/lib/chef/provider/windows_task.rb
+++ b/lib/chef/provider/windows_task.rb
@@ -7,7 +7,7 @@
# 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
+# 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,
@@ -30,129 +30,153 @@ class Chef
provides :windows_task, os: "windows"
def load_current_resource
- @current_resource = Chef::Resource::WindowsTask.new(new_resource.name)
+ self.current_resource = Chef::Resource::WindowsTask.new(new_resource.name)
pathed_task_name = new_resource.task_name.start_with?('\\') ? new_resource.task_name : "\\#{new_resource.task_name}"
- @current_resource.task_name(pathed_task_name)
+ current_resource.task_name(pathed_task_name)
task_hash = load_task_hash(pathed_task_name)
set_current_resource(task_hash) if task_hash.respond_to?(:[]) && task_hash[:TaskName] == pathed_task_name
- @current_resource
+ current_resource
end
def set_current_resource(task_hash)
- @current_resource.exists = true
- @current_resource.command(task_hash[:TaskToRun])
- @current_resource.cwd(task_hash[:StartIn]) unless task_hash[:StartIn] == "N/A"
- @current_resource.user(task_hash[:RunAsUser])
+ current_resource.exists = true
+ current_resource.command(task_hash[:TaskToRun])
+ current_resource.cwd(task_hash[:StartIn]) unless task_hash[:StartIn] == "N/A"
+ current_resource.user(task_hash[:RunAsUser])
set_current_run_level task_hash[:run_level]
set_current_frequency task_hash
- @current_resource.day(task_hash[:day]) if task_hash[:day]
- @current_resource.months(task_hash[:months]) if task_hash[:months]
+ current_resource.day(task_hash[:day]) if task_hash[:day]
+ current_resource.months(task_hash[:months]) if task_hash[:months]
set_current_idle_time(task_hash[:idle_time]) if task_hash[:idle_time]
- @current_resource.random_delay(task_hash[:random_delay]) if task_hash[:random_delay]
- @current_resource.execution_time_limit(task_hash[:execution_time_limit]) if task_hash[:execution_time_limit]
+ current_resource.random_delay(task_hash[:random_delay]) if task_hash[:random_delay]
+ # schtask sets execution_time_limit as PT72H by default
+ current_resource.execution_time_limit(task_hash[:execution_time_limit] || "PT72H")
+ current_resource.status = :running if task_hash[:Status] == "Running"
+ current_resource.enabled = true if task_hash[:ScheduledTaskState] == "Enabled"
+ current_resource.start_time = task_hash[:StartTime] if task_hash[:StartTime]
+ current_resource.start_day = task_hash[:StartDate] if task_hash[:StartDate]
+ end
- @current_resource.status = :running if task_hash[:Status] == "Running"
- @current_resource.enabled = true if task_hash[:ScheduledTaskState] == "Enabled"
+ # This method checks if task and command attributes exist since those two are mandatory attributes to create a schedules task.
+ def basic_validation
+ validate = []
+ validate << "Command" if new_resource.command.nil? || new_resource.command.empty?
+ validate << "Task Name" if new_resource.task_name.nil? || new_resource.task_name.empty?
+ return true if validate.empty?
+ raise Chef::Exceptions::ValidationFailed.new "Value for '#{validate.join(', ')}' option cannot be empty"
end
- def action_create
- if @current_resource.exists && !(task_need_update? || @new_resource.force)
- Chef::Log.info "#{@new_resource} task already exists - nothing to do"
- else
- options = {}
- options["F"] = "" if @new_resource.force || task_need_update?
- options["SC"] = schedule
- options["MO"] = @new_resource.frequency_modifier if frequency_modifier_allowed
- options["I"] = @new_resource.idle_time unless @new_resource.idle_time.nil?
- options["SD"] = @new_resource.start_day unless @new_resource.start_day.nil?
- options["ST"] = @new_resource.start_time unless @new_resource.start_time.nil?
- options["TR"] = @new_resource.command
- options["RU"] = @new_resource.user
- options["RP"] = @new_resource.password if use_password?
- options["RL"] = "HIGHEST" if @new_resource.run_level == :highest
- options["IT"] = "" if @new_resource.interactive_enabled
- options["D"] = @new_resource.day if @new_resource.day
- options["M"] = @new_resource.months unless @new_resource.months.nil?
-
- run_schtasks "CREATE", options
- xml_options = []
- xml_options << "cwd" if new_resource.cwd
- xml_options << "random_delay" if new_resource.random_delay
- xml_options << "execution_time_limit" if new_resource.execution_time_limit
- update_task_xml(xml_options) unless xml_options.empty?
+ # get array of windows task resource attributes
+ def resource_attributes
+ %w{ command user run_level cwd frequency_modifier frequency idle_time random_delay execution_time_limit start_day start_time }
+ end
- new_resource.updated_by_last_action true
- Chef::Log.info "#{@new_resource} task created"
+ def action_create
+ if current_resource.exists
+ if !(task_need_update? || new_resource.force)
+ Chef::Log.info "#{new_resource} task already exists - nothing to do"
+ return
+ end
+ # To merge current resource and new resource attributes
+ resource_attributes.each do |attribute|
+ new_resource_attribute = new_resource.send(attribute)
+ current_resource_attribute = current_resource.send(attribute)
+ new_resource.send("#{attribute}=", current_resource_attribute ) if current_resource_attribute && new_resource_attribute.nil?
+ end
end
+ basic_validation
+ options = {}
+ options["F"] = "" if new_resource.force || task_need_update?
+ options["SC"] = schedule
+ options["MO"] = new_resource.frequency_modifier if frequency_modifier_allowed
+ options["I"] = new_resource.idle_time unless new_resource.idle_time.nil?
+ options["SD"] = convert_user_date_to_system_date new_resource.start_day unless new_resource.start_day.nil?
+ options["ST"] = new_resource.start_time unless new_resource.start_time.nil?
+ options["TR"] = new_resource.command
+ options["RU"] = new_resource.user
+ options["RP"] = new_resource.password if use_password?
+ options["RL"] = "HIGHEST" if new_resource.run_level == :highest
+ options["IT"] = "" if new_resource.interactive_enabled
+ options["D"] = new_resource.day if new_resource.day
+ options["M"] = new_resource.months unless new_resource.months.nil?
+ run_schtasks "CREATE", options
+ xml_options = []
+ xml_options << "cwd" if new_resource.cwd
+ xml_options << "random_delay" if new_resource.random_delay
+ xml_options << "execution_time_limit" if new_resource.execution_time_limit
+ update_task_xml(xml_options) unless xml_options.empty?
+
+ new_resource.updated_by_last_action true
+ Chef::Log.info "#{new_resource} task created"
end
def action_run
- if @current_resource.exists
- if @current_resource.status == :running
- Chef::Log.info "#{@new_resource} task is currently running, skipping run"
+ if current_resource.exists
+ if current_resource.status == :running
+ Chef::Log.info "#{new_resource} task is currently running, skipping run"
else
run_schtasks "RUN"
new_resource.updated_by_last_action true
- Chef::Log.info "#{@new_resource} task ran"
+ Chef::Log.info "#{new_resource} task ran"
end
else
- Chef::Log.warn "#{@new_resource} task doesn't exists - nothing to do"
+ Chef::Log.warn "#{new_resource} task doesn't exists - nothing to do"
end
end
def action_delete
- if @current_resource.exists
+ if current_resource.exists
# always need to force deletion
run_schtasks "DELETE", "F" => ""
new_resource.updated_by_last_action true
- Chef::Log.info "#{@new_resource} task deleted"
+ Chef::Log.info "#{new_resource} task deleted"
else
- Chef::Log.warn "#{@new_resource} task doesn't exists - nothing to do"
+ Chef::Log.warn "#{new_resource} task doesn't exists - nothing to do"
end
end
def action_end
- if @current_resource.exists
- if @current_resource.status != :running
- Chef::Log.debug "#{@new_resource} is not running - nothing to do"
+ if current_resource.exists
+ if current_resource.status != :running
+ Chef::Log.debug "#{new_resource} is not running - nothing to do"
else
run_schtasks "END"
- @new_resource.updated_by_last_action true
- Chef::Log.info "#{@new_resource} task ended"
+ new_resource.updated_by_last_action true
+ Chef::Log.info "#{new_resource} task ended"
end
else
- Chef::Log.warn "#{@new_resource} task doesn't exist - nothing to do"
+ Chef::Log.warn "#{new_resource} task doesn't exist - nothing to do"
end
end
def action_enable
- if @current_resource.exists
- if @current_resource.enabled
- Chef::Log.debug "#{@new_resource} already enabled - nothing to do"
+ if current_resource.exists
+ if current_resource.enabled
+ Chef::Log.debug "#{new_resource} already enabled - nothing to do"
else
run_schtasks "CHANGE", "ENABLE" => ""
- @new_resource.updated_by_last_action true
- Chef::Log.info "#{@new_resource} task enabled"
+ new_resource.updated_by_last_action true
+ Chef::Log.info "#{new_resource} task enabled"
end
else
- Chef::Log.fatal "#{@new_resource} task doesn't exist - nothing to do"
- raise Errno::ENOENT, "#{@new_resource}: task does not exist, cannot enable"
+ Chef::Log.fatal "#{new_resource} task doesn't exist - nothing to do"
+ raise Errno::ENOENT, "#{new_resource}: task does not exist, cannot enable"
end
end
def action_disable
- if @current_resource.exists
- if @current_resource.enabled
+ if current_resource.exists
+ if current_resource.enabled
run_schtasks "CHANGE", "DISABLE" => ""
- @new_resource.updated_by_last_action true
- Chef::Log.info "#{@new_resource} task disabled"
+ new_resource.updated_by_last_action true
+ Chef::Log.info "#{new_resource} task disabled"
else
- Chef::Log.warn "#{@new_resource} already disabled - nothing to do"
+ Chef::Log.warn "#{new_resource} already disabled - nothing to do"
end
else
- Chef::Log.warn "#{@new_resource} task doesn't exist - nothing to do"
+ Chef::Log.warn "#{new_resource} task doesn't exist - nothing to do"
end
end
@@ -160,7 +184,7 @@ class Chef
# rubocop:disable Style/StringLiteralsInInterpolation
def run_schtasks(task_action, options = {})
- cmd = "schtasks /#{task_action} /TN \"#{@new_resource.task_name}\" "
+ cmd = "schtasks /#{task_action} /TN \"#{new_resource.task_name}\" "
options.keys.each do |option|
cmd += "/#{option} "
cmd += "\"#{options[option].to_s.gsub('"', "\\\"")}\" " unless options[option] == ""
@@ -172,20 +196,21 @@ class Chef
# rubocop:enable Style/StringLiteralsInInterpolation
def task_need_update?
- return true if @current_resource.command != @new_resource.command.tr("'", '"') ||
- @current_resource.user != @new_resource.user ||
- @current_resource.run_level != @new_resource.run_level ||
- @current_resource.cwd != @new_resource.cwd ||
- @current_resource.frequency_modifier != @new_resource.frequency_modifier ||
- @current_resource.frequency != @new_resource.frequency ||
- @current_resource.idle_time != @new_resource.idle_time ||
- @current_resource.random_delay != @new_resource.random_delay ||
- @current_resource.execution_time_limit != @new_resource.execution_time_limit ||
- !@new_resource.start_day.nil? || !@new_resource.start_time.nil?
-
+ return true if (new_resource.command &&
+ current_resource.command != new_resource.command.tr("'", '"')) ||
+ current_resource.user != new_resource.user ||
+ current_resource.run_level != new_resource.run_level ||
+ current_resource.cwd != new_resource.cwd ||
+ current_resource.frequency_modifier != new_resource.frequency_modifier ||
+ current_resource.frequency != new_resource.frequency ||
+ current_resource.idle_time != new_resource.idle_time ||
+ current_resource.random_delay != new_resource.random_delay ||
+ !new_resource.execution_time_limit.include?(current_resource.execution_time_limit) ||
+ (new_resource.start_day && start_day_updated?) ||
+ (new_resource.start_time && start_time_updated?)
begin
- return true if @new_resource.day.to_s.casecmp(@current_resource.day.to_s) != 0 ||
- @new_resource.months.to_s.casecmp(@current_resource.months.to_s) != 0
+ return true if new_resource.day.to_s.casecmp(current_resource.day.to_s) != 0 ||
+ new_resource.months.to_s.casecmp(current_resource.months.to_s) != 0
rescue
Chef::Log.debug "caught a raise in task_needs_update?"
end
@@ -193,6 +218,56 @@ class Chef
false
end
+ def start_day_updated?
+ current_day = DateTime.strptime(current_resource.start_day, convert_system_date_format_to_ruby_date_format)
+ new_day = DateTime.parse(new_resource.start_day)
+ current_day != new_day
+ end
+
+ def start_time_updated?
+ time = DateTime.parse(current_resource.start_time).strftime("%H:%M")
+ time != new_resource.start_time
+ end
+
+ def convert_user_date_to_system_date(date_in_string)
+ DateTime.parse(date_in_string).strftime(convert_system_date_format_to_ruby_long_date)
+ end
+
+ def convert_system_date_format_to_ruby_long_date
+ date_format = get_system_short_date_format.dup
+ date_format.sub!("MMM", "%m")
+ common_date_format_conversion(date_format)
+ date_format.sub!("yy", "%Y")
+ date_format
+ end
+
+ def convert_system_date_format_to_ruby_date_format
+ date_format = get_system_short_date_format.dup
+ date_format.sub!("MMM", "%b")
+ common_date_format_conversion(date_format)
+ date_format.sub!("yy", "%y")
+ date_format
+ end
+
+ def common_date_format_conversion(date_format)
+ date_format.sub!("dd", "d")
+ date_format.sub!("d", "%d")
+ date_format.sub!("MM", "%m")
+ date_format.sub!("M", "%m")
+ date_format.sub!("yyyy", "%Y")
+ end
+
+ def get_system_short_date_format
+ return @system_short_date_format if @system_short_date_format
+ Chef::Log.debug "Finding system date format"
+ task_script = <<-EOH
+ [Console]::OutputEncoding = [Text.UTF8Encoding]::UTF8
+ [Globalization.Cultureinfo]::CurrentCulture.DateTimeFormat.ShortDatePattern
+ EOH
+ @system_short_date_format = powershell_out(task_script).stdout.force_encoding("UTF-8").gsub(/[\s+\uFEFF]/, "")
+ @system_short_date_format
+ end
+
def update_task_xml(options = [])
# random_delay xml element is different for different frequencies
random_delay_xml_element = {
@@ -206,7 +281,7 @@ class Chef
xml_element_mapping = {
"cwd" => "Actions/Exec/WorkingDirectory",
- "random_delay" => random_delay_xml_element[@new_resource.frequency],
+ "random_delay" => random_delay_xml_element[new_resource.frequency],
"execution_time_limit" => "Settings/ExecutionTimeLimit",
}
@@ -214,7 +289,7 @@ class Chef
task_script = <<-EOH
[Console]::OutputEncoding = [Text.UTF8Encoding]::UTF8
- schtasks /Query /TN \"#{@new_resource.task_name}\" /XML
+ schtasks /Query /TN \"#{new_resource.task_name}\" /XML
EOH
xml_cmd = powershell_out(task_script)
@@ -225,7 +300,7 @@ class Chef
options.each do |option|
Chef::Log.debug 'Removing former #{option} if any'
doc.root.elements.delete(xml_element_mapping[option])
- option_value = @new_resource.send("#{option}")
+ option_value = new_resource.send("#{option}")
if option_value
Chef::Log.debug "Setting #option as #option_value"
@@ -246,9 +321,9 @@ class Chef
end
options = {}
- options["RU"] = @new_resource.user if @new_resource.user
- options["RP"] = @new_resource.password if @new_resource.password
- options["IT"] = "" if @new_resource.interactive_enabled
+ options["RU"] = new_resource.user if new_resource.user
+ options["RP"] = new_resource.password if new_resource.password
+ options["IT"] = "" if new_resource.interactive_enabled
options["XML"] = temp_task_file
run_schtasks("DELETE", "F" => "")
@@ -345,26 +420,26 @@ class Chef
SYSTEM_USERS = ['NT AUTHORITY\SYSTEM', "SYSTEM", 'NT AUTHORITY\LOCALSERVICE', 'NT AUTHORITY\NETWORKSERVICE', 'BUILTIN\USERS', "USERS"].freeze
def use_password?
- @use_password ||= !SYSTEM_USERS.include?(@new_resource.user.upcase)
+ @use_password ||= !SYSTEM_USERS.include?(new_resource.user.upcase)
end
def schedule
- case @new_resource.frequency
+ case new_resource.frequency
when :on_logon
"ONLOGON"
when :on_idle
"ONIDLE"
else
- @new_resource.frequency
+ new_resource.frequency
end
end
def frequency_modifier_allowed
- case @new_resource.frequency
+ case new_resource.frequency
when :minute, :hourly, :daily, :weekly
true
when :monthly
- @new_resource.months.nil? || %w{ FIRST SECOND THIRD FOURTH LAST LASTDAY }.include?(@new_resource.frequency_modifier)
+ new_resource.months.nil? || %w{ FIRST SECOND THIRD FOURTH LAST LASTDAY }.include?(new_resource.frequency_modifier)
else
false
end
@@ -373,9 +448,9 @@ class Chef
def set_current_run_level(run_level)
case run_level
when "HighestAvailable"
- @current_resource.run_level(:highest)
+ current_resource.run_level(:highest)
when "LeastPrivilege"
- @current_resource.run_level(:limited)
+ current_resource.run_level(:limited)
end
end
@@ -383,34 +458,34 @@ class Chef
if task_hash[:repetition_interval]
duration = ISO8601::Duration.new(task_hash[:repetition_interval])
if task_hash[:repetition_interval].include?("M")
- @current_resource.frequency(:minute)
- @current_resource.frequency_modifier(duration.minutes.atom.to_i)
+ current_resource.frequency(:minute)
+ current_resource.frequency_modifier(duration.minutes.atom.to_i)
elsif task_hash[:repetition_interval].include?("H")
- @current_resource.frequency(:hourly)
- @current_resource.frequency_modifier(duration.hours.atom.to_i)
+ current_resource.frequency(:hourly)
+ current_resource.frequency_modifier(duration.hours.atom.to_i)
end
end
if task_hash[:schedule_by_day]
- @current_resource.frequency(:daily)
- @current_resource.frequency_modifier(task_hash[:schedule_by_day].to_i)
+ current_resource.frequency(:daily)
+ current_resource.frequency_modifier(task_hash[:schedule_by_day].to_i)
end
if task_hash[:schedule_by_week]
- @current_resource.frequency(:weekly)
- @current_resource.frequency_modifier(task_hash[:schedule_by_week].to_i)
+ current_resource.frequency(:weekly)
+ current_resource.frequency_modifier(task_hash[:schedule_by_week].to_i)
end
- @current_resource.frequency(:monthly) if task_hash[:schedule_by_month]
- @current_resource.frequency(:on_logon) if task_hash[:on_logon]
- @current_resource.frequency(:onstart) if task_hash[:onstart]
- @current_resource.frequency(:on_idle) if task_hash[:on_idle]
- @current_resource.frequency(:once) if task_hash[:once]
+ current_resource.frequency(:monthly) if task_hash[:schedule_by_month]
+ current_resource.frequency(:on_logon) if task_hash[:on_logon]
+ current_resource.frequency(:onstart) if task_hash[:onstart]
+ current_resource.frequency(:on_idle) if task_hash[:on_idle]
+ current_resource.frequency(:once) if task_hash[:once]
end
def set_current_idle_time(idle_time)
duration = ISO8601::Duration.new(idle_time)
- @current_resource.idle_time(duration.minutes.atom.to_i)
+ current_resource.idle_time(duration.minutes.atom.to_i)
end
end
diff --git a/lib/chef/provider/yum_repository.rb b/lib/chef/provider/yum_repository.rb
index a5d3c2bc39..957ee9f0f3 100644
--- a/lib/chef/provider/yum_repository.rb
+++ b/lib/chef/provider/yum_repository.rb
@@ -18,9 +18,7 @@
require "chef/resource"
require "chef/dsl/declare_resource"
-require "chef/mixin/shell_out"
require "chef/mixin/which"
-require "chef/http/simple"
require "chef/provider/noop"
class Chef
diff --git a/lib/chef/provider/zypper_repository.rb b/lib/chef/provider/zypper_repository.rb
new file mode 100644
index 0000000000..e6fd917d77
--- /dev/null
+++ b/lib/chef/provider/zypper_repository.rb
@@ -0,0 +1,81 @@
+#
+# Author:: Tim Smith (<tsmith@chef.io>)
+# Copyright:: Copyright (c) 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 "chef/resource"
+require "chef/dsl/declare_resource"
+require "chef/mixin/which"
+require "chef/provider/noop"
+require "shellwords"
+
+class Chef
+ class Provider
+ class ZypperRepository < Chef::Provider
+
+ extend Chef::Mixin::Which
+
+ provides :zypper_repository do
+ which "zypper"
+ end
+
+ def load_current_resource
+ end
+
+ action :create do
+ declare_resource(:template, "/etc/zypp/repos.d/#{escaped_repo_name}.repo") do
+ if template_available?(new_resource.source)
+ source new_resource.source
+ else
+ source ::File.expand_path("../support/zypper_repo.erb", __FILE__)
+ local true
+ end
+ sensitive new_resource.sensitive
+ variables(config: new_resource)
+ mode new_resource.mode
+ notifies :refresh, new_resource, :immediately if new_resource.refresh_cache
+ end
+ end
+
+ action :delete do
+ declare_resource(:execute, "zypper removerepo #{escaped_repo_name}") do
+ only_if "zypper lr #{escaped_repo_name}"
+ end
+ end
+
+ action :refresh do
+ declare_resource(:execute, "zypper#{' --gpg-auto-import-keys' if new_resource.gpgautoimportkeys} --quiet --no-confirm refresh --force #{escaped_repo_name}") do
+ only_if "zypper lr #{escaped_repo_name}"
+ end
+ end
+
+ alias_method :action_add, :action_create
+ alias_method :action_remove, :action_delete
+
+ # zypper repos are allowed to have spaces in the names
+ def escaped_repo_name
+ Shellwords.escape(new_resource.repo_name)
+ end
+
+ def template_available?(path)
+ !path.nil? && run_context.has_template_in_cookbook?(new_resource.cookbook_name, path)
+ end
+
+ end
+ end
+end
+
+Chef::Provider::Noop.provides :zypper_repository
diff --git a/lib/chef/providers.rb b/lib/chef/providers.rb
index 0ea1786594..a3332477e7 100644
--- a/lib/chef/providers.rb
+++ b/lib/chef/providers.rb
@@ -17,6 +17,7 @@
#
require "chef/provider/apt_update"
+require "chef/provider/apt_preference"
require "chef/provider/apt_repository"
require "chef/provider/batch"
require "chef/provider/cookbook_file"
@@ -59,6 +60,8 @@ require "chef/provider/user"
require "chef/provider/whyrun_safe_ruby_block"
require "chef/provider/yum_repository"
require "chef/provider/windows_task"
+require "chef/provider/zypper_repository"
+require "chef/provider/windows_path"
require "chef/provider/env/windows"
diff --git a/lib/chef/resource.rb b/lib/chef/resource.rb
index ca6603c06a..5436e3ceb3 100644
--- a/lib/chef/resource.rb
+++ b/lib/chef/resource.rb
@@ -641,7 +641,11 @@ class Chef
all_props = {}
self.class.state_properties.map do |p|
- all_props[p.name.to_s] = p.sensitive? ? '"*sensitive value suppressed*"' : value_to_text(p.get(self))
+ begin
+ all_props[p.name.to_s] = p.sensitive? ? '"*sensitive value suppressed*"' : value_to_text(p.get(self))
+ rescue Chef::Exceptions::ValidationFailed
+ # This space left intentionally blank, the property was probably required or had an invalid default.
+ end
end
ivars = instance_variables.map { |ivar| ivar.to_sym } - HIDDEN_IVARS
diff --git a/lib/chef/resource/apt_package.rb b/lib/chef/resource/apt_package.rb
index 069fefcb2b..8397f84c71 100644
--- a/lib/chef/resource/apt_package.rb
+++ b/lib/chef/resource/apt_package.rb
@@ -23,7 +23,7 @@ class Chef
class Resource
class AptPackage < Chef::Resource::Package
resource_name :apt_package
- provides :package, os: "linux", platform_family: [ "debian" ]
+ provides :package, os: "linux", platform_family: "debian"
property :default_release, String, desired_state: false
diff --git a/lib/chef/resource/apt_preference.rb b/lib/chef/resource/apt_preference.rb
new file mode 100644
index 0000000000..603766d76b
--- /dev/null
+++ b/lib/chef/resource/apt_preference.rb
@@ -0,0 +1,36 @@
+#
+# Author:: Tim Smith (<tsmith@chef.io>)
+# Copyright:: 2016-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 "chef/resource"
+
+class Chef
+ class Resource
+ class AptPreference < Chef::Resource
+ resource_name :apt_preference
+ provides :apt_preference
+
+ property :package_name, String, name_property: true, regex: [/^([a-z]|[A-Z]|[0-9]|_|-|\.|\*|\+)+$/]
+ property :glob, String
+ property :pin, String, required: true
+ property :pin_priority, [String, Integer], required: true
+
+ default_action :add
+ allowed_actions :add, :remove
+ end
+ end
+end
diff --git a/lib/chef/resource/apt_repository.rb b/lib/chef/resource/apt_repository.rb
index b38bd1c8ec..8b69435246 100644
--- a/lib/chef/resource/apt_repository.rb
+++ b/lib/chef/resource/apt_repository.rb
@@ -1,6 +1,6 @@
#
# Author:: Thom May (<thom@chef.io>)
-# Copyright:: Copyright (c) 2016 Chef Software, Inc.
+# Copyright:: 2016-2017, Chef Software, Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -33,7 +33,7 @@ class Chef
# whether or not to add the repository as a source repo, too
property :deb_src, [TrueClass, FalseClass], default: false
property :keyserver, [String, nil, false], default: "keyserver.ubuntu.com", nillable: true, coerce: proc { |x| x ? x : nil }
- property :key, [String, nil, false], default: nil, nillable: true, coerce: proc { |x| x ? x : nil }
+ property :key, [String, Array, nil, false], default: [], coerce: proc { |x| x ? Array(x) : nil }
property :key_proxy, [String, nil, false], default: nil, nillable: true, coerce: proc { |x| x ? x : nil }
property :cookbook, [String, nil, false], default: nil, desired_state: false, nillable: true, coerce: proc { |x| x ? x : nil }
diff --git a/lib/chef/resource/execute.rb b/lib/chef/resource/execute.rb
index dee497e74f..ba1b8ae6e3 100644
--- a/lib/chef/resource/execute.rb
+++ b/lib/chef/resource/execute.rb
@@ -132,6 +132,8 @@ class Chef
property :sensitive, [ TrueClass, FalseClass ], default: false, coerce: proc { |x| password ? true : x }
+ property :elevated, [ TrueClass, FalseClass ], default: false
+
def self.set_guard_inherited_attributes(*inherited_attributes)
@class_inherited_attributes = inherited_attributes
end
@@ -149,21 +151,29 @@ class Chef
end
def after_created
- validate_identity_platform(user, password, domain)
+ validate_identity_platform(user, password, domain, elevated)
identity = qualify_user(user, password, domain)
domain(identity[:domain])
user(identity[:user])
end
- def validate_identity_platform(specified_user, password = nil, specified_domain = nil)
+ def validate_identity_platform(specified_user, password = nil, specified_domain = nil, elevated = false)
if node[:platform_family] == "windows"
if specified_user && password.nil?
raise ArgumentError, "A value for `password` must be specified when a value for `user` is specified on the Windows platform"
end
+
+ if elevated && !specified_user && !password
+ raise ArgumentError, "`elevated` option should be passed only with `username` and `password`."
+ end
else
if password || specified_domain
raise Exceptions::UnsupportedPlatform, "Values for `domain` and `password` are only supported on the Windows platform"
end
+
+ if elevated
+ raise Exceptions::UnsupportedPlatform, "Value for `elevated` is only supported on the Windows platform"
+ end
end
end
diff --git a/lib/chef/resource/http_request.rb b/lib/chef/resource/http_request.rb
index fcc48470bc..9fac3562f3 100644
--- a/lib/chef/resource/http_request.rb
+++ b/lib/chef/resource/http_request.rb
@@ -27,7 +27,7 @@ class Chef
identity_attr :url
default_action :get
- allowed_actions :get, :put, :post, :delete, :head, :options
+ allowed_actions :get, :patch, :put, :post, :delete, :head, :options
def initialize(name, run_context = nil)
super
diff --git a/lib/chef/resource/ifconfig.rb b/lib/chef/resource/ifconfig.rb
index fd523d9580..3673311348 100644
--- a/lib/chef/resource/ifconfig.rb
+++ b/lib/chef/resource/ifconfig.rb
@@ -44,6 +44,10 @@ class Chef
@network = nil
@bootproto = nil
@onparent = nil
+ @ethtool_opts = nil
+ @bonding_opts = nil
+ @master = nil
+ @slave = nil
end
def target(arg = nil)
@@ -141,6 +145,38 @@ class Chef
:kind_of => String
)
end
+
+ def ethtool_opts(arg = nil)
+ set_or_return(
+ :ethtool_opts,
+ arg,
+ :kind_of => String
+ )
+ end
+
+ def bonding_opts(arg = nil)
+ set_or_return(
+ :bonding_opts,
+ arg,
+ :kind_of => String
+ )
+ end
+
+ def master(arg = nil)
+ set_or_return(
+ :master,
+ arg,
+ :kind_of => String
+ )
+ end
+
+ def slave(arg = nil)
+ set_or_return(
+ :slave,
+ arg,
+ :kind_of => String
+ )
+ end
end
end
diff --git a/lib/chef/resource/remote_file.rb b/lib/chef/resource/remote_file.rb
index 4a1d1c6cff..25586af702 100644
--- a/lib/chef/resource/remote_file.rb
+++ b/lib/chef/resource/remote_file.rb
@@ -131,6 +131,66 @@ class Chef
)
end
+ property :remote_user, String
+
+ property :remote_domain, String
+
+ property :remote_password, String, sensitive: true
+
+ def after_created
+ validate_identity_platform(remote_user, remote_password, remote_domain)
+ identity = qualify_user(remote_user, remote_password, remote_domain)
+ remote_domain(identity[:domain])
+ remote_user(identity[:user])
+ end
+
+ def validate_identity_platform(specified_user, password = nil, specified_domain = nil)
+ if node[:platform_family] == "windows"
+ if specified_user && password.nil?
+ raise ArgumentError, "A value for `remote_password` must be specified when a value for `user` is specified on the Windows platform"
+ end
+ end
+ end
+
+ def qualify_user(specified_user, password = nil, specified_domain = nil)
+ domain = specified_domain
+ user = specified_user
+
+ if specified_user.nil? && ! specified_domain.nil?
+ raise ArgumentError, "The domain `#{specified_domain}` was specified, but no user name was given"
+ end
+
+ # if domain is provided in both username and domain
+ if specified_user && ((specified_user.include? '\\') || (specified_user.include? "@")) && specified_domain
+ raise ArgumentError, "The domain is provided twice. Username: `#{specified_user}`, Domain: `#{specified_domain}`. Please specify domain only once."
+ end
+
+ if ! specified_user.nil? && specified_domain.nil?
+ # Splitting username of format: Domain\Username
+ domain_and_user = user.split('\\')
+
+ if domain_and_user.length == 2
+ domain = domain_and_user[0]
+ user = domain_and_user[1]
+ elsif domain_and_user.length == 1
+ # Splitting username of format: Username@Domain
+ domain_and_user = user.split("@")
+ if domain_and_user.length == 2
+ domain = domain_and_user[1]
+ user = domain_and_user[0]
+ elsif domain_and_user.length != 1
+ raise ArgumentError, "The specified user name `#{user}` is not a syntactically valid user name"
+ end
+ end
+ end
+
+ if ( password || domain ) && user.nil?
+ raise ArgumentError, "A value for `password` or `domain` was specified without specification of a value for `user`"
+ end
+
+ { domain: domain, user: user }
+ end
+
private
include Chef::Mixin::Uris
diff --git a/lib/chef/resource/windows_path.rb b/lib/chef/resource/windows_path.rb
new file mode 100644
index 0000000000..5472a7e4fd
--- /dev/null
+++ b/lib/chef/resource/windows_path.rb
@@ -0,0 +1,41 @@
+#
+# Author:: Nimisha Sharad (<nimisha.sharad@msystechnologies.com>)
+# Copyright:: Copyright 2008-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 "chef/resource"
+
+class Chef
+ class Resource
+ class WindowsPath < Chef::Resource
+
+ provides :windows_path, os: "windows"
+
+ allowed_actions :add, :remove
+ default_action :add
+
+ def initialize(name, run_context = nil)
+ super
+ @resource_name = :windows_path
+ @path = name
+ @provider = Chef::Provider::WindowsPath
+ @action = :add
+ end
+
+ property :path, String, name_property: true
+ end
+ end
+end
diff --git a/lib/chef/resource/yum_repository.rb b/lib/chef/resource/yum_repository.rb
index f59ad56d16..012a74908a 100644
--- a/lib/chef/resource/yum_repository.rb
+++ b/lib/chef/resource/yum_repository.rb
@@ -24,11 +24,12 @@ class Chef
resource_name :yum_repository
provides :yum_repository
- # http://linux.die.net/man/5/yum.conf
+ # http://linux.die.net/man/5/yum.conf as well as
+ # http://dnf.readthedocs.io/en/latest/conf_ref.html
property :baseurl, [String, Array], regex: /.*/
- property :cost, String, regex: /^\d+$/
property :clean_headers, [TrueClass, FalseClass], default: false # deprecated
property :clean_metadata, [TrueClass, FalseClass], default: true
+ property :cost, String, regex: /^\d+$/
property :description, String, regex: /.*/, default: "Yum Repository"
property :enabled, [TrueClass, FalseClass], default: true
property :enablegroups, [TrueClass, FalseClass]
@@ -44,17 +45,18 @@ class Chef
property :make_cache, [TrueClass, FalseClass], default: true
property :max_retries, [String, Integer]
property :metadata_expire, String, regex: [/^\d+$/, /^\d+[mhd]$/, /never/]
- property :mirrorexpire, String, regex: /.*/
- property :mirrorlist, String, regex: /.*/
+ property :metalink, String, regex: /.*/
property :mirror_expire, String, regex: [/^\d+$/, /^\d+[mhd]$/]
+ property :mirrorexpire, String, regex: /.*/
property :mirrorlist_expire, String, regex: [/^\d+$/, /^\d+[mhd]$/]
+ property :mirrorlist, String, regex: /.*/
property :mode, default: "0644"
+ property :options, Hash
+ property :password, String, regex: /.*/
property :priority, String, regex: /^(\d?[0-9]|[0-9][0-9])$/
- property :proxy, String, regex: /.*/
- property :proxy_username, String, regex: /.*/
property :proxy_password, String, regex: /.*/
- property :username, String, regex: /.*/
- property :password, String, regex: /.*/
+ property :proxy_username, String, regex: /.*/
+ property :proxy, String, regex: /.*/
property :repo_gpgcheck, [TrueClass, FalseClass]
property :report_instanceid, [TrueClass, FalseClass]
property :repositoryid, String, regex: /.*/, name_property: true
@@ -65,7 +67,8 @@ class Chef
property :sslclientkey, String, regex: /.*/
property :sslverify, [TrueClass, FalseClass]
property :timeout, String, regex: /^\d+$/
- property :options, Hash
+ property :throttle, [String, Integer]
+ property :username, String, regex: /.*/
default_action :create
allowed_actions :create, :remove, :makecache, :add, :delete
diff --git a/lib/chef/resource/zypper_repository.rb b/lib/chef/resource/zypper_repository.rb
new file mode 100644
index 0000000000..69a96b42cf
--- /dev/null
+++ b/lib/chef/resource/zypper_repository.rb
@@ -0,0 +1,52 @@
+#
+# Author:: Tim Smith (<tsmith@chef.io>)
+# Copyright:: Copyright (c) 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 "chef/resource"
+
+class Chef
+ class Resource
+ class ZypperRepository < Chef::Resource
+ resource_name :zypper_repository
+ provides :zypper_repo
+
+ property :repo_name, String, name_property: true
+ property :description, String
+ property :type, String, default: "NONE"
+ property :enabled, [true, false], default: true
+ property :autorefresh, [true, false], default: true
+ property :gpgcheck, [true, false], default: true
+ property :gpgkey, String
+ property :baseurl, String
+ property :mirrorlist, String
+ property :path, String
+ property :priority, Integer, default: 99
+ property :keeppackages, [true, false], default: false
+ property :mode, default: "0644"
+ property :refresh_cache, [true, false], default: true
+ property :source, String, regex: /.*/
+ property :gpgautoimportkeys, [true, false], default: true
+
+ default_action :create
+ allowed_actions :create, :remove, :add, :refresh
+
+ # provide compatibility with the zypper cookbook
+ alias_method :key, :gpgkey
+ alias_method :uri, :baseurl
+ end
+ end
+end
diff --git a/lib/chef/resources.rb b/lib/chef/resources.rb
index 9f87cb2454..54d21fd53c 100644
--- a/lib/chef/resources.rb
+++ b/lib/chef/resources.rb
@@ -17,6 +17,7 @@
#
require "chef/resource/apt_package"
+require "chef/resource/apt_preference"
require "chef/resource/apt_repository"
require "chef/resource/apt_update"
require "chef/resource/bash"
@@ -95,7 +96,9 @@ require "chef/resource/yum_repository"
require "chef/resource/lwrp_base"
require "chef/resource/bff_package"
require "chef/resource/zypper_package"
+require "chef/resource/zypper_repository"
require "chef/resource/cab_package"
require "chef/resource/powershell_package"
require "chef/resource/msu_package"
require "chef/resource/windows_task"
+require "chef/resource/windows_path"
diff --git a/lib/chef/search/query.rb b/lib/chef/search/query.rb
index 6f494819ba..a2663d111d 100644
--- a/lib/chef/search/query.rb
+++ b/lib/chef/search/query.rb
@@ -71,6 +71,11 @@ class Chef
args_h = args_h.reject { |k, v| k == :fuzz }
end
+ # Set default rows parameter to 1000. This is the default in
+ # Chef Server, but we set it explicitly here so that we can
+ # confidently advance our start parameter.
+ args_h[:rows] ||= 1000
+
response = call_rest_service(type, query: query, **args_h)
if block
@@ -87,7 +92,7 @@ class Chef
# args_h[:rows] to avoid asking the search backend for
# overlapping pages (which could result in duplicates).
#
- next_start = response["start"] + (args_h[:rows] || response["rows"].length)
+ next_start = response["start"] + args_h[:rows]
unless next_start >= response["total"]
args_h[:start] = next_start
search(type, query, args_h, &block)
diff --git a/lib/chef/server_api_versions.rb b/lib/chef/server_api_versions.rb
index 2a4d0e6a5b..40fb6385e1 100644
--- a/lib/chef/server_api_versions.rb
+++ b/lib/chef/server_api_versions.rb
@@ -26,15 +26,34 @@ class Chef
end
def min_server_version
- !@versions.nil? ? Integer(@versions["min_version"]) : nil
+ # If we're working with a pre-api-versioning server, always claim to be zero
+ if @versions.nil?
+ unversioned? ? 0 : nil
+ else
+ Integer(@versions["min_version"])
+ end
end
def max_server_version
- !@versions.nil? ? Integer(@versions["max_version"]) : nil
+ # If we're working with a pre-api-versioning server, always claim to be zero
+ if @versions.nil?
+ unversioned? ? 0 : nil
+ else
+ Integer(@versions["max_version"])
+ end
+ end
+
+ def unversioned!
+ @unversioned = true
+ end
+
+ def unversioned?
+ @unversioned
end
def reset!
@versions = nil
+ @unversioned = false
end
end
end
diff --git a/lib/chef/shell.rb b/lib/chef/shell.rb
index b4c0277c57..40bdf01762 100644
--- a/lib/chef/shell.rb
+++ b/lib/chef/shell.rb
@@ -138,6 +138,7 @@ module Shell
def self.session
unless client_type.instance.node_built?
puts "Session type: #{client_type.session_type}"
+ client_type.instance.json_configuration = @json_attribs
client_type.instance.reset!
end
client_type.instance
diff --git a/lib/chef/shell/shell_session.rb b/lib/chef/shell/shell_session.rb
index 41d5bd64a0..dfed5372c1 100644
--- a/lib/chef/shell/shell_session.rb
+++ b/lib/chef/shell/shell_session.rb
@@ -38,7 +38,7 @@ module Shell
@session_type
end
- attr_accessor :node, :compile, :recipe, :run_context
+ attr_accessor :node, :compile, :recipe, :run_context, :json_configuration
attr_reader :node_attributes, :client
def initialize
@node_built = false
@@ -151,7 +151,7 @@ module Shell
def rebuild_node
Chef::Config[:solo_legacy_mode] = true
- @client = Chef::Client.new(nil, Chef::Config[:shell_config])
+ @client = Chef::Client.new(json_configuration, Chef::Config[:shell_config])
@client.run_ohai
@client.load_node
@client.build_node
@@ -183,7 +183,7 @@ module Shell
def rebuild_node
# Tell the client we're chef solo so it won't try to contact the server
Chef::Config[:solo_legacy_mode] = true
- @client = Chef::Client.new(nil, Chef::Config[:shell_config])
+ @client = Chef::Client.new(json_configuration, Chef::Config[:shell_config])
@client.run_ohai
@client.load_node
@client.build_node
@@ -218,7 +218,7 @@ module Shell
def rebuild_node
# Make sure the client knows this is not chef solo
Chef::Config[:solo_legacy_mode] = false
- @client = Chef::Client.new(nil, Chef::Config[:shell_config])
+ @client = Chef::Client.new(json_configuration, Chef::Config[:shell_config])
@client.run_ohai
@client.register
@client.load_node
diff --git a/lib/chef/util/dsc/local_configuration_manager.rb b/lib/chef/util/dsc/local_configuration_manager.rb
index d837a16185..1f154b1c71 100644
--- a/lib/chef/util/dsc/local_configuration_manager.rb
+++ b/lib/chef/util/dsc/local_configuration_manager.rb
@@ -47,15 +47,13 @@ class Chef::Util::DSC
def run_configuration_cmdlet(configuration_document, apply_configuration, shellout_flags)
Chef::Log.debug("DSC: Calling DSC Local Config Manager to #{apply_configuration ? "set" : "test"} configuration document.")
- test_only_parameters = ! apply_configuration ? "-whatif; if (! $?) { exit 1 }" : ""
start_operation_timing
- command_code = lcm_command_code(@configuration_path, test_only_parameters)
status = nil
begin
save_configuration_document(configuration_document)
- cmdlet = ::Chef::Util::Powershell::Cmdlet.new(@node, "#{command_code}")
+ cmdlet = ::Chef::Util::Powershell::Cmdlet.new(@node, lcm_command(apply_configuration))
if apply_configuration
status = cmdlet.run!({}, shellout_flags)
else
@@ -72,10 +70,22 @@ class Chef::Util::DSC
status
end
- def lcm_command_code(configuration_path, test_only_parameters)
- <<-EOH
-$ProgressPreference = 'SilentlyContinue';start-dscconfiguration -path #{@configuration_path} -wait -erroraction 'stop' -force #{test_only_parameters}
-EOH
+ def lcm_command(apply_configuration)
+ common_command_prefix = "$ProgressPreference = 'SilentlyContinue';"
+ ps4_base_command = "#{common_command_prefix} Start-DscConfiguration -path #{@configuration_path} -wait -erroraction 'stop' -force"
+ if apply_configuration
+ ps4_base_command
+ else
+ if ps_version_gte_5?
+ "#{common_command_prefix} Test-DscConfiguration -path #{@configuration_path}"
+ else
+ ps4_base_command + " -whatif; if (! $?) { exit 1 }"
+ end
+ end
+ end
+
+ def ps_version_gte_5?
+ Chef::Platform.supported_powershell_version?(@node, 5)
end
def log_what_if_exception(what_if_exception_output)
diff --git a/lib/chef/util/windows/logon_session.rb b/lib/chef/util/windows/logon_session.rb
new file mode 100644
index 0000000000..ef80b113b1
--- /dev/null
+++ b/lib/chef/util/windows/logon_session.rb
@@ -0,0 +1,126 @@
+#
+# Author:: Adam Edwards (<adamed@chef.io>)
+#
+# Copyright:: Copyright (c) 2015 Chef Software, Inc.
+#
+# 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 "chef/win32/api/security" if Chef::Platform.windows?
+require "chef/mixin/wide_string"
+
+class Chef
+ class Util
+ class Windows
+ class LogonSession
+ include Chef::Mixin::WideString
+
+ def initialize(username, password, domain = nil)
+ if username.nil? || password.nil?
+ raise ArgumentError, "The logon session must be initialize with non-nil user name and password parameters"
+ end
+
+ @original_username = username
+ @original_password = password
+ @original_domain = domain
+ @token = FFI::Buffer.new(:pointer)
+ @session_opened = false
+ @impersonating = false
+ end
+
+ def open
+ if session_opened
+ raise "Attempted to open a logon session that was already open."
+ end
+
+ username = wstring(original_username)
+ password = wstring(original_password)
+ domain = wstring(original_domain)
+
+ status = Chef::ReservedNames::Win32::API::Security.LogonUserW(username, domain, password, Chef::ReservedNames::Win32::API::Security::LOGON32_LOGON_NEW_CREDENTIALS, Chef::ReservedNames::Win32::API::Security::LOGON32_PROVIDER_DEFAULT, token)
+
+ if !status
+ last_error = FFI::LastError.error
+ raise Chef::Exceptions::Win32APIError, "Logon for user `#{original_username}` failed with Win32 status #{last_error}."
+ end
+
+ @session_opened = true
+ end
+
+ def close
+ validate_session_open!
+
+ if impersonating
+ restore_user_context
+ end
+
+ Chef::ReservedNames::Win32::API::System.CloseHandle(token.read_ulong)
+ @token = nil
+ @session_opened = false
+ end
+
+ def set_user_context
+ validate_session_open!
+
+ if ! session_opened
+ raise "Attempted to set the user context before opening a session."
+ end
+
+ if impersonating
+ raise "Attempt to set the user context when the user context is already set."
+ end
+
+ status = Chef::ReservedNames::Win32::API::Security.ImpersonateLoggedOnUser(token.read_ulong)
+
+ if !status
+ last_error = FFI::LastError.error
+ raise Chef::Exceptions::Win32APIError, "Attempt to impersonate user `#{original_username}` failed with Win32 status #{last_error}."
+ end
+
+ @impersonating = true
+ end
+
+ def restore_user_context
+ validate_session_open!
+
+ if impersonating
+ status = Chef::ReservedNames::Win32::API::Security.RevertToSelf
+
+ if !status
+ last_error = FFI::LastError.error
+ raise Chef::Exceptions::Win32APIError, "Unable to restore user context with Win32 status #{last_error}."
+ end
+ end
+
+ @impersonating = false
+ end
+
+ protected
+
+ attr_reader :original_username
+ attr_reader :original_password
+ attr_reader :original_domain
+
+ attr_reader :token
+ attr_reader :session_opened
+ attr_reader :impersonating
+
+ def validate_session_open!
+ if ! session_opened
+ raise "Attempted to set the user context before opening a session."
+ end
+ end
+ end
+ end
+ end
+end
diff --git a/lib/chef/version.rb b/lib/chef/version.rb
index b969e726a5..e30285d620 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.3.1")
+ VERSION = Chef::VersionString.new("13.4.33")
end
#
diff --git a/lib/chef/win32/api/file.rb b/lib/chef/win32/api/file.rb
index 355cc81378..6aa2927e1f 100644
--- a/lib/chef/win32/api/file.rb
+++ b/lib/chef/win32/api/file.rb
@@ -67,6 +67,7 @@ class Chef
MAX_PATH = 260
SYMBOLIC_LINK_FLAG_DIRECTORY = 0x1
+ SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE = 0x2
FILE_NAME_NORMALIZED = 0x0
FILE_NAME_OPENED = 0x8
diff --git a/lib/chef/win32/api/security.rb b/lib/chef/win32/api/security.rb
index a2cfe35dad..a6f79f5d7d 100644
--- a/lib/chef/win32/api/security.rb
+++ b/lib/chef/win32/api/security.rb
@@ -453,6 +453,8 @@ class Chef
safe_attach_function :SetSecurityDescriptorSacl, [ :pointer, :BOOL, :pointer, :BOOL ], :BOOL
safe_attach_function :GetTokenInformation, [ :HANDLE, :TOKEN_INFORMATION_CLASS, :pointer, :DWORD, :PDWORD ], :BOOL
safe_attach_function :LogonUserW, [:LPTSTR, :LPTSTR, :LPTSTR, :DWORD, :DWORD, :PHANDLE], :BOOL
+ safe_attach_function :ImpersonateLoggedOnUser, [:HANDLE], :BOOL
+ safe_attach_function :RevertToSelf, [], :BOOL
end
end
diff --git a/lib/chef/win32/file.rb b/lib/chef/win32/file.rb
index fa3d0f7a9d..03d4496fa8 100644
--- a/lib/chef/win32/file.rb
+++ b/lib/chef/win32/file.rb
@@ -22,6 +22,7 @@ require "chef/win32/api/file"
require "chef/win32/api/security"
require "chef/win32/error"
require "chef/win32/unicode"
+require "chef/win32/version"
class Chef
module ReservedNames::Win32
@@ -60,6 +61,7 @@ class Chef
# TODO do a check for CreateSymbolicLinkW and
# raise NotImplemented exception on older Windows
flags = ::File.directory?(old_name) ? SYMBOLIC_LINK_FLAG_DIRECTORY : 0
+ flags |= SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE if Chef::ReservedNames::Win32::Version.new.win_10_creators_or_higher?
old_name = encode_path(old_name)
new_name = encode_path(new_name)
unless CreateSymbolicLinkW(new_name, old_name, flags)
diff --git a/lib/chef/win32/version.rb b/lib/chef/win32/version.rb
index 3e2d6bc1fe..f8228d40b3 100644
--- a/lib/chef/win32/version.rb
+++ b/lib/chef/win32/version.rb
@@ -30,6 +30,8 @@ class Chef
include Chef::ReservedNames::Win32::API::Macros
include Chef::ReservedNames::Win32::API::System
+ attr_reader :major_version, :minor_version, :build_number
+
# Ruby implementation of
# http://msdn.microsoft.com/en-us/library/ms724833(v=vs.85).aspx
# http://msdn.microsoft.com/en-us/library/ms724358(v=vs.85).aspx
@@ -114,6 +116,10 @@ class Chef
end
end
+ def win_10_creators_or_higher?
+ windows_10? && build_number >= 15063
+ end
+
private
def get_version
diff --git a/omnibus/Gemfile.lock b/omnibus/Gemfile.lock
index 3d69a37465..11cb4a1938 100644
--- a/omnibus/Gemfile.lock
+++ b/omnibus/Gemfile.lock
@@ -1,16 +1,17 @@
GIT
remote: https://github.com/chef/license_scout
- revision: e9c48c6773dec6fd718642194bfcb166d5685e03
+ revision: 0e89df12ad6bc451924610dd6a570fc264fde15e
specs:
license_scout (0.1.3)
ffi-yajl (~> 2.2)
mixlib-shellout (~> 2.2)
+ toml-rb (~> 1.0)
GIT
remote: https://github.com/chef/omnibus
- revision: 0212438d74eb408791724d737afba83868e416ed
+ revision: 52393d7cab443b61790f94c62775d9032d283497
specs:
- omnibus (5.5.0)
+ omnibus (5.6.1)
aws-sdk (~> 2)
chef-sugar (~> 3.3)
cleanroom (~> 1.0)
@@ -25,27 +26,27 @@ GIT
GIT
remote: https://github.com/chef/omnibus-software
- revision: 266a8ab07b0380607ce8a6ec5fd824ea002be2f1
+ revision: aa4162c2f7a4e8e5cf9d961e060d5a48a15a5e63
specs:
omnibus-software (4.0.0)
chef-sugar (>= 3.4.0)
- omnibus (>= 5.5.0)
+ omnibus (>= 5.6.1)
GEM
remote: https://rubygems.org/
specs:
- addressable (2.5.1)
- public_suffix (~> 2.0, >= 2.0.2)
+ addressable (2.5.2)
+ public_suffix (>= 2.0.2, < 4.0)
artifactory (2.8.2)
- awesome_print (1.7.0)
- aws-sdk (2.9.41)
- aws-sdk-resources (= 2.9.41)
- aws-sdk-core (2.9.41)
+ awesome_print (1.8.0)
+ aws-sdk (2.10.45)
+ aws-sdk-resources (= 2.10.45)
+ aws-sdk-core (2.10.45)
aws-sigv4 (~> 1.0)
jmespath (~> 1.0)
- aws-sdk-resources (2.9.41)
- aws-sdk-core (= 2.9.41)
- aws-sigv4 (1.0.0)
+ aws-sdk-resources (2.10.45)
+ aws-sdk-core (= 2.10.45)
+ aws-sigv4 (1.0.2)
berkshelf (4.3.5)
addressable (~> 2.3, >= 2.3.4)
berkshelf-api-client (~> 2.0, >= 2.0.2)
@@ -79,20 +80,21 @@ GEM
buff-shell_out (0.2.0)
buff-ruby_engine (~> 0.1.0)
builder (3.2.3)
- byebug (9.0.6)
+ byebug (9.1.0)
celluloid (0.16.0)
timers (~> 4.0.0)
celluloid-io (0.16.2)
celluloid (>= 0.16.0)
nio4r (>= 1.1.0)
- chef-config (13.1.31)
+ chef-config (13.4.19)
addressable
fuzzyurl
mixlib-config (~> 2.0)
mixlib-shellout (~> 2.0)
- chef-sugar (3.4.0)
+ chef-sugar (3.5.0)
+ citrus (3.0.2)
cleanroom (1.0.0)
- coderay (1.1.1)
+ coderay (1.1.2)
debug_inspector (0.0.3)
erubis (2.7.0)
faraday (0.9.2)
@@ -100,16 +102,16 @@ GEM
ffi (1.9.18)
ffi (1.9.18-x64-mingw32)
ffi (1.9.18-x86-mingw32)
- ffi-yajl (2.3.0)
+ 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.5)
- hitimes (1.2.5-x86-mingw32)
+ hashie (3.5.6)
+ hitimes (1.2.6)
+ hitimes (1.2.6-x86-mingw32)
httpclient (2.7.2)
iostruct (0.0.4)
ipaddress (0.8.3)
@@ -126,8 +128,7 @@ GEM
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)
@@ -136,24 +137,24 @@ GEM
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)
+ mixlib-versioning (1.2.2)
molinillo (0.4.5)
- multi_json (1.12.1)
+ 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-ssh (4.2.0)
net-ssh-gateway (1.3.0)
net-ssh (>= 2.6.5)
nio4r (2.1.0)
nori (2.6.0)
octokit (4.7.0)
sawyer (~> 0.8.0, >= 0.5.3)
- ohai (8.24.0)
+ ohai (8.24.1)
chef-config (>= 12.5.0.alpha.1, < 14)
ffi (~> 1.9)
ffi-yajl (~> 2.2)
@@ -177,13 +178,13 @@ GEM
coderay (~> 1.1.0)
method_source (~> 0.8.1)
slop (~> 3.4)
- pry-byebug (3.4.2)
- byebug (~> 9.0)
+ pry-byebug (3.5.0)
+ byebug (~> 9.1)
pry (~> 0.10)
pry-stack_explorer (0.4.9.2)
binding_of_caller (>= 0.7)
pry (>= 0.9.11)
- public_suffix (2.0.5)
+ public_suffix (3.0.0)
retryable (2.0.4)
ridley (4.6.1)
addressable
@@ -203,7 +204,7 @@ GEM
retryable (~> 2.0)
semverse (~> 1.1)
varia_model (~> 0.4.0)
- ruby-progressbar (1.8.1)
+ ruby-progressbar (1.8.3)
rubyntlm (0.6.2)
rubyzip (1.2.1)
safe_yaml (1.0.4)
@@ -216,7 +217,7 @@ GEM
molinillo (~> 0.4.2)
semverse (~> 1.1)
systemu (2.6.5)
- test-kitchen (1.16.0)
+ test-kitchen (1.17.0)
mixlib-install (>= 1.2, < 3.0)
mixlib-shellout (>= 1.2, < 3.0)
net-scp (~> 1.1)
@@ -227,6 +228,8 @@ GEM
thor (0.19.1)
timers (4.0.4)
hitimes
+ toml-rb (1.0.0)
+ citrus (~> 3.0, > 3.0)
varia_model (0.4.1)
buff-extensions (~> 1.0)
hashie (>= 2.0.2, < 4.0.0)
@@ -268,4 +271,4 @@ DEPENDENCIES
winrm-fs (~> 1.0)
BUNDLED WITH
- 1.15.1
+ 1.15.4
diff --git a/omnibus/config/projects/chef.rb b/omnibus/config/projects/chef.rb
index 2342a7e186..f758893cbb 100644
--- a/omnibus/config/projects/chef.rb
+++ b/omnibus/config/projects/chef.rb
@@ -48,6 +48,11 @@ instance_eval(IO.read(overrides_path), overrides_path)
dependency "preparation"
dependency "chef"
+#
+# addons which require omnibus software defns (not direct deps of chef itself - RFC-063)
+#
+dependency "nokogiri" # (nokogiri cannot go in the Gemfile, see wall of text in the software defn)
+
# FIXME?: might make sense to move dependencies below into the omnibus-software chef
# definition or into a chef-complete definition added to omnibus-software.
dependency "gem-permissions"
@@ -90,11 +95,11 @@ package :msi do
upgrade_code msi_upgrade_code
wix_candle_extension "WixUtilExtension"
wix_light_extension "WixUtilExtension"
- signing_identity "F74E1A68005E8A9C465C3D2FF7B41F3988F0EA09", machine_store: true
+ signing_identity "E05FF095D07F233B78EB322132BFF0F035E11B5B", machine_store: true
parameters ChefLogDllPath: windows_safe_path(gem_path("chef-[0-9]*-mingw32/ext/win32-eventlog/chef-log.dll")),
ProjectLocationDir: project_location_dir
end
package :appx do
- signing_identity "F74E1A68005E8A9C465C3D2FF7B41F3988F0EA09", machine_store: true
+ signing_identity "E05FF095D07F233B78EB322132BFF0F035E11B5B", machine_store: true
end
diff --git a/omnibus/resources/chef/ips/symlinks.erb b/omnibus/resources/chef/ips/chef-symlinks.erb
index 419d52ddf7..419d52ddf7 100644
--- a/omnibus/resources/chef/ips/symlinks.erb
+++ b/omnibus/resources/chef/ips/chef-symlinks.erb
diff --git a/omnibus_overrides.rb b/omnibus_overrides.rb
index 552c2b9822..5e2f1af4d9 100644
--- a/omnibus_overrides.rb
+++ b/omnibus_overrides.rb
@@ -1,8 +1,9 @@
# THIS IS NOW HAND MANAGED, JUST EDIT THE THING
# .travis.yml and appveyor.yml consume this,
# try to keep it machine-parsable.
-override :rubygems, version: "2.6.11"
-override :bundler, version: "1.14.6"
+override :rubygems, version: "2.6.13"
+override :bundler, version: "1.15.4"
+override "nokogiri", version: "1.8.0"
override "libffi", version: "3.2.1"
override "libiconv", version: "1.14"
override "liblzma", version: "5.2.3"
@@ -13,7 +14,7 @@ override "libyaml", version: "0.1.6"
override "makedepend", version: "1.0.5"
override "ncurses", version: "5.9"
override "pkg-config-lite", version: "0.28-1"
-override "ruby", version: "2.4.1"
+override "ruby", version: "2.4.2"
override "ruby-windows-devkit-bash", version: "3.1.23-4-msys-1.0.18"
override "util-macros", version: "1.19.0"
override "xproto", version: "7.0.28"
diff --git a/spec/functional/knife/ssh_spec.rb b/spec/functional/knife/ssh_spec.rb
index fba344649f..9d6fd3ae10 100644
--- a/spec/functional/knife/ssh_spec.rb
+++ b/spec/functional/knife/ssh_spec.rb
@@ -304,7 +304,7 @@ describe Chef::Knife::Ssh do
Chef::Config[:client_key] = nil
Chef::Config[:chef_server_url] = "http://localhost:9000"
- @api.post("/search/node?q=*:*&start=0", 200) do
+ @api.post("/search/node?q=*:*&start=0&rows=1000", 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/functional/mixin/user_context_spec.rb b/spec/functional/mixin/user_context_spec.rb
new file mode 100644
index 0000000000..802b1db9f1
--- /dev/null
+++ b/spec/functional/mixin/user_context_spec.rb
@@ -0,0 +1,117 @@
+#
+# Copyright:: Copyright (c) 2015 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"
+
+require "chef/win32/api" if Chef::Platform.windows?
+require "chef/win32/api/error" if Chef::Platform.windows?
+require "chef/mixin/user_context"
+
+describe Chef::Mixin::UserContext, windows_only: true do
+ include Chef::Mixin::UserContext
+
+ let(:get_user_name_a) do
+ FFI.ffi_lib "advapi32.dll"
+ FFI.attach_function :GetUserNameA, [ :pointer, :pointer ], :bool
+ end
+
+ let(:process_username) do
+ name_size = FFI::Buffer.new(:long).write_long(0)
+ succeeded = get_user_name_a.call(nil, name_size)
+ last_error = FFI::LastError.error
+ if succeeded || last_error != Chef::ReservedNames::Win32::API::Error::ERROR_INSUFFICIENT_BUFFER
+ raise Chef::Exceptions::Win32APIError, "Expected ERROR_INSUFFICIENT_BUFFER from GetUserNameA but it returned the following error: #{last_error}"
+ end
+ user_name = FFI::MemoryPointer.new :char, (name_size.read_long)
+ succeeded = get_user_name_a.call(user_name, name_size)
+ last_error = FFI::LastError.error
+ if succeeded == 0 || last_error != 0
+ raise Chef::Exceptions::Win32APIError, "GetUserNameA failed with #{lasterror}"
+ end
+ user_name.read_string
+ end
+
+ let(:test_user) { "chefuserctx3" }
+ let(:test_domain) { windows_nonadmin_user_domain }
+ let(:test_password) { "j823jfxK3;2Xe1" }
+
+ let(:username_domain_qualification) { nil }
+ let(:username_with_conditional_domain) { username_domain_qualification.nil? ? username_to_impersonate : "#{username_domain_qualification}\\#{username_to_impersonate}" }
+
+ let(:windows_nonadmin_user) { test_user }
+ let(:windows_nonadmin_user_password) { test_password }
+
+ let(:username_while_impersonating) do
+ username = nil
+ with_user_context(username_with_conditional_domain, username_to_impersonate_password, domain_to_impersonate) do
+ username = process_username
+ end
+ username
+ end
+
+ before do
+ allow_any_instance_of(described_class).to receive(:node).and_return({ "platform_family" => "windows" })
+ end
+
+ shared_examples_for "method that executes the block while impersonating the alternate user" do
+ it "uses different credentials for other network connections" do
+ allow_any_instance_of(Chef::Util::Windows::LogonSession).to receive(:validate_session_open!).and_return(true)
+ expect(username_while_impersonating.downcase).not_to eq(username_to_impersonate.downcase)
+ end
+ end
+
+ describe "#with_user_context" do
+ context "when the user and domain are both nil" do
+ let(:username_to_impersonate) { nil }
+ let(:domain_to_impersonate) { nil }
+ let(:username_to_impersonate_password) { nil }
+
+ it "has the same token and username as the process" do
+ expect(username_while_impersonating.downcase).to eq(ENV["username"].downcase)
+ end
+ end
+
+ context "when a non-nil user is specified" do
+ include_context "a non-admin Windows user"
+ context "when a username different than the process user is specified" do
+ let(:username_to_impersonate) { test_user }
+ let(:username_to_impersonate_password) { test_password }
+ context "when an explicit domain is given with a valid password" do
+ let(:domain_to_impersonate) { test_domain }
+ it "uses different credentials for other network connections" do
+ expect(username_while_impersonating.downcase).not_to eq(username_to_impersonate.downcase)
+ end
+ end
+
+ context "when a valid password and a non-qualified user is given and no domain is specified" do
+ let(:domain_to_impersonate) { "." }
+ it_behaves_like "method that executes the block while impersonating the alternate user"
+ end
+
+ it "raises an error user if specified with the wrong password" do
+ expect { with_user_context(username_to_impersonate, username_to_impersonate_password + "1", nil) }.to raise_error(ArgumentError)
+ end
+ end
+ end
+
+ context "when invalid arguments are passed" do
+ it "raises an ArgumentError exception if the password is not specified but the user is specified" do
+ expect { with_user_context(test_user, nil, nil) }.to raise_error(ArgumentError)
+ end
+ end
+ end
+end
diff --git a/spec/functional/resource/remote_file_spec.rb b/spec/functional/resource/remote_file_spec.rb
index 1f92a567f3..94c42a73ba 100644
--- a/spec/functional/resource/remote_file_spec.rb
+++ b/spec/functional/resource/remote_file_spec.rb
@@ -123,6 +123,177 @@ describe Chef::Resource::RemoteFile do
end
+ context "when running on Windows", :windows_only do
+ describe "when fetching files over SMB" do
+ include Chef::Mixin::ShellOut
+ let(:smb_share_root_directory) { directory = File.join(Dir.tmpdir, make_tmpname("windows_script_test")); Dir.mkdir(directory); directory }
+ let(:smb_file_local_file_name) { "smb_file.txt" }
+ let(:smb_file_local_path) { File.join( smb_share_root_directory, smb_file_local_file_name ) }
+ let(:smb_share_name) { "chef_smb_test" }
+ let(:smb_remote_path) { File.join("//#{ENV['COMPUTERNAME']}", smb_share_name, smb_file_local_file_name).gsub(/\//, "\\") }
+ let(:smb_file_content) { "hellofun" }
+ let(:local_destination_path) { File.join(Dir.tmpdir, make_tmpname("chef_remote_file")) }
+ let(:windows_current_user) { ENV["USERNAME"] }
+ let(:windows_current_user_domain) { ENV["USERDOMAIN"] || ENV["COMPUTERNAME"] }
+ let(:windows_current_user_qualified) { "#{windows_current_user_domain}\\#{windows_current_user}" }
+
+ let(:remote_domain) { nil }
+ let(:remote_user) { nil }
+ let(:remote_password) { nil }
+
+ let(:resource) do
+ node = Chef::Node.new
+ events = Chef::EventDispatch::Dispatcher.new
+ run_context = Chef::RunContext.new(node, {}, events)
+ resource = Chef::Resource::RemoteFile.new(path, run_context)
+ end
+
+ before do
+ shell_out("net.exe share #{smb_share_name} /delete")
+ File.write(smb_file_local_path, smb_file_content )
+ shell_out!("net.exe share #{smb_share_name}=\"#{smb_share_root_directory.gsub(/\//, '\\')}\" /grant:\"authenticated users\",read")
+ end
+
+ after do
+ shell_out("net.exe share #{smb_share_name} /delete")
+ File.delete(smb_file_local_path) if File.exist?(smb_file_local_path)
+ File.delete(local_destination_path) if File.exist?(local_destination_path)
+ Dir.rmdir(smb_share_root_directory)
+ end
+
+ context "when configuring the Windows identity used to access the remote file" do
+ before do
+ resource.path(local_destination_path)
+ resource.source(smb_remote_path)
+ resource.remote_domain(remote_domain)
+ resource.remote_user(remote_user)
+ resource.remote_password(remote_password)
+ resource.node.default["platform_family"] = "windows"
+ allow_any_instance_of(Chef::Provider::RemoteFile::NetworkFile).to receive(:node).and_return({ "platform_family" => "windows" })
+ end
+
+ shared_examples_for "a remote_file resource accessing a remote file to which the specified user has access" do
+ it "has the same content as the original file" do
+ expect { resource.run_action(:create) }.not_to raise_error
+ expect(::File.read(local_destination_path).chomp).to eq smb_file_content
+ end
+ end
+
+ shared_examples_for "a remote_file resource accessing a remote file to which the specified user does not have access" do
+ it "causes an error to be raised" do
+ expect { resource.run_action(:create) }.to raise_error(Errno::EACCES)
+ end
+ end
+
+ shared_examples_for "a remote_file resource accessing a remote file with invalid user" do
+ it "causes an error to be raised" do
+ allow(Chef::Util::Windows::LogonSession).to receive(:validate_session_open!).and_return(true)
+ expect { resource.run_action(:create) }.to raise_error(Chef::Exceptions::Win32APIError)
+ end
+ end
+
+ context "when the file is accessible to non-admin users only as the current identity" do
+ before do
+ shell_out!("icacls #{smb_file_local_path} /grant:r \"authenticated users:(W)\" /grant \"#{windows_current_user_qualified}:(R)\" /inheritance:r")
+ end
+
+ context "when the resource is accessed using the current user's identity" do
+ let(:remote_user) { nil }
+ let(:remote_domain) { nil }
+ let(:remote_password) { nil }
+
+ it_behaves_like "a remote_file resource accessing a remote file to which the specified user has access"
+
+ describe "uses the ::Chef::Provider::RemoteFile::NetworkFile::TRANSFER_CHUNK_SIZE constant to chunk the file" do
+ let(:invalid_chunk_size) { -1 }
+ before do
+ stub_const("::Chef::Provider::RemoteFile::NetworkFile::TRANSFER_CHUNK_SIZE", invalid_chunk_size)
+ end
+
+ it "raises an ArgumentError when the chunk size is negative" do
+ expect(::Chef::Provider::RemoteFile::NetworkFile::TRANSFER_CHUNK_SIZE).to eq(invalid_chunk_size)
+ expect { resource.run_action(:create) }.to raise_error(ArgumentError)
+ end
+ end
+
+ context "when the file must be transferred in more than one chunk" do
+ before do
+ stub_const("::Chef::Provider::RemoteFile::NetworkFile::TRANSFER_CHUNK_SIZE", 3)
+ end
+ it_behaves_like "a remote_file resource accessing a remote file to which the specified user has access"
+ end
+ end
+
+ context "when the resource is accessed using an alternate user's identity with no access to the file" do
+ let (:windows_nonadmin_user) { "chefremfile1" }
+ let (:windows_nonadmin_user_password) { "j82ajfxK3;2Xe1" }
+ include_context "a non-admin Windows user"
+
+ before do
+ shell_out!("icacls #{smb_file_local_path} /grant:r \"authenticated users:(W)\" /deny \"#{windows_current_user_qualified}:(R)\" /inheritance:r")
+ end
+
+ let(:remote_user) { windows_nonadmin_user }
+ let(:remote_domain) { windows_nonadmin_user_domain }
+ let(:remote_password) { windows_nonadmin_user_password }
+
+ it_behaves_like "a remote_file resource accessing a remote file to which the specified user does not have access"
+ end
+ end
+
+ context "when the the file is only accessible as a specific alternate identity" do
+ let (:windows_nonadmin_user) { "chefremfile2" }
+ let (:windows_nonadmin_user_password) { "j82ajfxK3;2Xe2" }
+ include_context "a non-admin Windows user"
+
+ before do
+ shell_out!("icacls #{smb_file_local_path} /grant:r \"authenticated users:(W)\" /grant \"#{windows_current_user_qualified}:(R)\" /inheritance:r")
+ end
+
+ context "when the resource is accessed using the specific non-qualified alternate user identity with access" do
+ let(:remote_user) { windows_nonadmin_user }
+ let(:remote_domain) { "." }
+ let(:remote_password) { windows_nonadmin_user_password }
+
+ it_behaves_like "a remote_file resource accessing a remote file to which the specified user has access"
+ end
+
+ context "when the resource is accessed using the specific alternate user identity with access and the domain is specified" do
+ let(:remote_user) { windows_nonadmin_user }
+ let(:remote_domain) { windows_nonadmin_user_domain }
+ let(:remote_password) { windows_nonadmin_user_password }
+
+ it_behaves_like "a remote_file resource accessing a remote file to which the specified user has access"
+ end
+
+ context "when the resource is accessed using the current user's identity" do
+ before do
+ shell_out!("icacls #{smb_file_local_path} /grant:r \"authenticated users:(W)\" /grant \"#{windows_nonadmin_user_qualified}:(R)\" /deny #{windows_current_user_qualified}:(R) /inheritance:r")
+ end
+
+ it_behaves_like "a remote_file resource accessing a remote file to which the specified user does not have access"
+ end
+
+ context "when the resource is accessed using an alternate user's identity with no access to the file" do
+ let (:windows_nonadmin_user) { "chefremfile3" }
+ let (:windows_nonadmin_user_password) { "j82ajfxK3;2Xe3" }
+ include_context "a non-admin Windows user"
+
+ let(:remote_user) { windows_nonadmin_user_qualified }
+ let(:remote_domain) { nil }
+ let(:remote_password) { windows_nonadmin_user_password }
+
+ before do
+ allow_any_instance_of(Chef::Util::Windows::LogonSession).to receive(:validate_session_open!).and_return(true)
+ end
+
+ it_behaves_like "a remote_file resource accessing a remote file with invalid user"
+ end
+ end
+ end
+ end
+ end
+
context "when dealing with content length checking" do
before(:each) do
start_tiny_server
diff --git a/spec/functional/resource/windows_path_spec.rb b/spec/functional/resource/windows_path_spec.rb
new file mode 100644
index 0000000000..912abe6b24
--- /dev/null
+++ b/spec/functional/resource/windows_path_spec.rb
@@ -0,0 +1,64 @@
+#
+# Author:: Nimisha Sharad (<nimisha.sharad@msystechnologies.com>)
+# Copyright:: Copyright (c) 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"
+
+describe Chef::Resource::WindowsPath, :windows_only do
+ let(:path) { "test_path" }
+
+ before(:all) do
+ @old_path = ENV["PATH"].dup
+ end
+
+ after(:all) do
+ ENV["PATH"] = @old_path
+ end
+
+ subject do
+ new_resource = Chef::Resource::WindowsPath.new(path, run_context)
+ new_resource
+ end
+
+ describe "adding path" do
+ after { remove_path }
+
+ it "appends the user given path in the Environment variable Path" do
+ subject.run_action(:add)
+ expect(ENV["PATH"]).to include(path)
+ end
+ end
+
+ describe "removing path" do
+ before { add_path }
+
+ it "removes the user given path from the Environment variable Path" do
+ subject.run_action(:remove)
+ expect(ENV["PATH"]).not_to include(path)
+ end
+ end
+
+ def remove_path
+ new_resource = Chef::Resource::WindowsPath.new(path, run_context)
+ new_resource.run_action(:remove)
+ end
+
+ def add_path
+ new_resource = Chef::Resource::WindowsPath.new(path, run_context)
+ new_resource.run_action(:add)
+ end
+end
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index 1a897ef95f..bace94fcbe 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -1,6 +1,6 @@
#
# Author:: Adam Jacob (<adam@chef.io>)
-# Copyright:: Copyright 2008-2016, Chef Software, Inc.
+# Copyright:: Copyright 2008-2017, Chef Software Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -30,6 +30,8 @@ $:.unshift File.expand_path("../..", __FILE__)
require "rubygems"
require "rspec/mocks"
+require "webmock/rspec"
+
$:.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
$:.unshift(File.expand_path("../lib", __FILE__))
$:.unshift(File.dirname(__FILE__))
@@ -215,6 +217,11 @@ RSpec.configure do |config|
config.run_all_when_everything_filtered = true
config.before(:each) do
+ # it'd be nice to run this with connections blocked or only to localhost, but we do make lots
+ # of real connections, so cannot. we reset it to allow connections every time to avoid
+ # tests setting connections to be disabled and that state leaking into other tests.
+ WebMock.allow_net_connect!
+
Chef.reset!
Chef::ChefFS::FileSystemCache.instance.reset!
diff --git a/spec/unit/cookbook/metadata_spec.rb b/spec/unit/cookbook/metadata_spec.rb
index 2fdc43c289..a91feec26d 100644
--- a/spec/unit/cookbook/metadata_spec.rb
+++ b/spec/unit/cookbook/metadata_spec.rb
@@ -1,7 +1,7 @@
#
# Author:: Adam Jacob (<adam@chef.io>)
# Author:: Seth Falcon (<seth@chef.io>)
-# Copyright:: Copyright 2008-2016, Chef Software, Inc.
+# Copyright:: Copyright 2008-2017, Chef Software Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -98,11 +98,11 @@ describe Chef::Cookbook::Metadata do
end
it "has an empty maintainer field" do
- expect(metadata.maintainer).to eq(nil)
+ expect(metadata.maintainer).to eq("")
end
it "has an empty maintainer_email field" do
- expect(metadata.maintainer).to eq(nil)
+ expect(metadata.maintainer_email).to eq("")
end
it "has an empty platforms list" do
diff --git a/spec/unit/http/api_versions_spec.rb b/spec/unit/http/api_versions_spec.rb
index 91d46763c2..2ccb847acc 100644
--- a/spec/unit/http/api_versions_spec.rb
+++ b/spec/unit/http/api_versions_spec.rb
@@ -1,5 +1,5 @@
#
-# Copyright:: Copyright 2017, Chef Software, Inc.
+# Copyright:: Copyright 2017-2017, Chef Software Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -27,7 +27,7 @@ describe Chef::HTTP::APIVersions do
end
let(:method) { "GET" }
- let(:url) { "http://dummy.com" }
+ let(:url) { "http://localhost:60123" }
let(:headers) { {} }
let(:data) { false }
@@ -53,8 +53,11 @@ describe Chef::HTTP::APIVersions do
m
end
+ let(:client) do
+ TestVersionClient.new(url, { version_class: VersionedClassVersions })
+ end
+
let(:middleware) do
- client = TestVersionClient.new(url)
client.middlewares[0]
end
diff --git a/spec/unit/knife/bootstrap_spec.rb b/spec/unit/knife/bootstrap_spec.rb
index 4201963b7d..736ff9b099 100644
--- a/spec/unit/knife/bootstrap_spec.rb
+++ b/spec/unit/knife/bootstrap_spec.rb
@@ -586,6 +586,10 @@ describe Chef::Knife::Bootstrap do
expect(knife.bootstrap_context.first_boot).to have_key(:policy_group)
end
+ it "ensures that run_list is not set in the bootstrap context" do
+ expect(knife.bootstrap_context.first_boot).to_not have_key(:run_list)
+ end
+
end
# https://github.com/chef/chef/issues/4131
diff --git a/spec/unit/knife/client_delete_spec.rb b/spec/unit/knife/client_delete_spec.rb
index f20b25f5e6..b05a487d62 100644
--- a/spec/unit/knife/client_delete_spec.rb
+++ b/spec/unit/knife/client_delete_spec.rb
@@ -35,7 +35,7 @@ describe Chef::Knife::ClientDelete do
end
context "receives multiple clients" do
- let(:clients) { %w{ "adam", "ben", "charlie" } }
+ let(:clients) { %w{ adam ben charlie } }
before(:each) do
@knife.name_args = clients
diff --git a/spec/unit/knife/cookbook_show_spec.rb b/spec/unit/knife/cookbook_show_spec.rb
index 1e8ea836d7..bd952c215f 100644
--- a/spec/unit/knife/cookbook_show_spec.rb
+++ b/spec/unit/knife/cookbook_show_spec.rb
@@ -1,6 +1,6 @@
#
# Author:: Adam Jacob (<adam@chef.io>)
-# Copyright:: Copyright 2008-2016, Chef Software Inc.
+# Copyright:: Copyright 2008-2017, Chef Software Inc.
# License:: Apache License, eersion 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -110,8 +110,8 @@ describe Chef::Knife::CookbookShow do
"name" => nil,
"description" => "",
"long_description" => "",
- "maintainer" => nil,
- "maintainer_email" => nil,
+ "maintainer" => "",
+ "maintainer_email" => "",
"license" => "All rights reserved",
"platforms" => {},
"dependencies" => {},
diff --git a/spec/unit/knife/ssh_spec.rb b/spec/unit/knife/ssh_spec.rb
index 6141a8a6df..e15ca8a7f0 100644
--- a/spec/unit/knife/ssh_spec.rb
+++ b/spec/unit/knife/ssh_spec.rb
@@ -187,7 +187,7 @@ describe Chef::Knife::Ssh do
describe "#session_from_list" do
before :each do
@knife.instance_variable_set(:@longest, 0)
- ssh_config = { :timeout => 50, :user => "locutus", :port => 23 }
+ ssh_config = { :timeout => 50, :user => "locutus", :port => 23, :keepalive => true, :keepalive_interval => 60 }
allow(Net::SSH).to receive(:configuration_for).with("the.b.org", true).and_return(ssh_config)
end
@@ -223,6 +223,12 @@ describe Chef::Knife::Ssh do
@knife.session_from_list([["the.b.org", 123]])
expect(@knife.session.servers[0].user).to eq("locutus")
end
+
+ it "uses keepalive settings from an ssh config file" do
+ @knife.session_from_list([["the.b.org", 123]])
+ expect(@knife.session.servers[0].options[:keepalive]).to be true
+ expect(@knife.session.servers[0].options[:keepalive_interval]).to eq 60
+ end
end
describe "#ssh_command" do
diff --git a/spec/unit/knife/status_spec.rb b/spec/unit/knife/status_spec.rb
index c87ea3ad17..929a0f742b 100644
--- a/spec/unit/knife/status_spec.rb
+++ b/spec/unit/knife/status_spec.rb
@@ -23,6 +23,8 @@ describe Chef::Knife::Status do
node = Chef::Node.new.tap do |n|
n.automatic_attrs["fqdn"] = "foobar"
n.automatic_attrs["ohai_time"] = 1343845969
+ n.automatic_attrs["platform"] = "mac_os_x"
+ n.automatic_attrs["platform_version"] = "10.12.5"
end
allow(Time).to receive(:now).and_return(Time.at(1428573420))
@query = double("Chef::Search::Query")
diff --git a/spec/unit/mixin/user_context_spec.rb b/spec/unit/mixin/user_context_spec.rb
new file mode 100644
index 0000000000..f2119b6dbc
--- /dev/null
+++ b/spec/unit/mixin/user_context_spec.rb
@@ -0,0 +1,109 @@
+#
+# Author:: Adam Edwards (<adamed@chef.io>)
+# Copyright:: Copyright (c) 2015 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"
+require "chef/mixin/user_context"
+require "chef/util/windows/logon_session"
+
+describe "a class that mixes in user_context" do
+ let(:instance_with_user_context) do
+ class UserContextConsumer
+ include ::Chef::Mixin::UserContext
+ def with_context(user, domain, password, &block)
+ with_user_context(user, password, domain, &block)
+ end
+ end
+ UserContextConsumer.new
+ end
+
+ shared_examples_for "a method that requires a block" do
+ it "raises an ArgumentError exception if a block is not supplied" do
+ expect { instance_with_user_context.with_context(nil, nil, nil) }.to raise_error(ArgumentError)
+ end
+ end
+
+ context "when running on Windows" do
+ before do
+ allow(::Chef::Platform).to receive(:windows?).and_return(true)
+ allow(::Chef::Util::Windows::LogonSession).to receive(:new).and_return(logon_session)
+ allow(instance_with_user_context).to receive(:node).and_return({ "platform_family" => "windows" })
+ end
+
+ let(:logon_session) { instance_double("::Chef::Util::Windows::LogonSession", :set_user_context => nil, :open => nil, :close => nil) }
+
+ it "does not raise an exception when the user and all parameters are nil" do
+ expect { instance_with_user_context.with_context(nil, nil, nil) {} }.not_to raise_error
+ end
+
+ context "when given valid user credentials" do
+ before do
+ expect(::Chef::Util::Windows::LogonSession).to receive(:new).and_return(logon_session)
+ end
+
+ let(:block_object) do
+ class BlockClass
+ def block_method
+ end
+ end
+ BlockClass.new
+ end
+
+ let(:block_parameter) { Proc.new { block_object.block_method } }
+
+ context "when the block doesn't raise an exception" do
+ before do
+ expect( block_object ).to receive(:block_method)
+ end
+ it "calls the supplied block" do
+ expect { instance_with_user_context.with_context("kamilah", nil, "chef4life", &block_parameter) }.not_to raise_error
+ end
+
+ it "does not raise an exception if the user, password, and domain are specified" do
+ expect { instance_with_user_context.with_context("kamilah", "xanadu", "chef4life", &block_parameter) }.not_to raise_error
+ end
+ end
+
+ context "when the block raises an exception" do
+ class UserContextTestException < RuntimeError
+ end
+ let(:block_parameter) { Proc.new { raise UserContextTextException } }
+
+ it "raises the exception raised by the block" do
+ expect { instance_with_user_context.with_context("kamilah", nil, "chef4life", &block_parameter) }.not_to raise_error(UserContextTestException)
+ end
+
+ it "closes the logon session so resources are not leaked" do
+ expect(logon_session).to receive(:close)
+ expect { instance_with_user_context.with_context("kamilah", nil, "chef4life", &block_parameter) }.not_to raise_error(UserContextTestException)
+ end
+ end
+ end
+
+ it_behaves_like "a method that requires a block"
+ end
+
+ context "when not running on Windows" do
+ before do
+ allow(instance_with_user_context).to receive(:node).and_return({ "platform_family" => "ubuntu" })
+ end
+
+ it "raises a ::Chef::Exceptions::UnsupportedPlatform exception" do
+ expect { instance_with_user_context.with_context(nil, nil, nil) {} }.to raise_error(::Chef::Exceptions::UnsupportedPlatform)
+ end
+ end
+end
diff --git a/spec/unit/node/immutable_collections_spec.rb b/spec/unit/node/immutable_collections_spec.rb
index 520bc1ba42..2d3392041c 100644
--- a/spec/unit/node/immutable_collections_spec.rb
+++ b/spec/unit/node/immutable_collections_spec.rb
@@ -21,10 +21,10 @@ require "chef/node/immutable_collections"
describe Chef::Node::ImmutableMash do
before do
- @data_in = { :top => { :second_level => "some value" },
+ @data_in = { "top" => { "second_level" => "some value" },
"top_level_2" => %w{array of values},
- :top_level_3 => [{ :hash_array => 1, :hash_array_b => 2 }],
- :top_level_4 => { :level2 => { :key => "value" } },
+ "top_level_3" => [{ "hash_array" => 1, "hash_array_b" => 2 }],
+ "top_level_4" => { "level2" => { "key" => "value" } },
}
@immutable_mash = Chef::Node::ImmutableMash.new(@data_in)
end
@@ -54,6 +54,14 @@ describe Chef::Node::ImmutableMash do
expect(@immutable_mash[:top_level_4][:level2]).to be_a(Chef::Node::ImmutableMash)
end
+ # we only ever absorb VividMashes from other precedence levels, which already have
+ # been coerced to only have string keys, so we do not need to do that work twice (performance).
+ it "does not call convert_value like Mash/VividMash" do
+ @mash = Chef::Node::ImmutableMash.new({ test: "foo", "test2" => "bar" })
+ expect(@mash[:test]).to eql("foo")
+ expect(@mash["test2"]).to eql("bar")
+ end
+
describe "to_hash" do
before do
@copy = @immutable_mash.to_hash
@@ -168,7 +176,7 @@ describe Chef::Node::ImmutableArray do
before do
@immutable_array = Chef::Node::ImmutableArray.new(%w{foo bar baz} + Array(1..3) + [nil, true, false, [ "el", 0, nil ] ])
- immutable_mash = Chef::Node::ImmutableMash.new({ :m => "m" })
+ immutable_mash = Chef::Node::ImmutableMash.new({ "m" => "m" })
@immutable_nested_array = Chef::Node::ImmutableArray.new(["level1", @immutable_array, immutable_mash])
end
diff --git a/spec/unit/node_spec.rb b/spec/unit/node_spec.rb
index 73f0e6da09..7dc972b5a0 100644
--- a/spec/unit/node_spec.rb
+++ b/spec/unit/node_spec.rb
@@ -337,6 +337,13 @@ describe Chef::Node do
node.override_unless[:decontamination] = "foo"
expect(node.override[:decontamination]).to eql("foo")
end
+
+ it "consume_attributes does not exhibit chef/chef/issues/6302 bug" do
+ node.normal["a"]["r1"] = nil
+ node.consume_attributes({ "a" => { "r2" => nil } })
+ expect(node["a"]["r1"]).to be_nil
+ expect(node["a"]["r2"]).to be_nil
+ end
end
describe "default attributes" do
diff --git a/spec/unit/provider/apt_preference_spec.rb b/spec/unit/provider/apt_preference_spec.rb
new file mode 100644
index 0000000000..e37dc16ff9
--- /dev/null
+++ b/spec/unit/provider/apt_preference_spec.rb
@@ -0,0 +1,87 @@
+#
+# Author:: Thom May (<thom@chef.io>)
+# Author:: Tim Smith (<tim@chef.io>)
+# Copyright:: 2016-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"
+
+describe Chef::Provider::AptPreference do
+ let(:new_resource) { Chef::Resource::AptPreference.new("libmysqlclient16.1*") }
+ let(:pref_dir) { Dir.mktmpdir("apt_pref_d") }
+
+ before do
+ stub_const("Chef::Provider::AptPreference::APT_PREFERENCE_DIR", pref_dir)
+ new_resource.pin = "1.0.1"
+ new_resource.pin_priority 1001
+ end
+
+ let(:provider) do
+ node = Chef::Node.new
+ events = Chef::EventDispatch::Dispatcher.new
+ run_context = Chef::RunContext.new(node, {}, events)
+ Chef::Provider::AptPreference.new(new_resource, run_context)
+ end
+
+ it "responds to load_current_resource" do
+ expect(provider).to respond_to(:load_current_resource)
+ end
+
+ context "#action_add" do
+ context "without a preferences.d directory" do
+ before do
+ FileUtils.rmdir pref_dir
+ end
+
+ it "creates the preferences.d directory" do
+ provider.run_action(:add)
+ expect(new_resource).to be_updated_by_last_action
+ expect(File.exist?(pref_dir)).to be true
+ expect(File.directory?(pref_dir)).to be true
+ end
+ end
+
+ context "with a preferences.d directory" do
+ before do
+ FileUtils.mkdir pref_dir unless ::File.exist?(pref_dir)
+ FileUtils.touch("#{pref_dir}/libmysqlclient16.1*.pref")
+ FileUtils.touch("#{pref_dir}/libmysqlclient16.1*")
+ end
+
+ # FileUtils.touch throws "Invalid argument @ utime_failed" in appveyer
+ it "creates a sanitized .pref file and removes the legacy cookbook files", :unix_only do
+ provider.run_action(:add)
+ expect(new_resource).to be_updated_by_last_action
+ expect(File).not_to exist("#{pref_dir}/libmysqlclient16.1*.pref")
+ expect(File).not_to exist("#{pref_dir}/libmysqlclient16.1*")
+ expect(File.read(::File.join(pref_dir, "libmysqlclient16_1wildcard.pref"))).to match(/Package: libmysqlclient16.1*.*Pin: 1.0.1.*Pin-Priority: 1001/m)
+ end
+ end
+ end
+
+ context "#action_delete" do
+ before do
+ FileUtils.mkdir pref_dir unless ::File.exist?(pref_dir)
+ FileUtils.touch("#{pref_dir}/libmysqlclient16_1wildcard.pref")
+ end
+
+ it "deletes the name santized .pref file" do
+ provider.run_action(:remove)
+ expect(new_resource).to be_updated_by_last_action
+ expect(File).not_to exist("#{pref_dir}/libmysqlclient16_1wildcard.pref")
+ end
+ end
+end
diff --git a/spec/unit/provider/apt_repository_spec.rb b/spec/unit/provider/apt_repository_spec.rb
index 6180582d69..cabf6551c9 100644
--- a/spec/unit/provider/apt_repository_spec.rb
+++ b/spec/unit/provider/apt_repository_spec.rb
@@ -1,6 +1,6 @@
#
# Author:: Thom May (<thom@chef.io>)
-# Copyright:: Copyright (c) 2016 Chef Software, Inc.
+# Copyright:: 2016-2017, Chef Software, Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
diff --git a/spec/unit/provider/dsc_resource_spec.rb b/spec/unit/provider/dsc_resource_spec.rb
index 96356e5d73..747e37f308 100644
--- a/spec/unit/provider/dsc_resource_spec.rb
+++ b/spec/unit/provider/dsc_resource_spec.rb
@@ -155,8 +155,8 @@ describe Chef::Provider::DscResource do
context "multiple resource are found" do
let (:resource_records) do
[
- { "Module" => { "Name" => "ModuleName1" } },
- { "Module" => { "Name" => "ModuleName2" } },
+ { "Module" => { "Name" => "ModuleName1", "Version" => "1.0.0.0" } },
+ { "Module" => { "Name" => "ModuleName1", "Version" => "2.0.0.0" } },
] end
it "raises MultipleDscResourcesFound" do
diff --git a/spec/unit/provider/git_spec.rb b/spec/unit/provider/git_spec.rb
index a60c1b44c3..cacee0baaa 100644
--- a/spec/unit/provider/git_spec.rb
+++ b/spec/unit/provider/git_spec.rb
@@ -83,6 +83,61 @@ describe Chef::Provider::Git do
expect(@provider.new_resource).to equal(@resource)
end
+ context "cast git version into gem version object" do
+ it "returns correct version with standard git" do
+ expect(@provider).to receive(:shell_out!)
+ .with("git --version", log_tag: "git[web2.0 app]")
+ .and_return(double("ShellOut result", stdout: "git version 2.14.1"))
+ expect(@provider.git_gem_version).to eq Gem::Version.new("2.14.1")
+ end
+
+ it "returns correct version with Apple git" do
+ expect(@provider).to receive(:shell_out!)
+ .with("git --version", log_tag: "git[web2.0 app]")
+ .and_return(double("ShellOut result", stdout: "git version 2.11.0 (Apple Git-81)"))
+ expect(@provider.git_gem_version).to eq Gem::Version.new("2.11.0")
+ end
+
+ it "maintains deprecated method name" do
+ expect(@provider).to receive(:shell_out!)
+ .with("git --version", log_tag: "git[web2.0 app]")
+ .and_return(double("ShellOut result", stdout: "git version 1.2.3"))
+ expect(@provider.git_minor_version).to eq Gem::Version.new("1.2.3")
+ end
+
+ it "does not know how to handle other version" do
+ expect(@provider).to receive(:shell_out!)
+ .with("git --version", log_tag: "git[web2.0 app]")
+ .and_return(double("ShellOut result", stdout: "git version home-grown-git-99"))
+ expect(@provider.git_gem_version).to be_nil
+ end
+
+ it "determines single branch option when it fails to parse git version" do
+ expect(@provider).to receive(:shell_out!)
+ .with("git --version", log_tag: "git[web2.0 app]")
+ .and_return(double("ShellOut result", stdout: "git version home-grown-git-99"))
+ expect(@provider.git_has_single_branch_option?).to be false
+ end
+
+ it "determines single branch option as true when it parses git version and version is large" do
+ expect(@provider).to receive(:shell_out!)
+ .with("git --version", log_tag: "git[web2.0 app]")
+ .and_return(double("ShellOut result", stdout: "git version 1.8.0"))
+ expect(@provider.git_has_single_branch_option?).to be true
+ end
+
+ it "determines single branch option as false when it parses git version and version is small" do
+ expect(@provider).to receive(:shell_out!)
+ .with("git --version", log_tag: "git[web2.0 app]")
+ .and_return(double("ShellOut result", stdout: "git version 1.7.4"))
+ expect(@provider.git_has_single_branch_option?).to be false
+ end
+
+ it "is compatible with git in travis" do
+ expect(@provider.git_gem_version).to be > Gem::Version.new("1.0")
+ end
+ end
+
context "resolving revisions to a SHA" do
before do
diff --git a/spec/unit/provider/ifconfig/redhat_spec.rb b/spec/unit/provider/ifconfig/redhat_spec.rb
index 2111de02fb..d81f963450 100644
--- a/spec/unit/provider/ifconfig/redhat_spec.rb
+++ b/spec/unit/provider/ifconfig/redhat_spec.rb
@@ -31,6 +31,10 @@ describe Chef::Provider::Ifconfig::Redhat do
@new_resource.metric "1"
@new_resource.mtu "1500"
@new_resource.device "eth0"
+ @new_resource.ethtool_opts "-A eth0 autoneg off"
+ @new_resource.bonding_opts "mode=active-backup miimon=100"
+ @new_resource.master "bond0"
+ @new_resource.slave "yes"
@provider = Chef::Provider::Ifconfig::Redhat.new(@new_resource, @run_context)
@current_resource = Chef::Resource::Ifconfig.new("10.0.0.1", @run_context)
@@ -52,6 +56,10 @@ describe Chef::Provider::Ifconfig::Redhat do
expect(arg).to match(/^\s*DEVICE=eth0\s*$/)
expect(arg).to match(/^\s*IPADDR=10\.0\.0\.1\s*$/)
expect(arg).to match(/^\s*NETMASK=255\.255\.254\.0\s*$/)
+ expect(arg).to match(/^\s*ETHTOOL_OPTS="-A eth0 autoneg off"\s*$/)
+ expect(arg).to match(/^\s*BONDING_OPTS="mode=active-backup miimon=100"\s*$/)
+ expect(arg).to match(/^\s*MASTER=bond0\s*$/)
+ expect(arg).to match(/^\s*SLAVE=yes\s*$/)
end
expect(@config).to receive(:run_action).with(:create)
expect(@config).to receive(:updated?).and_return(true)
diff --git a/spec/unit/provider/package/rubygems_spec.rb b/spec/unit/provider/package/rubygems_spec.rb
index 9f19e3602f..856f8d460c 100644
--- a/spec/unit/provider/package/rubygems_spec.rb
+++ b/spec/unit/provider/package/rubygems_spec.rb
@@ -539,7 +539,7 @@ describe Chef::Provider::Package::Rubygems do
end
end
- context "when the source is from the rubygems_uri" do
+ context "when the source is from the rubygems_url" do
it "determines the candidate version by querying the remote gem servers" do
Chef::Config[:rubygems_url] = "https://mirror1/"
expect(provider.gem_env).to receive(:candidate_version_from_remote)
diff --git a/spec/unit/provider/package/windows/registry_uninstall_entry_spec.rb b/spec/unit/provider/package/windows/registry_uninstall_entry_spec.rb
index d9339861a4..803f3271df 100644
--- a/spec/unit/provider/package/windows/registry_uninstall_entry_spec.rb
+++ b/spec/unit/provider/package/windows/registry_uninstall_entry_spec.rb
@@ -9,7 +9,7 @@ describe Chef::Provider::Package::Windows::RegistryUninstallEntry do
describe "when QuietUninstallString key not present" do
let(:quiet_uninstall_string) { nil }
let (:quiet_uninstall_string_key) { Chef::Provider::Package::Windows::RegistryUninstallEntry.quiet_uninstall_string_key?(quiet_uninstall_string, hkey, key, entry).uninstall_string }
- it "should return UninstallString key value" do
+ it "returns UninstallString key value" do
expect(quiet_uninstall_string_key).to eql "UninstallStringPath"
end
end
@@ -17,9 +17,62 @@ describe Chef::Provider::Package::Windows::RegistryUninstallEntry do
describe "when QuietUninstallString key present" do
let(:quiet_uninstall_string) { "QuietUninstallString" }
let (:quiet_uninstall_string_key) { Chef::Provider::Package::Windows::RegistryUninstallEntry.quiet_uninstall_string_key?(quiet_uninstall_string, hkey, key, entry).uninstall_string }
-
- it "should return QuietUninstallString key value" do
+ it "returns QuietUninstallString key value" do
expect(quiet_uninstall_string_key).to eql "QuietUninstallStringPath"
end
end
+
+ describe ".find_entries", :windows_only do
+ let (:registry_uninstall_entry) { Chef::Provider::Package::Windows::RegistryUninstallEntry }
+ before(:each) do
+ allow_any_instance_of(::Win32::Registry).to receive(:open).and_return("::Win32::Registry::HKEY_CURRENT_USER")
+ end
+
+ context "when passing nil" do
+ let(:package_name) { nil }
+ it "returns empty entries array" do
+ allow(Chef::Provider::Package::Windows::RegistryUninstallEntry).to receive(:read_registry_property).and_return(nil)
+ entries = Chef::Provider::Package::Windows::RegistryUninstallEntry.find_entries(package_name)
+ expect(entries.size).to eql 0
+ end
+ end
+
+ context "when passing empty string" do
+ let(:package_name) { " " }
+ it "returns no entries" do
+ allow(Chef::Provider::Package::Windows::RegistryUninstallEntry).to receive(:read_registry_property).and_return(nil)
+ entries = Chef::Provider::Package::Windows::RegistryUninstallEntry.find_entries(package_name)
+ expect(entries.size).to eql 0
+ end
+ end
+
+ context "when package is not found" do
+ let(:package_name) { "hive" }
+ it "returns no entries" do
+ allow(Chef::Provider::Package::Windows::RegistryUninstallEntry).to receive(:read_registry_property).and_return("Chef Client")
+ entries = Chef::Provider::Package::Windows::RegistryUninstallEntry.find_entries(package_name)
+ expect(entries).to eql []
+ end
+ end
+
+ context "when trailing spaces are given in display name" do
+ let(:package_name) { "Chef" }
+ let(:display_name_with_space) { "Chef " }
+ it "removes the trailing spaces" do
+ allow(Chef::Provider::Package::Windows::RegistryUninstallEntry).to receive(:read_registry_property).and_return(display_name_with_space)
+ entries = registry_uninstall_entry.find_entries(package_name).first
+ expect(entries.display_name.rstrip).to eql package_name
+ end
+ end
+
+ context "When package found successfully" do
+ let(:package_name) { "Chef Client" }
+ let(:display_name) { "Chef Client" }
+ it "returns 'Chef Client' entries" do
+ allow(Chef::Provider::Package::Windows::RegistryUninstallEntry).to receive(:read_registry_property).and_return(display_name)
+ entries = registry_uninstall_entry.find_entries(package_name).first
+ expect(entries.display_name.rstrip).to eql package_name
+ end
+ end
+ end
end
diff --git a/spec/unit/provider/package/windows_spec.rb b/spec/unit/provider/package/windows_spec.rb
index 4b258a078f..d07e68cb5b 100644
--- a/spec/unit/provider/package/windows_spec.rb
+++ b/spec/unit/provider/package/windows_spec.rb
@@ -224,7 +224,7 @@ describe Chef::Provider::Package::Windows, :windows_only do
end
end
- context "eninstall entries is empty" do
+ context "uninstall entries is empty" do
before { allow(Chef::Provider::Package::Windows::RegistryUninstallEntry).to receive(:find_entries).and_return([]) }
it "returns nil" do
diff --git a/spec/unit/provider/package/zypper_spec.rb b/spec/unit/provider/package/zypper_spec.rb
index f3c31dc730..b20a548c73 100644
--- a/spec/unit/provider/package/zypper_spec.rb
+++ b/spec/unit/provider/package/zypper_spec.rb
@@ -139,6 +139,14 @@ describe Chef::Provider::Package::Zypper do
)
provider.install_package(["emacs"], ["1.0"])
end
+
+ it "should add user provided options to the command" do
+ new_resource.options "--user-provided"
+ shell_out_expectation!(
+ "zypper", "--non-interactive", "install", "--user-provided", "--auto-agree-with-licenses", "emacs=1.0"
+ )
+ provider.install_package(["emacs"], ["1.0"])
+ end
end
describe "upgrade_package" do
@@ -162,6 +170,13 @@ describe Chef::Provider::Package::Zypper do
)
provider.upgrade_package(["emacs"], ["1.0"])
end
+ it "should add user provided options to the command" do
+ new_resource.options "--user-provided"
+ shell_out_expectation!(
+ "zypper", "--non-interactive", "install", "--user-provided", "--auto-agree-with-licenses", "emacs=1.0"
+ )
+ provider.upgrade_package(["emacs"], ["1.0"])
+ end
end
describe "remove_package" do
@@ -196,6 +211,13 @@ describe Chef::Provider::Package::Zypper do
)
provider.remove_package(["emacs"], ["1.0"])
end
+ it "should add user provided options to the command" do
+ new_resource.options "--user-provided"
+ shell_out_expectation!(
+ "zypper", "--non-interactive", "remove", "--user-provided", "emacs=1.0"
+ )
+ provider.remove_package(["emacs"], ["1.0"])
+ end
end
end
@@ -220,6 +242,13 @@ describe Chef::Provider::Package::Zypper do
)
provider.purge_package(["emacs"], ["1.0"])
end
+ it "should add user provided options to the command" do
+ new_resource.options "--user-provided"
+ shell_out_expectation!(
+ "zypper", "--non-interactive", "remove", "--user-provided", "--clean-deps", "emacs=1.0"
+ )
+ provider.purge_package(["emacs"], ["1.0"])
+ end
end
describe "lock_package" do
@@ -236,6 +265,13 @@ describe Chef::Provider::Package::Zypper do
)
provider.lock_package(["emacs"], [nil])
end
+ it "should add user provided options to the command" do
+ new_resource.options "--user-provided"
+ shell_out_expectation!(
+ "zypper", "--non-interactive", "addlock", "--user-provided", "emacs"
+ )
+ provider.lock_package(["emacs"], [nil])
+ end
end
describe "unlock_package" do
@@ -252,6 +288,13 @@ describe Chef::Provider::Package::Zypper do
)
provider.unlock_package(["emacs"], [nil])
end
+ it "should add user provided options to the command" do
+ new_resource.options "--user-provided"
+ shell_out_expectation!(
+ "zypper", "--non-interactive", "removelock", "--user-provided", "emacs"
+ )
+ provider.unlock_package(["emacs"], [nil])
+ end
end
describe "on an older zypper" do
diff --git a/spec/unit/provider/remote_file/fetcher_spec.rb b/spec/unit/provider/remote_file/fetcher_spec.rb
index 0fa213cdb2..f5b32800f2 100644
--- a/spec/unit/provider/remote_file/fetcher_spec.rb
+++ b/spec/unit/provider/remote_file/fetcher_spec.rb
@@ -27,6 +27,7 @@ describe Chef::Provider::RemoteFile::Fetcher do
describe "when passed a network share" do
before do
expect(Chef::Provider::RemoteFile::NetworkFile).to receive(:new).and_return(fetcher_instance)
+ allow(Chef::Platform).to receive(:windows?).and_return(true)
end
context "when host is a name" do
diff --git a/spec/unit/provider/remote_file/network_file_spec.rb b/spec/unit/provider/remote_file/network_file_spec.rb
index de065c83e2..621d2769a4 100644
--- a/spec/unit/provider/remote_file/network_file_spec.rb
+++ b/spec/unit/provider/remote_file/network_file_spec.rb
@@ -1,3 +1,4 @@
+
#
# Author:: Jay Mundrawala (<jdm@chef.io>)
# Copyright:: Copyright 2015-2016, Chef Software
@@ -19,7 +20,6 @@
require "spec_helper"
describe Chef::Provider::RemoteFile::NetworkFile do
-
let(:source) { "\\\\foohost\\fooshare\\Foo.tar.gz" }
let(:new_resource) { Chef::Resource::RemoteFile.new("network file (new_resource)") }
@@ -30,10 +30,15 @@ describe Chef::Provider::RemoteFile::NetworkFile do
let(:tempfile) { double("Tempfile", :path => "/tmp/foo/bar/Foo.tar.gz", :close => nil) }
let(:chef_tempfile) { double("Chef::FileContentManagement::Tempfile", :tempfile => tempfile) }
+ let(:source_file) { double("::File", :read => nil) }
+
+ before do
+ allow(fetcher).to receive(:node).and_return({ "platform_family" => "windows" })
+ end
it "stages the local file to a temporary file" do
expect(Chef::FileContentManagement::Tempfile).to receive(:new).with(new_resource).and_return(chef_tempfile)
- expect(::FileUtils).to receive(:cp).with(source, tempfile.path)
+ expect(::File).to receive(:open).with(source, "rb").and_return(source_file)
expect(tempfile).to receive(:close)
result = fetcher.fetch
diff --git a/spec/unit/provider/route_spec.rb b/spec/unit/provider/route_spec.rb
index 2beb765259..5e655bda0c 100644
--- a/spec/unit/provider/route_spec.rb
+++ b/spec/unit/provider/route_spec.rb
@@ -29,9 +29,14 @@ describe Chef::Provider::Route do
@new_resource.gateway "10.0.0.9"
@current_resource = Chef::Resource::Route.new("10.0.0.10")
@current_resource.gateway "10.0.0.9"
+ @default_resource = Chef::Resource::Route.new("default")
+ @default_resource.gateway "10.0.0.9"
@provider = Chef::Provider::Route.new(@new_resource, @run_context)
@provider.current_resource = @current_resource
+
+ @default_provider = Chef::Provider::Route.new(@default_resource, @run_context)
+ @default_provider.current_resource = @default_resource
end
describe Chef::Provider::Route, "hex2ip" do
@@ -161,6 +166,11 @@ describe Chef::Provider::Route do
@new_resource.gateway(nil)
expect(@provider.generate_command(:add).join(" ")).not_to match(/\svia\s#{Regexp.escape(@new_resource.gateway.to_s)}/)
end
+
+ it "should use the gatway when target is default" do
+ @default_resource.gateway("10.0.0.10")
+ expect(@default_provider.generate_command(:add).join(" ")).to match(/10.0.0.10/)
+ end
end
describe Chef::Provider::Route, "generate_command for action_delete" do
@@ -216,10 +226,20 @@ describe Chef::Provider::Route do
route_file = StringIO.new
expect(File).to receive(:new).with("/etc/sysconfig/network-scripts/route-eth0", "w").and_return(route_file)
- # Chef::Log.should_receive(:debug).with("route[10.0.0.10] writing route.eth0\n10.0.0.10 via 10.0.0.9\n")
@run_context.resource_collection << @new_resource
@provider.generate_config
end
+
+ end
+ %w{ centos redhat fedora }.each do |platform|
+ it "should write a default route file on #{platform} platform" do
+ @node.automatic_attrs[:platform] = platform
+
+ route_file = StringIO.new
+ expect(File).to receive(:new).with("/etc/sysconfig/network", "w").and_return(route_file)
+ @run_context.resource_collection << @default_resource
+ @default_provider.generate_config
+ end
end
it "should put all routes for a device in a route config file" do
diff --git a/spec/unit/provider/service/macosx_spec.rb b/spec/unit/provider/service/macosx_spec.rb
index c9dd629187..704c7a802e 100644
--- a/spec/unit/provider/service/macosx_spec.rb
+++ b/spec/unit/provider/service/macosx_spec.rb
@@ -74,7 +74,10 @@ XML
let(:service_label) { "io.redis.redis-server" }
before do
allow(Dir).to receive(:glob).and_return([plist], [])
- allow(Etc).to receive(:getlogin).and_return("igor")
+ @stat = double("File::Stat", { :uid => 501 })
+ allow(File).to receive(:stat).and_return(@stat)
+ @getpwuid = double("Etc::Passwd", { :name => "mikedodge04" })
+ allow(Etc).to receive(:getpwuid).and_return(@getpwuid)
allow(node).to receive(:[]).with("platform_version").and_return(platform_version)
cmd = "launchctl list #{service_label}"
allow(provider).to receive(:shell_out_with_systems_locale).
diff --git a/spec/unit/provider/service/systemd_service_spec.rb b/spec/unit/provider/service/systemd_service_spec.rb
index 4e25f499f6..cbd8e88022 100644
--- a/spec/unit/provider/service/systemd_service_spec.rb
+++ b/spec/unit/provider/service/systemd_service_spec.rb
@@ -36,7 +36,9 @@ describe Chef::Provider::Service::Systemd do
let(:run_context) { Chef::RunContext.new(node, {}, events) }
- let(:service_name) { "rsyslog.service" }
+ let(:service_name) { "rsyslog\\x2d.service" }
+
+ let(:service_name_escaped) { "rsyslog\\\\x2d.service" }
let(:new_resource) { Chef::Resource::Service.new(service_name) }
@@ -182,13 +184,13 @@ describe Chef::Provider::Service::Systemd do
context "when a user is not specified" do
it "should call '#{systemctl_path} --system start service_name' if no start command is specified" do
- expect(provider).to receive(:shell_out_with_systems_locale!).with("#{systemctl_path} --system start #{service_name}", {}).and_return(shell_out_success)
+ expect(provider).to receive(:shell_out_with_systems_locale!).with("#{systemctl_path} --system start #{service_name_escaped}", {}).and_return(shell_out_success)
provider.start_service
end
it "should not call '#{systemctl_path} --system start service_name' if it is already running" do
current_resource.running(true)
- expect(provider).not_to receive(:shell_out_with_systems_locale!).with("#{systemctl_path} --system start #{service_name}", {})
+ expect(provider).not_to receive(:shell_out_with_systems_locale!).with("#{systemctl_path} --system start #{service_name_escaped}", {})
provider.start_service
end
end
@@ -196,14 +198,14 @@ describe Chef::Provider::Service::Systemd do
context "when a user is specified" do
it "should call '#{systemctl_path} --user start service_name' if no start command is specified" do
current_resource.user("joe")
- expect(provider).to receive(:shell_out_with_systems_locale!).with("#{systemctl_path} --user start #{service_name}", { :environment => { "DBUS_SESSION_BUS_ADDRESS" => "unix:path=/run/user/10000/bus" }, :user => "joe" }).and_return(shell_out_success)
+ expect(provider).to receive(:shell_out_with_systems_locale!).with("#{systemctl_path} --user start #{service_name_escaped}", { :environment => { "DBUS_SESSION_BUS_ADDRESS" => "unix:path=/run/user/10000/bus" }, :user => "joe" }).and_return(shell_out_success)
provider.start_service
end
it "should not call '#{systemctl_path} --user start service_name' if it is already running" do
current_resource.running(true)
current_resource.user("joe")
- expect(provider).not_to receive(:shell_out_with_systems_locale!).with("#{systemctl_path} --user start #{service_name}", { :environment => { "DBUS_SESSION_BUS_ADDRESS" => "unix:path=/run/user/10000/bus" }, :user => "joe" })
+ expect(provider).not_to receive(:shell_out_with_systems_locale!).with("#{systemctl_path} --user start #{service_name_escaped}", { :environment => { "DBUS_SESSION_BUS_ADDRESS" => "unix:path=/run/user/10000/bus" }, :user => "joe" })
provider.start_service
end
end
@@ -217,7 +219,7 @@ describe Chef::Provider::Service::Systemd do
it "should call '#{systemctl_path} --system restart service_name' if no restart command is specified" do
current_resource.running(true)
- expect(provider).to receive(:shell_out_with_systems_locale!).with("#{systemctl_path} --system restart #{service_name}", {}).and_return(shell_out_success)
+ expect(provider).to receive(:shell_out_with_systems_locale!).with("#{systemctl_path} --system restart #{service_name_escaped}", {}).and_return(shell_out_success)
provider.restart_service
end
@@ -234,7 +236,7 @@ describe Chef::Provider::Service::Systemd do
context "when a reload command is not specified" do
it "should call '#{systemctl_path} --system reload service_name' if the service is running" do
current_resource.running(true)
- expect(provider).to receive(:shell_out_with_systems_locale!).with("#{systemctl_path} --system reload #{service_name}", {}).and_return(shell_out_success)
+ expect(provider).to receive(:shell_out_with_systems_locale!).with("#{systemctl_path} --system reload #{service_name_escaped}", {}).and_return(shell_out_success)
provider.reload_service
end
@@ -255,13 +257,13 @@ describe Chef::Provider::Service::Systemd do
it "should call '#{systemctl_path} --system stop service_name' if no stop command is specified" do
current_resource.running(true)
- expect(provider).to receive(:shell_out_with_systems_locale!).with("#{systemctl_path} --system stop #{service_name}", {}).and_return(shell_out_success)
+ expect(provider).to receive(:shell_out_with_systems_locale!).with("#{systemctl_path} --system stop #{service_name_escaped}", {}).and_return(shell_out_success)
provider.stop_service
end
it "should not call '#{systemctl_path} --system stop service_name' if it is already stopped" do
current_resource.running(false)
- expect(provider).not_to receive(:shell_out_with_systems_locale!).with("#{systemctl_path} --system stop #{service_name}", {})
+ expect(provider).not_to receive(:shell_out_with_systems_locale!).with("#{systemctl_path} --system stop #{service_name_escaped}", {})
provider.stop_service
end
end
@@ -274,12 +276,12 @@ describe Chef::Provider::Service::Systemd do
end
it "should call '#{systemctl_path} --system enable service_name' to enable the service" do
- expect(provider).to receive(:shell_out!).with("#{systemctl_path} --system enable #{service_name}", {}).and_return(shell_out_success)
+ expect(provider).to receive(:shell_out!).with("#{systemctl_path} --system enable #{service_name_escaped}", {}).and_return(shell_out_success)
provider.enable_service
end
it "should call '#{systemctl_path} --system disable service_name' to disable the service" do
- expect(provider).to receive(:shell_out!).with("#{systemctl_path} --system disable #{service_name}", {}).and_return(shell_out_success)
+ expect(provider).to receive(:shell_out!).with("#{systemctl_path} --system disable #{service_name_escaped}", {}).and_return(shell_out_success)
provider.disable_service
end
end
@@ -292,12 +294,12 @@ describe Chef::Provider::Service::Systemd do
end
it "should call '#{systemctl_path} --system mask service_name' to mask the service" do
- expect(provider).to receive(:shell_out!).with("#{systemctl_path} --system mask #{service_name}", {}).and_return(shell_out_success)
+ expect(provider).to receive(:shell_out!).with("#{systemctl_path} --system mask #{service_name_escaped}", {}).and_return(shell_out_success)
provider.mask_service
end
it "should call '#{systemctl_path} --system unmask service_name' to unmask the service" do
- expect(provider).to receive(:shell_out!).with("#{systemctl_path} --system unmask #{service_name}", {}).and_return(shell_out_success)
+ expect(provider).to receive(:shell_out!).with("#{systemctl_path} --system unmask #{service_name_escaped}", {}).and_return(shell_out_success)
provider.unmask_service
end
end
@@ -310,12 +312,12 @@ describe Chef::Provider::Service::Systemd do
end
it "should return true if '#{systemctl_path} --system is-active service_name' returns 0" do
- expect(provider).to receive(:shell_out).with("#{systemctl_path} --system is-active #{service_name} --quiet", {}).and_return(shell_out_success)
+ expect(provider).to receive(:shell_out).with("#{systemctl_path} --system is-active #{service_name_escaped} --quiet", {}).and_return(shell_out_success)
expect(provider.is_active?).to be true
end
it "should return false if '#{systemctl_path} --system is-active service_name' returns anything except 0" do
- expect(provider).to receive(:shell_out).with("#{systemctl_path} --system is-active #{service_name} --quiet", {}).and_return(shell_out_failure)
+ expect(provider).to receive(:shell_out).with("#{systemctl_path} --system is-active #{service_name_escaped} --quiet", {}).and_return(shell_out_failure)
expect(provider.is_active?).to be false
end
end
@@ -328,12 +330,12 @@ describe Chef::Provider::Service::Systemd do
end
it "should return true if '#{systemctl_path} --system is-enabled service_name' returns 0" do
- expect(provider).to receive(:shell_out).with("#{systemctl_path} --system is-enabled #{service_name} --quiet", {}).and_return(shell_out_success)
+ expect(provider).to receive(:shell_out).with("#{systemctl_path} --system is-enabled #{service_name_escaped} --quiet", {}).and_return(shell_out_success)
expect(provider.is_enabled?).to be true
end
it "should return false if '#{systemctl_path} --system is-enabled service_name' returns anything except 0" do
- expect(provider).to receive(:shell_out).with("#{systemctl_path} --system is-enabled #{service_name} --quiet", {}).and_return(shell_out_failure)
+ expect(provider).to receive(:shell_out).with("#{systemctl_path} --system is-enabled #{service_name_escaped} --quiet", {}).and_return(shell_out_failure)
expect(provider.is_enabled?).to be false
end
end
@@ -346,22 +348,22 @@ describe Chef::Provider::Service::Systemd do
end
it "should return true if '#{systemctl_path} --system is-enabled service_name' returns 'masked' and returns anything except 0" do
- expect(provider).to receive(:shell_out).with("#{systemctl_path} --system is-enabled #{service_name}", {}).and_return(double(:stdout => "masked", :exitstatus => shell_out_failure))
+ expect(provider).to receive(:shell_out).with("#{systemctl_path} --system is-enabled #{service_name_escaped}", {}).and_return(double(:stdout => "masked", :exitstatus => shell_out_failure))
expect(provider.is_masked?).to be true
end
it "should return true if '#{systemctl_path} --system is-enabled service_name' outputs 'masked-runtime' and returns anything except 0" do
- expect(provider).to receive(:shell_out).with("#{systemctl_path} --system is-enabled #{service_name}", {}).and_return(double(:stdout => "masked-runtime", :exitstatus => shell_out_failure))
+ expect(provider).to receive(:shell_out).with("#{systemctl_path} --system is-enabled #{service_name_escaped}", {}).and_return(double(:stdout => "masked-runtime", :exitstatus => shell_out_failure))
expect(provider.is_masked?).to be true
end
it "should return false if '#{systemctl_path} --system is-enabled service_name' returns 0" do
- expect(provider).to receive(:shell_out).with("#{systemctl_path} --system is-enabled #{service_name}", {}).and_return(double(:stdout => "enabled", :exitstatus => shell_out_success))
+ expect(provider).to receive(:shell_out).with("#{systemctl_path} --system is-enabled #{service_name_escaped}", {}).and_return(double(:stdout => "enabled", :exitstatus => shell_out_success))
expect(provider.is_masked?).to be false
end
it "should return false if '#{systemctl_path} --system is-enabled service_name' returns anything except 0 and outputs an error'" do
- expect(provider).to receive(:shell_out).with("#{systemctl_path} --system is-enabled #{service_name}", {}).and_return(double(:stdout => "Failed to get unit file state for #{service_name}: No such file or directory", :exitstatus => shell_out_failure))
+ expect(provider).to receive(:shell_out).with("#{systemctl_path} --system is-enabled #{service_name_escaped}", {}).and_return(double(:stdout => "Failed to get unit file state for #{service_name}: No such file or directory", :exitstatus => shell_out_failure))
expect(provider.is_masked?).to be false
end
end
diff --git a/spec/unit/provider/systemd_unit_spec.rb b/spec/unit/provider/systemd_unit_spec.rb
index 7f2907c982..6909c9d86b 100644
--- a/spec/unit/provider/systemd_unit_spec.rb
+++ b/spec/unit/provider/systemd_unit_spec.rb
@@ -32,13 +32,14 @@ describe Chef::Provider::SystemdUnit do
let(:events) { Chef::EventDispatch::Dispatcher.new }
let(:run_context) { Chef::RunContext.new(node, {}, events) }
- let(:unit_name) { "sysstat-collect.timer" }
+ let(:unit_name) { "sysstat-collect\\x2d.timer" }
+ let(:unit_name_escaped) { "sysstat-collect\\\\x2d.timer" }
let(:user_name) { "joe" }
let(:current_resource) { Chef::Resource::SystemdUnit.new(unit_name) }
let(:new_resource) { Chef::Resource::SystemdUnit.new(unit_name) }
let(:provider) { Chef::Provider::SystemdUnit.new(new_resource, run_context) }
- let(:unit_path_system) { "/etc/systemd/system/sysstat-collect.timer" }
- let(:unit_path_user) { "/etc/systemd/user/sysstat-collect.timer" }
+ let(:unit_path_system) { "/etc/systemd/system/sysstat-collect\\x2d.timer" }
+ let(:unit_path_user) { "/etc/systemd/user/sysstat-collect\\x2d.timer" }
let(:unit_content_string) { "[Unit]\nDescription = Run system activity accounting tool every 10 minutes\n\n[Timer]\nOnCalendar = *:00/10\n\n[Install]\nWantedBy = sysstat.service\n" }
let(:malformed_content_string) { "derp" }
@@ -384,7 +385,7 @@ describe Chef::Provider::SystemdUnit do
current_resource.user(user_name)
current_resource.enabled(false)
expect(provider).to receive(:shell_out_with_systems_locale!)
- .with("#{systemctl_path} --user enable #{unit_name}", user_cmd_opts)
+ .with("#{systemctl_path} --user enable #{unit_name_escaped}", user_cmd_opts)
.and_return(shell_out_success)
provider.action_enable
end
@@ -407,7 +408,7 @@ describe Chef::Provider::SystemdUnit do
current_resource.user(user_name)
current_resource.enabled(true)
expect(provider).to receive(:shell_out_with_systems_locale!)
- .with("#{systemctl_path} --user disable #{unit_name}", user_cmd_opts)
+ .with("#{systemctl_path} --user disable #{unit_name_escaped}", user_cmd_opts)
.and_return(shell_out_success)
provider.action_disable
end
@@ -431,7 +432,7 @@ describe Chef::Provider::SystemdUnit do
it "enables the unit when it is disabled" do
current_resource.enabled(false)
expect(provider).to receive(:shell_out_with_systems_locale!)
- .with("#{systemctl_path} --system enable #{unit_name}", {})
+ .with("#{systemctl_path} --system enable #{unit_name_escaped}", {})
.and_return(shell_out_success)
provider.action_enable
end
@@ -451,7 +452,7 @@ describe Chef::Provider::SystemdUnit do
it "disables the unit when it is enabled" do
current_resource.enabled(true)
expect(provider).to receive(:shell_out_with_systems_locale!)
- .with("#{systemctl_path} --system disable #{unit_name}", {})
+ .with("#{systemctl_path} --system disable #{unit_name_escaped}", {})
.and_return(shell_out_success)
provider.action_disable
end
@@ -477,7 +478,7 @@ describe Chef::Provider::SystemdUnit do
current_resource.user(user_name)
current_resource.masked(false)
expect(provider).to receive(:shell_out_with_systems_locale!)
- .with("#{systemctl_path} --user mask #{unit_name}", user_cmd_opts)
+ .with("#{systemctl_path} --user mask #{unit_name_escaped}", user_cmd_opts)
.and_return(shell_out_success)
provider.action_mask
end
@@ -493,7 +494,7 @@ describe Chef::Provider::SystemdUnit do
current_resource.user(user_name)
current_resource.masked(true)
expect(provider).to receive(:shell_out_with_systems_locale!)
- .with("#{systemctl_path} --user unmask #{unit_name}", user_cmd_opts)
+ .with("#{systemctl_path} --user unmask #{unit_name_escaped}", user_cmd_opts)
.and_return(shell_out_success)
provider.action_unmask
end
@@ -510,7 +511,7 @@ describe Chef::Provider::SystemdUnit do
it "masks the unit when it is unmasked" do
current_resource.masked(false)
expect(provider).to receive(:shell_out_with_systems_locale!)
- .with("#{systemctl_path} --system mask #{unit_name}", {})
+ .with("#{systemctl_path} --system mask #{unit_name_escaped}", {})
.and_return(shell_out_success)
provider.action_mask
end
@@ -524,7 +525,7 @@ describe Chef::Provider::SystemdUnit do
it "unmasks the unit when it is masked" do
current_resource.masked(true)
expect(provider).to receive(:shell_out_with_systems_locale!)
- .with("#{systemctl_path} --system unmask #{unit_name}", {})
+ .with("#{systemctl_path} --system unmask #{unit_name_escaped}", {})
.and_return(shell_out_success)
provider.action_unmask
end
@@ -543,7 +544,7 @@ describe Chef::Provider::SystemdUnit do
current_resource.user(user_name)
current_resource.active(false)
expect(provider).to receive(:shell_out_with_systems_locale!)
- .with("#{systemctl_path} --user start #{unit_name}", user_cmd_opts)
+ .with("#{systemctl_path} --user start #{unit_name_escaped}", user_cmd_opts)
.and_return(shell_out_success)
provider.action_start
end
@@ -559,7 +560,7 @@ describe Chef::Provider::SystemdUnit do
current_resource.user(user_name)
current_resource.active(true)
expect(provider).to receive(:shell_out_with_systems_locale!)
- .with("#{systemctl_path} --user stop #{unit_name}", user_cmd_opts)
+ .with("#{systemctl_path} --user stop #{unit_name_escaped}", user_cmd_opts)
.and_return(shell_out_success)
provider.action_stop
end
@@ -576,7 +577,7 @@ describe Chef::Provider::SystemdUnit do
it "starts the unit when it is inactive" do
current_resource.active(false)
expect(provider).to receive(:shell_out_with_systems_locale!)
- .with("#{systemctl_path} --system start #{unit_name}", {})
+ .with("#{systemctl_path} --system start #{unit_name_escaped}", {})
.and_return(shell_out_success)
provider.action_start
end
@@ -590,7 +591,7 @@ describe Chef::Provider::SystemdUnit do
it "stops the unit when it is active" do
current_resource.active(true)
expect(provider).to receive(:shell_out_with_systems_locale!)
- .with("#{systemctl_path} --system stop #{unit_name}", {})
+ .with("#{systemctl_path} --system stop #{unit_name_escaped}", {})
.and_return(shell_out_success)
provider.action_stop
end
@@ -608,7 +609,7 @@ describe Chef::Provider::SystemdUnit do
it "restarts the unit" do
current_resource.user(user_name)
expect(provider).to receive(:shell_out_with_systems_locale!)
- .with("#{systemctl_path} --user restart #{unit_name}", user_cmd_opts)
+ .with("#{systemctl_path} --user restart #{unit_name_escaped}", user_cmd_opts)
.and_return(shell_out_success)
provider.action_restart
end
@@ -617,7 +618,7 @@ describe Chef::Provider::SystemdUnit do
current_resource.user(user_name)
current_resource.active(true)
expect(provider).to receive(:shell_out_with_systems_locale!)
- .with("#{systemctl_path} --user reload #{unit_name}", user_cmd_opts)
+ .with("#{systemctl_path} --user reload #{unit_name_escaped}", user_cmd_opts)
.and_return(shell_out_success)
provider.action_reload
end
@@ -633,7 +634,7 @@ describe Chef::Provider::SystemdUnit do
context "when no user is specified" do
it "restarts the unit" do
expect(provider).to receive(:shell_out_with_systems_locale!)
- .with("#{systemctl_path} --system restart #{unit_name}", {})
+ .with("#{systemctl_path} --system restart #{unit_name_escaped}", {})
.and_return(shell_out_success)
provider.action_restart
end
@@ -641,7 +642,7 @@ describe Chef::Provider::SystemdUnit do
it "reloads the unit if active" do
current_resource.active(true)
expect(provider).to receive(:shell_out_with_systems_locale!)
- .with("#{systemctl_path} --system reload #{unit_name}", {})
+ .with("#{systemctl_path} --system reload #{unit_name_escaped}", {})
.and_return(shell_out_success)
provider.action_reload
end
@@ -659,7 +660,7 @@ describe Chef::Provider::SystemdUnit do
it "try-restarts the unit" do
current_resource.user(user_name)
expect(provider).to receive(:shell_out_with_systems_locale!)
- .with("#{systemctl_path} --user try-restart #{unit_name}", user_cmd_opts)
+ .with("#{systemctl_path} --user try-restart #{unit_name_escaped}", user_cmd_opts)
.and_return(shell_out_success)
provider.action_try_restart
end
@@ -668,7 +669,7 @@ describe Chef::Provider::SystemdUnit do
context "when no user is specified" do
it "try-restarts the unit" do
expect(provider).to receive(:shell_out_with_systems_locale!)
- .with("#{systemctl_path} --system try-restart #{unit_name}", {})
+ .with("#{systemctl_path} --system try-restart #{unit_name_escaped}", {})
.and_return(shell_out_success)
provider.action_try_restart
end
@@ -680,7 +681,7 @@ describe Chef::Provider::SystemdUnit do
it "reload-or-restarts the unit" do
current_resource.user(user_name)
expect(provider).to receive(:shell_out_with_systems_locale!)
- .with("#{systemctl_path} --user reload-or-restart #{unit_name}", user_cmd_opts)
+ .with("#{systemctl_path} --user reload-or-restart #{unit_name_escaped}", user_cmd_opts)
.and_return(shell_out_success)
provider.action_reload_or_restart
end
@@ -689,7 +690,7 @@ describe Chef::Provider::SystemdUnit do
context "when no user is specified" do
it "reload-or-restarts the unit" do
expect(provider).to receive(:shell_out_with_systems_locale!)
- .with("#{systemctl_path} --system reload-or-restart #{unit_name}", {})
+ .with("#{systemctl_path} --system reload-or-restart #{unit_name_escaped}", {})
.and_return(shell_out_success)
provider.action_reload_or_restart
end
@@ -701,7 +702,7 @@ describe Chef::Provider::SystemdUnit do
it "reload-or-try-restarts the unit" do
current_resource.user(user_name)
expect(provider).to receive(:shell_out_with_systems_locale!)
- .with("#{systemctl_path} --user reload-or-try-restart #{unit_name}", user_cmd_opts)
+ .with("#{systemctl_path} --user reload-or-try-restart #{unit_name_escaped}", user_cmd_opts)
.and_return(shell_out_success)
provider.action_reload_or_try_restart
end
@@ -710,7 +711,7 @@ describe Chef::Provider::SystemdUnit do
context "when no user is specified" do
it "reload-or-try-restarts the unit" do
expect(provider).to receive(:shell_out_with_systems_locale!)
- .with("#{systemctl_path} --system reload-or-try-restart #{unit_name}", {})
+ .with("#{systemctl_path} --system reload-or-try-restart #{unit_name_escaped}", {})
.and_return(shell_out_success)
provider.action_reload_or_try_restart
end
@@ -727,7 +728,7 @@ describe Chef::Provider::SystemdUnit do
it "returns true when unit is active" do
current_resource.user(user_name)
expect(provider).to receive(:shell_out)
- .with("#{systemctl_path} --user is-active #{unit_name}", user_cmd_opts)
+ .with("#{systemctl_path} --user is-active #{unit_name_escaped}", user_cmd_opts)
.and_return(shell_out_success)
expect(provider.active?).to be true
end
@@ -735,7 +736,7 @@ describe Chef::Provider::SystemdUnit do
it "returns false when unit is inactive" do
current_resource.user(user_name)
expect(provider).to receive(:shell_out)
- .with("#{systemctl_path} --user is-active #{unit_name}", user_cmd_opts)
+ .with("#{systemctl_path} --user is-active #{unit_name_escaped}", user_cmd_opts)
.and_return(shell_out_failure)
expect(provider.active?).to be false
end
@@ -744,14 +745,14 @@ describe Chef::Provider::SystemdUnit do
context "when no user is specified" do
it "returns true when unit is active" do
expect(provider).to receive(:shell_out)
- .with("#{systemctl_path} --system is-active #{unit_name}", {})
+ .with("#{systemctl_path} --system is-active #{unit_name_escaped}", {})
.and_return(shell_out_success)
expect(provider.active?).to be true
end
it "returns false when unit is not active" do
expect(provider).to receive(:shell_out)
- .with("#{systemctl_path} --system is-active #{unit_name}", {})
+ .with("#{systemctl_path} --system is-active #{unit_name_escaped}", {})
.and_return(shell_out_failure)
expect(provider.active?).to be false
end
@@ -768,7 +769,7 @@ describe Chef::Provider::SystemdUnit do
it "returns true when unit is enabled" do
current_resource.user(user_name)
expect(provider).to receive(:shell_out)
- .with("#{systemctl_path} --user is-enabled #{unit_name}", user_cmd_opts)
+ .with("#{systemctl_path} --user is-enabled #{unit_name_escaped}", user_cmd_opts)
.and_return(shell_out_success)
expect(provider.enabled?).to be true
end
@@ -776,7 +777,7 @@ describe Chef::Provider::SystemdUnit do
it "returns false when unit is not enabled" do
current_resource.user(user_name)
expect(provider).to receive(:shell_out)
- .with("#{systemctl_path} --user is-enabled #{unit_name}", user_cmd_opts)
+ .with("#{systemctl_path} --user is-enabled #{unit_name_escaped}", user_cmd_opts)
.and_return(shell_out_failure)
expect(provider.enabled?).to be false
end
@@ -785,14 +786,14 @@ describe Chef::Provider::SystemdUnit do
context "when no user is specified" do
it "returns true when unit is enabled" do
expect(provider).to receive(:shell_out)
- .with("#{systemctl_path} --system is-enabled #{unit_name}", {})
+ .with("#{systemctl_path} --system is-enabled #{unit_name_escaped}", {})
.and_return(shell_out_success)
expect(provider.enabled?).to be true
end
it "returns false when unit is not enabled" do
expect(provider).to receive(:shell_out)
- .with("#{systemctl_path} --system is-enabled #{unit_name}", {})
+ .with("#{systemctl_path} --system is-enabled #{unit_name_escaped}", {})
.and_return(shell_out_failure)
expect(provider.enabled?).to be false
end
@@ -809,7 +810,7 @@ describe Chef::Provider::SystemdUnit do
it "returns true when the unit is masked" do
current_resource.user(user_name)
expect(provider).to receive(:shell_out)
- .with("#{systemctl_path} --user status #{unit_name}", user_cmd_opts)
+ .with("#{systemctl_path} --user status #{unit_name_escaped}", user_cmd_opts)
.and_return(shell_out_masked)
expect(provider.masked?).to be true
end
@@ -817,7 +818,7 @@ describe Chef::Provider::SystemdUnit do
it "returns false when the unit is not masked" do
current_resource.user(user_name)
expect(provider).to receive(:shell_out)
- .with("#{systemctl_path} --user status #{unit_name}", user_cmd_opts)
+ .with("#{systemctl_path} --user status #{unit_name_escaped}", user_cmd_opts)
.and_return(shell_out_static)
expect(provider.masked?).to be false
end
@@ -826,14 +827,14 @@ describe Chef::Provider::SystemdUnit do
context "when no user is specified" do
it "returns true when the unit is masked" do
expect(provider).to receive(:shell_out)
- .with("#{systemctl_path} --system status #{unit_name}", {})
+ .with("#{systemctl_path} --system status #{unit_name_escaped}", {})
.and_return(shell_out_masked)
expect(provider.masked?).to be true
end
it "returns false when the unit is not masked" do
expect(provider).to receive(:shell_out)
- .with("#{systemctl_path} --system status #{unit_name}", {})
+ .with("#{systemctl_path} --system status #{unit_name_escaped}", {})
.and_return(shell_out_static)
expect(provider.masked?).to be false
end
@@ -850,7 +851,7 @@ describe Chef::Provider::SystemdUnit do
it "returns true when the unit is static" do
current_resource.user(user_name)
expect(provider).to receive(:shell_out)
- .with("#{systemctl_path} --user is-enabled #{unit_name}", user_cmd_opts)
+ .with("#{systemctl_path} --user is-enabled #{unit_name_escaped}", user_cmd_opts)
.and_return(shell_out_static)
expect(provider.static?).to be true
end
@@ -858,7 +859,7 @@ describe Chef::Provider::SystemdUnit do
it "returns false when the unit is not static" do
current_resource.user(user_name)
expect(provider).to receive(:shell_out)
- .with("#{systemctl_path} --user is-enabled #{unit_name}", user_cmd_opts)
+ .with("#{systemctl_path} --user is-enabled #{unit_name_escaped}", user_cmd_opts)
.and_return(shell_out_masked)
expect(provider.static?).to be false
end
@@ -867,14 +868,14 @@ describe Chef::Provider::SystemdUnit do
context "when no user is specified" do
it "returns true when the unit is static" do
expect(provider).to receive(:shell_out)
- .with("#{systemctl_path} --system is-enabled #{unit_name}", {})
+ .with("#{systemctl_path} --system is-enabled #{unit_name_escaped}", {})
.and_return(shell_out_static)
expect(provider.static?).to be true
end
it "returns false when the unit is not static" do
expect(provider).to receive(:shell_out)
- .with("#{systemctl_path} --system is-enabled #{unit_name}", {})
+ .with("#{systemctl_path} --system is-enabled #{unit_name_escaped}", {})
.and_return(shell_out_masked)
expect(provider.static?).to be false
end
diff --git a/spec/unit/provider/windows_path_spec.rb b/spec/unit/provider/windows_path_spec.rb
new file mode 100644
index 0000000000..7eca3f3113
--- /dev/null
+++ b/spec/unit/provider/windows_path_spec.rb
@@ -0,0 +1,65 @@
+#
+# Author:: Nimisha Sharad (<nimisha.sharad@msystechnologies.com>)
+# Copyright:: Copyright 2008-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"
+
+describe Chef::Provider::WindowsPath, :windows_only do
+ before(:all) do
+ @old_path = ENV["PATH"].dup
+ end
+
+ after(:all) do
+ ENV["PATH"] = @old_path
+ end
+
+ let(:new_resource) { Chef::Resource::WindowsPath.new("some_path") }
+
+ let(:provider) do
+ node = Chef::Node.new
+ events = Chef::EventDispatch::Dispatcher.new
+ run_context = Chef::RunContext.new(node, {}, events)
+ Chef::Provider::WindowsPath.new(new_resource, run_context)
+ end
+
+ describe "#load_current_resource" do
+ it "returns a current_resource" do
+ expect(provider.load_current_resource).to be_kind_of(Chef::Resource::WindowsPath)
+ end
+
+ it "sets the path of current resource as the path of new resource" do
+ current_resource = provider.load_current_resource
+ expect(current_resource.path).to eq("some_path")
+ end
+ end
+
+ describe "#action_add" do
+ it "uses env resource to add 'path' environment variable" do
+ allow(provider).to receive(:expand_env_vars)
+ expect(provider).to receive(:declare_resource).with(:env, "path")
+ provider.run_action(:add)
+ end
+ end
+
+ describe "#action_remove" do
+ it "uses env resource to remove 'path' environment variable" do
+ allow(provider).to receive(:expand_env_vars)
+ expect(provider).to receive(:declare_resource).with(:env, "path")
+ provider.run_action(:remove)
+ end
+ end
+end
diff --git a/spec/unit/provider/windows_task_spec.rb b/spec/unit/provider/windows_task_spec.rb
index 80038aa6db..ec66cf2551 100644
--- a/spec/unit/provider/windows_task_spec.rb
+++ b/spec/unit/provider/windows_task_spec.rb
@@ -118,6 +118,7 @@ describe Chef::Provider::WindowsTask do
it "creates the task if it's not already existing" do
allow(provider).to receive(:task_need_update?).and_return(true)
+ allow(provider).to receive(:basic_validation).and_return(true)
expect(provider).to receive(:run_schtasks).with("CREATE", { "F" => "", "SC" => :hourly, "MO" => 1, "TR" => nil, "RU" => "SYSTEM" })
provider.run_action(:create)
expect(new_resource).to be_updated_by_last_action
@@ -126,6 +127,7 @@ describe Chef::Provider::WindowsTask do
it "updates the task XML if random_delay is provided" do
new_resource.random_delay "20"
allow(provider).to receive(:task_need_update?).and_return(true)
+ allow(provider).to receive(:basic_validation).and_return(true)
expect(provider).to receive(:run_schtasks).with("CREATE", { "F" => "", "SC" => :hourly, "MO" => 1, "TR" => nil, "RU" => "SYSTEM" })
expect(provider).to receive(:update_task_xml)
provider.run_action(:create)
@@ -135,6 +137,7 @@ describe Chef::Provider::WindowsTask do
it "updates the task XML if execution_time_limit is provided" do
new_resource.execution_time_limit "20"
allow(provider).to receive(:task_need_update?).and_return(true)
+ allow(provider).to receive(:basic_validation).and_return(true)
expect(provider).to receive(:run_schtasks).with("CREATE", { "F" => "", "SC" => :hourly, "MO" => 1, "TR" => nil, "RU" => "SYSTEM" })
expect(provider).to receive(:update_task_xml)
provider.run_action(:create)
@@ -280,6 +283,29 @@ describe Chef::Provider::WindowsTask do
end
end
+ describe "#basic_validation" do
+ context "when command doesn't exist" do
+ it "raise error" do
+ new_resource.command ""
+ expect { provider.send(:basic_validation) }.to raise_error(Chef::Exceptions::ValidationFailed)
+ end
+ end
+
+ context "when task_name doesn't exist" do
+ let(:new_resource) { Chef::Resource::WindowsTask.new("") }
+ it "raise error" do
+ expect { provider.send(:basic_validation) }.to raise_error(Chef::Exceptions::ValidationFailed)
+ end
+ end
+
+ context "when task_name and command exists" do
+ it "returns true" do
+ new_resource.command "cd ~/"
+ expect(provider.send(:basic_validation)).to be(true)
+ end
+ end
+ end
+
describe "#task_need_update?" do
context "when task doesn't exist" do
before do
@@ -296,6 +322,7 @@ describe Chef::Provider::WindowsTask do
context "when the task exists" do
before do
allow(provider).to receive(:load_task_hash).and_return(task_hash)
+ allow(provider).to receive(:get_system_short_date_format).and_return("MM/dd/yyyy")
provider.load_current_resource
new_resource.command "chef-client"
@@ -304,6 +331,8 @@ describe Chef::Provider::WindowsTask do
new_resource.frequency_modifier 15
new_resource.user "SYSTEM"
new_resource.execution_time_limit "PT72H"
+ new_resource.start_day "30-Mar-2017"
+ new_resource.start_time "13:12"
end
context "when no attributes are modified" do
@@ -325,6 +354,130 @@ describe Chef::Provider::WindowsTask do
expect(provider.send(:task_need_update?)).to be(true)
end
end
+
+ context "when start_day is updated" do
+ it "returns true" do
+ new_resource.start_day "01/01/2000"
+ expect(provider.send(:task_need_update?)).to be(true)
+ end
+ end
+
+ context "when start_time updated" do
+ it "returns true" do
+ new_resource.start_time "01:01"
+ expect(provider.send(:task_need_update?)).to be(true)
+ end
+ end
+ end
+ end
+
+ describe "#start_day_updated?" do
+ before do
+ allow(provider).to receive(:load_task_hash).and_return(task_hash)
+ allow(provider).to receive(:get_system_short_date_format).and_return("MM/dd/yyyy")
+ provider.load_current_resource
+
+ new_resource.command "chef-client"
+ new_resource.run_level :highest
+ new_resource.frequency :minute
+ new_resource.frequency_modifier 15
+ new_resource.user "SYSTEM"
+ new_resource.execution_time_limit "PT72H"
+ new_resource.start_day "30-Mar-2017"
+ new_resource.start_time "13:12"
+ end
+ context "when start_day not changed" do
+ it "returns false" do
+ expect(provider.send(:start_day_updated?)).to be(false)
+ end
+ end
+
+ context "when start_day changed" do
+ it "returns true" do
+ new_resource.start_day "01/01/2000"
+ expect(provider.send(:start_day_updated?)).to be(true)
+ end
+ end
+ end
+
+ describe "#start_time_updated?" do
+ before do
+ allow(provider).to receive(:load_task_hash).and_return(task_hash)
+ provider.load_current_resource
+
+ new_resource.command "chef-client"
+ new_resource.run_level :highest
+ new_resource.frequency :minute
+ new_resource.frequency_modifier 15
+ new_resource.user "SYSTEM"
+ new_resource.execution_time_limit "PT72H"
+ new_resource.start_day "3/30/2017"
+ new_resource.start_time "13:12"
+ end
+ context "when start_time not changed" do
+ it "returns false" do
+ expect(provider.send(:start_time_updated?)).to be(false)
+ end
+ end
+
+ context "when start_time changed" do
+ it "returns true" do
+ new_resource.start_time "01:01"
+ expect(provider.send(:start_time_updated?)).to be(true)
+ end
+ end
+ end
+
+ describe "#convert_user_date_to_system_date" do
+ it "when current resource start date is '30-May-2017' then returns '05/30/2017'" do
+ allow(provider).to receive(:get_system_short_date_format).and_return("MM/dd/yyyy")
+ expect(provider.send(:convert_user_date_to_system_date, "30-May-2017")).to eq("05/30/2017")
+ end
+ end
+
+ describe "#convert_system_date_format_to_ruby_date_format" do
+ context "when system date format 'dd-MMM-yy'" do
+ it "returns '%d-%b-%y'" do
+ allow(provider).to receive(:get_system_short_date_format).and_return("dd-MMM-yy")
+ expect(provider.send(:convert_system_date_format_to_ruby_date_format)).to eq("%d-%b-%y")
+ end
+ end
+
+ context "when system date format 'dd/MM/yyyy'" do
+ it "returns '%d/%m/%Y'" do
+ allow(provider).to receive(:get_system_short_date_format).and_return("dd/MM/yyyy")
+ expect(provider.send(:convert_system_date_format_to_ruby_date_format)).to eq("%d/%m/%Y")
+ end
+ end
+ end
+
+ describe "#convert_system_date_format_to_ruby_long_date" do
+ context "when system date format 'dd-MMM-yy'" do
+ it "returns '%d-%m-%Y'" do
+ allow(provider).to receive(:get_system_short_date_format).and_return("dd-MMM-yy")
+ expect(provider.send(:convert_system_date_format_to_ruby_long_date)).to eq("%d-%m-%Y")
+ end
+ end
+
+ context "when system date format 'dd/MM/yyyy'" do
+ it "returns '%d/%m/%Y'" do
+ allow(provider).to receive(:get_system_short_date_format).and_return("dd/MM/yyyy")
+ expect(provider.send(:convert_system_date_format_to_ruby_long_date)).to eq("%d/%m/%Y")
+ end
+ end
+ end
+
+ describe "#common_date_format_conversion" do
+ context "when system date format 'dd-MM-yyyy'" do
+ it "returns '%d-%m-%Y'" do
+ expect(provider.send(:common_date_format_conversion, "dd-MM-yyyy")).to eq("%d-%m-%Y")
+ end
+ end
+
+ context "when system date format 'd-M-yyyy'" do
+ it "returns '%d-%m-%Y'" do
+ expect(provider.send(:common_date_format_conversion, "dd-MM-yyyy")).to eq("%d-%m-%Y")
+ end
end
end
diff --git a/spec/unit/resource/apt_preference_spec.rb b/spec/unit/resource/apt_preference_spec.rb
new file mode 100644
index 0000000000..66bb6e64bb
--- /dev/null
+++ b/spec/unit/resource/apt_preference_spec.rb
@@ -0,0 +1,49 @@
+#
+# Author:: Tim Smith (<tsmith@chef.io>)
+# Copyright:: 2016-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"
+
+describe Chef::Resource::AptPreference do
+ let(:node) { Chef::Node.new }
+ let(:events) { Chef::EventDispatch::Dispatcher.new }
+ let(:run_context) { Chef::RunContext.new(node, {}, events) }
+ let(:resource) { Chef::Resource::AptPreference.new("libmysqlclient16", run_context) }
+
+ it "creates a new Chef::Resource::AptPreference" do
+ expect(resource).to be_a_kind_of(Chef::Resource)
+ expect(resource).to be_a_kind_of(Chef::Resource::AptPreference)
+ end
+
+ it "resolves to a Noop class when on non-linux OS" do
+ node.automatic[:os] = "windows"
+ node.automatic[:platform_family] = "windows"
+ expect(resource.provider_for_action(:add)).to be_a(Chef::Provider::Noop)
+ end
+
+ it "resolves to a Noop class when on non-debian linux" do
+ node.automatic[:os] = "linux"
+ node.automatic[:platform_family] = "gentoo"
+ expect(resource.provider_for_action(:add)).to be_a(Chef::Provider::Noop)
+ end
+
+ it "resolves to a AptUpdate class when on a debian platform_family" do
+ node.automatic[:os] = "linux"
+ node.automatic[:platform_family] = "debian"
+ expect(resource.provider_for_action(:add)).to be_a(Chef::Provider::AptPreference)
+ end
+end
diff --git a/spec/unit/resource/apt_repository_spec.rb b/spec/unit/resource/apt_repository_spec.rb
index 69cf94ae56..812fa0c843 100644
--- a/spec/unit/resource/apt_repository_spec.rb
+++ b/spec/unit/resource/apt_repository_spec.rb
@@ -1,6 +1,6 @@
#
# Author:: Thom May (<thom@chef.io>)
-# Copyright:: Copyright (c) 2016 Chef Software, Inc.
+# Copyright:: 2016-2017, Chef Software, Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -24,27 +24,35 @@ describe Chef::Resource::AptRepository do
let(:run_context) { Chef::RunContext.new(node, {}, events) }
let(:resource) { Chef::Resource::AptRepository.new("multiverse", run_context) }
- it "should create a new Chef::Resource::AptRepository" do
+ it "creates a new Chef::Resource::AptRepository" do
expect(resource).to be_a_kind_of(Chef::Resource)
expect(resource).to be_a_kind_of(Chef::Resource::AptRepository)
end
- it "the default keyserver should be keyserver.ubuntu.com" do
+ it "uses keyserver.ubuntu.com as the keyserver" do
expect(resource.keyserver).to eql("keyserver.ubuntu.com")
end
- it "the default distribution should be nillable" do
+ it "default distribution is nillable" do
expect(resource.distribution(nil)).to eql(nil)
expect(resource.distribution).to eql(nil)
end
- it "should resolve to a Noop class when apt-get is not found" do
- expect(Chef::Provider::AptRepository).to receive(:which).with("apt-get").and_return(false)
+ it "resolves to a Noop class when on non-linux OS" do
+ node.automatic[:os] = "windows"
+ node.automatic[:platform_family] = "windows"
expect(resource.provider_for_action(:add)).to be_a(Chef::Provider::Noop)
end
- it "should resolve to a AptRepository class when apt-get is found" do
- expect(Chef::Provider::AptRepository).to receive(:which).with("apt-get").and_return(true)
+ it "resolves to a Noop class when on non-debian linux" do
+ node.automatic[:os] = "linux"
+ node.automatic[:platform_family] = "gentoo"
+ expect(resource.provider_for_action(:add)).to be_a(Chef::Provider::Noop)
+ end
+
+ it "resolves to a AptUpdate class when on a debian platform_family" do
+ node.automatic[:os] = "linux"
+ node.automatic[:platform_family] = "debian"
expect(resource.provider_for_action(:add)).to be_a(Chef::Provider::AptRepository)
end
end
diff --git a/spec/unit/resource/apt_update_spec.rb b/spec/unit/resource/apt_update_spec.rb
index dd72b18063..6b20092c56 100644
--- a/spec/unit/resource/apt_update_spec.rb
+++ b/spec/unit/resource/apt_update_spec.rb
@@ -1,6 +1,6 @@
#
# Author:: Thom May (<thom@chef.io>)
-# Copyright:: Copyright (c) 2016 Chef Software, Inc.
+# Copyright:: 2016-2017, Chef Software, Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -24,27 +24,35 @@ describe Chef::Resource::AptUpdate do
let(:run_context) { Chef::RunContext.new(node, {}, events) }
let(:resource) { Chef::Resource::AptUpdate.new("update", run_context) }
- it "should create a new Chef::Resource::AptUpdate" do
+ it "creates a new Chef::Resource::AptUpdate" do
expect(resource).to be_a_kind_of(Chef::Resource)
expect(resource).to be_a_kind_of(Chef::Resource::AptUpdate)
end
- it "the default frequency should be 1 day" do
+ it "default frequency is set to be 1 day" do
expect(resource.frequency).to eql(86_400)
end
- it "the frequency should accept integers" do
+ it "frequency accepts integers" do
resource.frequency(400)
expect(resource.frequency).to eql(400)
end
- it "should resolve to a Noop class when apt-get is not found" do
- expect(Chef::Provider::AptUpdate).to receive(:which).with("apt-get").and_return(false)
+ it "resolves to a Noop class when on non-linux OS" do
+ node.automatic[:os] = "windows"
+ node.automatic[:platform_family] = "windows"
expect(resource.provider_for_action(:add)).to be_a(Chef::Provider::Noop)
end
- it "should resolve to a AptUpdate class when apt-get is found" do
- expect(Chef::Provider::AptUpdate).to receive(:which).with("apt-get").and_return(true)
+ it "resolves to a Noop class when on non-debian linux" do
+ node.automatic[:os] = "linux"
+ node.automatic[:platform_family] = "gentoo"
+ expect(resource.provider_for_action(:add)).to be_a(Chef::Provider::Noop)
+ end
+
+ it "resolves to a AptUpdate class when on a debian platform_family" do
+ node.automatic[:os] = "linux"
+ node.automatic[:platform_family] = "debian"
expect(resource.provider_for_action(:add)).to be_a(Chef::Provider::AptUpdate)
end
end
diff --git a/spec/unit/resource/execute_spec.rb b/spec/unit/resource/execute_spec.rb
index 69e4e91f2a..575c80ba2f 100644
--- a/spec/unit/resource/execute_spec.rb
+++ b/spec/unit/resource/execute_spec.rb
@@ -77,7 +77,7 @@ describe Chef::Resource::Execute do
shared_examples_for "it received invalid credentials" do
describe "the validation method" do
it "should raise an error" do
- expect { execute_resource.validate_identity_platform(username, password, domain) }.to raise_error(ArgumentError)
+ expect { execute_resource.validate_identity_platform(username, password, domain, elevated) }.to raise_error(ArgumentError)
end
end
end
@@ -113,6 +113,7 @@ describe Chef::Resource::Execute do
context "when a valid username is specified" do
let(:username) { "starchild" }
+ let(:elevated) { false }
context "when a valid domain is specified" do
let(:domain) { "mothership" }
@@ -129,6 +130,7 @@ describe Chef::Resource::Execute do
context "when the domain is not specified" do
let(:domain) { nil }
+ let(:elevated) { false }
context "when the password is not specified" do
let(:password) { nil }
@@ -179,6 +181,24 @@ describe Chef::Resource::Execute do
it_behaves_like "it received invalid username and domain"
end
end
+
+ context "when elevated is passed" do
+ let(:elevated) { true }
+
+ context "when username and password are not passed" do
+ let(:username) { nil }
+ let(:domain) { nil }
+ let(:password) { nil }
+ it_behaves_like "it received invalid credentials"
+ end
+
+ context "when username and password are passed" do
+ let(:username) { "user" }
+ let(:domain) { nil }
+ let(:password) { "we.funk!" }
+ it_behaves_like "it received valid credentials"
+ end
+ end
end
context "when not running on Windows" do
diff --git a/spec/unit/resource/powershell_script_spec.rb b/spec/unit/resource/powershell_script_spec.rb
index 6457090608..9cdb6fdbee 100644
--- a/spec/unit/resource/powershell_script_spec.rb
+++ b/spec/unit/resource/powershell_script_spec.rb
@@ -59,9 +59,9 @@ describe Chef::Resource::PowershellScript do
allow(resource).to receive(:updated).and_return(true)
end
- it "inherits exactly the :cwd, :environment, :group, :path, :user, :umask, and :architecture attributes from a parent resource class" do
+ it "inherits exactly the :cwd, :environment, :group, :path, :user, :umask, :architecture, :elevated attributes from a parent resource class" do
inherited_difference = Chef::Resource::PowershellScript.guard_inherited_attributes -
- [:cwd, :environment, :group, :path, :user, :umask, :architecture ]
+ [:cwd, :environment, :group, :path, :user, :umask, :architecture, :elevated ]
expect(inherited_difference).to eq([])
end
diff --git a/spec/unit/resource/windows_path_spec.rb b/spec/unit/resource/windows_path_spec.rb
new file mode 100644
index 0000000000..aecea8ee6b
--- /dev/null
+++ b/spec/unit/resource/windows_path_spec.rb
@@ -0,0 +1,38 @@
+#
+# Author:: Nimisha Sharad (<nimisha.sharad@msystechnologies.com>)
+# Copyright:: Copyright 2008-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"
+
+describe Chef::Resource::WindowsPath do
+ subject { Chef::Resource::WindowsPath.new("some_path") }
+
+ it { is_expected.to be_a_kind_of(Chef::Resource) }
+ it { is_expected.to be_a_instance_of(Chef::Resource::WindowsPath) }
+
+ it "sets resource name as :windows_path" do
+ expect(subject.resource_name).to eql(:windows_path)
+ end
+
+ it "sets the path as it's name" do
+ expect(subject.path).to eql("some_path")
+ end
+
+ it "sets the default action as :add" do
+ expect(subject.action).to eql(:add)
+ end
+end
diff --git a/spec/unit/resource/zypper_repository_spec.rb b/spec/unit/resource/zypper_repository_spec.rb
new file mode 100644
index 0000000000..16951d071c
--- /dev/null
+++ b/spec/unit/resource/zypper_repository_spec.rb
@@ -0,0 +1,65 @@
+#
+# Author:: Tim Smith (<tsmith@chef.io>)
+# Copyright:: Copyright (c) 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"
+
+describe Chef::Resource::ZypperRepository do
+ let(:node) { Chef::Node.new }
+ let(:events) { Chef::EventDispatch::Dispatcher.new }
+ let(:run_context) { Chef::RunContext.new(node, {}, events) }
+ let(:resource) { Chef::Resource::ZypperRepository.new("repo-source", run_context) }
+
+ context "on linux", :linux_only do
+ it "should create a new Chef::Resource::ZypperRepository" do
+ expect(resource).to be_a_kind_of(Chef::Resource)
+ expect(resource).to be_a_kind_of(Chef::Resource::ZypperRepository)
+ end
+
+ it "should have a name of repo-source" do
+ expect(resource.name).to eql("repo-source")
+ end
+
+ it "should have a default action of create" do
+ expect(resource.action).to eql([:create])
+ end
+
+ it "supports all valid actions" do
+ expect { resource.action :add }.not_to raise_error
+ expect { resource.action :remove }.not_to raise_error
+ expect { resource.action :create }.not_to raise_error
+ expect { resource.action :refresh }.not_to raise_error
+ expect { resource.action :delete }.to raise_error(ArgumentError)
+ end
+
+ it "should resolve to a Noop class when zypper is not found" do
+ expect(Chef::Provider::ZypperRepository).to receive(:which).with("zypper").and_return(false)
+ expect(resource.provider_for_action(:add)).to be_a(Chef::Provider::Noop)
+ end
+
+ it "should resolve to a ZypperRepository class when zypper is found" do
+ expect(Chef::Provider::ZypperRepository).to receive(:which).with("zypper").and_return(true)
+ expect(resource.provider_for_action(:add)).to be_a(Chef::Provider::ZypperRepository)
+ end
+ end
+
+ context "on windows", :windows_only do
+ it "should resolve to a NoOp provider" do
+ expect(resource.provider_for_action(:add)).to be_a(Chef::Provider::Noop)
+ end
+ end
+end
diff --git a/spec/unit/resource_spec.rb b/spec/unit/resource_spec.rb
index 6285bad50a..9227c8b12d 100644
--- a/spec/unit/resource_spec.rb
+++ b/spec/unit/resource_spec.rb
@@ -377,6 +377,14 @@ describe Chef::Resource do
expect(resource.to_text).to match(/foo "\*sensitive value suppressed\*"/)
end
end
+
+ context "when property is required" do
+ it "does not propagate vailidation errors" do
+ resource_class = Class.new(Chef::Resource) { property :foo, String, required: true }
+ resource = resource_class.new("required_property_tests")
+ expect { resource.to_text }.to_not raise_error Chef::Exceptions::ValidationFailed
+ end
+ end
end
describe "self.resource_name" do
diff --git a/spec/unit/search/query_spec.rb b/spec/unit/search/query_spec.rb
index 95221870d5..151fcb51b3 100644
--- a/spec/unit/search/query_spec.rb
+++ b/spec/unit/search/query_spec.rb
@@ -22,9 +22,10 @@ require "chef/search/query"
describe Chef::Search::Query do
let(:rest) { double("Chef::ServerAPI") }
let(:query) { Chef::Search::Query.new }
+ let(:default_rows) { 1000 }
shared_context "filtered search" do
- let(:query_string) { "search/node?q=platform:rhel&start=0" }
+ let(:query_string) { "search/node?q=platform:rhel&start=0&rows=#{default_rows}" }
let(:server_url) { "https://api.opscode.com/organizations/opscode/nodes" }
let(:args) { { filter_key => filter_hash } }
let(:filter_hash) do
@@ -81,8 +82,8 @@ describe Chef::Search::Query do
end
describe "search" do
- let(:query_string) { "search/node?q=platform:rhel&start=0" }
- let(:query_string_continue) { "search/node?q=platform:rhel&start=4" }
+ let(:query_string) { "search/node?q=platform:rhel&start=0&rows=#{default_rows}" }
+ let(:query_string_continue) { "search/node?q=platform:rhel&start=4&rows=#{default_rows}" }
let(:query_string_with_rows) { "search/node?q=platform:rhel&start=0&rows=4" }
let(:query_string_continue_with_rows) { "search/node?q=platform:rhel&start=4&rows=4" }
@@ -150,12 +151,6 @@ describe Chef::Search::Query do
"total" => 4,
} end
- let(:big_response) do
- r = response.dup
- r["total"] = 8
- r
- end
-
let(:big_response_empty) do
{
"start" => 0,
@@ -178,17 +173,17 @@ describe Chef::Search::Query do
end
it "queries for every object of a type by default" do
- expect(rest).to receive(:get).with("search/node?q=*:*&start=0").and_return(response)
+ expect(rest).to receive(:get).with("search/node?q=*:*&start=0&rows=#{default_rows}").and_return(response)
query.search(:node)
end
it "allows a custom query" do
- expect(rest).to receive(:get).with("search/node?q=platform:rhel&start=0").and_return(response)
+ expect(rest).to receive(:get).with("search/node?q=platform:rhel&start=0&rows=#{default_rows}").and_return(response)
query.search(:node, "platform:rhel")
end
it "lets you set a starting object" do
- expect(rest).to receive(:get).with("search/node?q=platform:rhel&start=2").and_return(response)
+ expect(rest).to receive(:get).with("search/node?q=platform:rhel&start=2&rows=#{default_rows}").and_return(response)
query.search(:node, "platform:rhel", start: 2)
end
@@ -221,9 +216,9 @@ describe Chef::Search::Query do
query.search(:node, "*:*", start: 0, rows: 4) { |r| @call_me.do(r) }
end
- it "sends multiple API requests when the server indicates there is more data" do
- expect(rest).to receive(:get).with(query_string).and_return(big_response)
- expect(rest).to receive(:get).with(query_string_continue).and_return(big_response_end)
+ # This test would loop infinitely if pagination didn't advance
+ it "paginates correctly in the face of filtered nodes without explicit rows" do
+ allow(rest).to receive(:get).with(query_string).and_return(big_response_empty)
query.search(:node, "platform:rhel") do |r|
nil
end
@@ -239,21 +234,21 @@ describe Chef::Search::Query do
it "fuzzifies node searches when fuzz is set" do
expect(rest).to receive(:get).with(
- "search/node?q=tags:*free.messi*%20OR%20roles:*free.messi*%20OR%20fqdn:*free.messi*%20OR%20addresses:*free.messi*%20OR%20policy_name:*free.messi*%20OR%20policy_group:*free.messi*&start=0"
+ "search/node?q=tags:*free.messi*%20OR%20roles:*free.messi*%20OR%20fqdn:*free.messi*%20OR%20addresses:*free.messi*%20OR%20policy_name:*free.messi*%20OR%20policy_group:*free.messi*&start=0&rows=#{default_rows}"
).and_return(response)
query.search(:node, "free.messi", fuzz: true)
end
it "does not fuzzify node searches when fuzz is not set" do
expect(rest).to receive(:get).with(
- "search/node?q=free.messi&start=0"
+ "search/node?q=free.messi&start=0&rows=#{default_rows}"
).and_return(response)
query.search(:node, "free.messi")
end
it "does not fuzzify client searches" do
expect(rest).to receive(:get).with(
- "search/client?q=messi&start=0"
+ "search/client?q=messi&start=0&rows=#{default_rows}"
).and_return(response)
query.search(:client, "messi", fuzz: true)
end
diff --git a/spec/unit/server_api_spec.rb b/spec/unit/server_api_spec.rb
index fc10cbbf97..00a6d81d81 100644
--- a/spec/unit/server_api_spec.rb
+++ b/spec/unit/server_api_spec.rb
@@ -26,12 +26,22 @@ b857vWviwPX2/P6+E3GPdl8IVsKXCvGWOBZWTuNTjQtwbDzsUepWoMgXnlQJSn5I
YSlLxQKBgQD16Gw9kajpKlzsPa6XoQeGmZALT6aKWJQlrKtUQIrsIWM0Z6eFtX12
2jjHZ0awuCQ4ldqwl8IfRogWMBkHOXjTPVK0YKWWlxMpD/5+bGPARa5fir8O1Zpo
Y6S6MeZ69Rp89ma4ttMZ+kwi1+XyHqC/dlcVRW42Zl5Dc7BALRlJjQ==
------END RSA PRIVATE KEY-----"
+-----END RSA PRIVATE KEY-----".freeze
describe Chef::ServerAPI do
let(:url) { "http://chef.example.com:4000" }
let(:key_path) { "/tmp/foo" }
+ let(:client) do
+ Chef::ServerAPI.new(url)
+ end
+
+ before do
+ Chef::Config[:node_name] = "silent-bob"
+ Chef::Config[:client_key] = CHEF_SPEC_DATA + "/ssl/private_key.pem"
+ Chef::Config[:http_retry_delay] = 0
+ end
+
describe "#initialize" do
it "uses the configured key file" do
allow(IO).to receive(:read).with(key_path).and_return(SIGNING_KEY_DOT_PEM)
@@ -78,4 +88,67 @@ describe Chef::ServerAPI do
end
end
+ context "versioned apis" do
+ class VersionedClassV0
+ extend Chef::Mixin::VersionedAPI
+ minimum_api_version 0
+ end
+
+ class VersionedClassV2
+ extend Chef::Mixin::VersionedAPI
+ minimum_api_version 2
+ end
+
+ class VersionedClassVersions
+ extend Chef::Mixin::VersionedAPIFactory
+ add_versioned_api_class VersionedClassV0
+ add_versioned_api_class VersionedClassV2
+ end
+
+ before do
+ Chef::ServerAPIVersions.instance.reset!
+ end
+
+ let(:versioned_client) do
+ Chef::ServerAPI.new(url, version_class: VersionedClassVersions)
+ end
+
+ it "on protocol negotiation it posts the same message body without doubly-encoding the json string" do
+ WebMock.disable_net_connect!
+ post_body = { bar: "baz" }
+ body_406 = '{"error":"invalid-x-ops-server-api-version","message":"Specified version 2 not supported","min_version":0,"max_version":1}'
+ stub_request(:post, "http://chef.example.com:4000/foo").with(body: post_body.to_json, headers: { "X-Ops-Server-Api-Version" => "2" }).to_return(status: [406, "Not Acceptable"], body: body_406 )
+ stub_request(:post, "http://chef.example.com:4000/foo").with(body: post_body.to_json, headers: { "X-Ops-Server-Api-Version" => "0" }).to_return(status: 200, body: "", headers: {})
+ versioned_client.post("foo", post_body)
+ end
+ end
+
+ context "retrying normal requests" do
+ it "500 on a post retries and posts correctly " do
+ WebMock.disable_net_connect!
+ post_body = { bar: "baz" }
+ headers = { "Accept" => "application/json", "Content-Type" => "application/json", "Accept-Encoding" => "gzip;q=1.0,deflate;q=0.6,identity;q=0.3", "Content-Length" => "13", "Host" => "chef.example.com:4000", "X-Chef-Version" => Chef::VERSION, "X-Ops-Sign" => "algorithm=sha1;version=1.1;", "X-Ops-Userid" => "silent-bob" }
+ stub_request(:post, "http://chef.example.com:4000/foo").with(body: post_body.to_json, headers: headers).to_return(status: [500, "Internal Server Error"])
+ stub_request(:post, "http://chef.example.com:4000/foo").with(body: post_body.to_json, headers: headers).to_return(status: 200, body: "", headers: {})
+ client.post("foo", post_body)
+ end
+
+ it "500 on a put retries and puts correctly " do
+ WebMock.disable_net_connect!
+ put_body = { bar: "baz" }
+ headers = { "Accept" => "application/json", "Content-Type" => "application/json", "Accept-Encoding" => "gzip;q=1.0,deflate;q=0.6,identity;q=0.3", "Content-Length" => "13", "Host" => "chef.example.com:4000", "X-Chef-Version" => Chef::VERSION, "X-Ops-Sign" => "algorithm=sha1;version=1.1;", "X-Ops-Userid" => "silent-bob" }
+ stub_request(:put, "http://chef.example.com:4000/foo").with(body: put_body.to_json, headers: headers).to_return(status: [500, "Internal Server Error"])
+ stub_request(:put, "http://chef.example.com:4000/foo").with(body: put_body.to_json, headers: headers).to_return(status: 200, body: "", headers: {})
+ client.put("foo", put_body)
+ end
+
+ it "500 on a get retries and gets correctly " do
+ WebMock.disable_net_connect!
+ get_body = { bar: "baz" }
+ headers = { "Accept" => "application/json", "Accept-Encoding" => "gzip;q=1.0,deflate;q=0.6,identity;q=0.3", "Host" => "chef.example.com:4000", "X-Chef-Version" => Chef::VERSION, "X-Ops-Sign" => "algorithm=sha1;version=1.1;", "X-Ops-Userid" => "silent-bob" }
+ stub_request(:get, "http://chef.example.com:4000/foo").with(headers: headers).to_return(status: [500, "Internal Server Error"])
+ stub_request(:get, "http://chef.example.com:4000/foo").with(headers: headers).to_return(status: 200, body: "", headers: {})
+ client.get("foo")
+ end
+ end
end
diff --git a/spec/unit/server_api_versions_spec.rb b/spec/unit/server_api_versions_spec.rb
index 43445eb825..1dab0548cb 100644
--- a/spec/unit/server_api_versions_spec.rb
+++ b/spec/unit/server_api_versions_spec.rb
@@ -22,10 +22,28 @@ describe Chef::ServerAPIVersions do
Chef::ServerAPIVersions.instance.reset!
end
+ describe "#reset!" do
+ it "resets the version information" do
+ Chef::ServerAPIVersions.instance.set_versions({ "min_version" => 0, "max_version" => 2 })
+ Chef::ServerAPIVersions.instance.reset!
+ expect(Chef::ServerAPIVersions.instance.min_server_version).to be_nil
+ end
+
+ it "resets the unversioned flag" do
+ Chef::ServerAPIVersions.instance.unversioned!
+ Chef::ServerAPIVersions.instance.reset!
+ expect(Chef::ServerAPIVersions.instance.unversioned?).to be false
+ end
+ end
+
describe "#min_server_version" do
it "returns nil if no versions have been recorded" do
expect(Chef::ServerAPIVersions.instance.min_server_version).to be_nil
end
+ it "returns 0 if unversioned" do
+ Chef::ServerAPIVersions.instance.unversioned!
+ expect(Chef::ServerAPIVersions.instance.min_server_version).to eq(0)
+ end
it "returns the correct value" do
Chef::ServerAPIVersions.instance.set_versions({ "min_version" => 0, "max_version" => 2 })
expect(Chef::ServerAPIVersions.instance.min_server_version).to eq(0)
@@ -36,6 +54,10 @@ describe Chef::ServerAPIVersions do
it "returns nil if no versions have been recorded" do
expect(Chef::ServerAPIVersions.instance.max_server_version).to be_nil
end
+ it "returns 0 if unversioned" do
+ Chef::ServerAPIVersions.instance.unversioned!
+ expect(Chef::ServerAPIVersions.instance.min_server_version).to eq(0)
+ end
it "returns the correct value" do
Chef::ServerAPIVersions.instance.set_versions({ "min_version" => 0, "max_version" => 2 })
expect(Chef::ServerAPIVersions.instance.max_server_version).to eq(2)
diff --git a/spec/unit/shell/shell_session_spec.rb b/spec/unit/shell/shell_session_spec.rb
index 170767fbd6..7ed372f375 100644
--- a/spec/unit/shell/shell_session_spec.rb
+++ b/spec/unit/shell/shell_session_spec.rb
@@ -47,119 +47,143 @@ describe Shell::ShellSession do
end
describe Shell::ClientSession do
+ let(:json_attribs) { { "a" => "b" } }
+ let(:chef_rest) { double("Chef::ServerAPI") }
+ let(:node) { Chef::Node.build("foo") }
+ let(:session) { Shell::ClientSession.instance }
+ let(:client) do
+ double("Chef::Client.new",
+ :run_ohai => true,
+ :load_node => true,
+ :build_node => true,
+ :register => true,
+ :sync_cookbooks => {}
+ )
+ end
+
before do
Chef::Config[:shell_config] = { :override_runlist => [Chef::RunList::RunListItem.new("shell::override")] }
- @chef_rest = double("Chef::ServerAPI")
- @session = Shell::ClientSession.instance
- @node = Chef::Node.build("foo")
- @session.node = @node
- @client = double("Chef::Client.new",
- :run_ohai => true,
- :load_node => true,
- :build_node => true,
- :register => true,
- :sync_cookbooks => {})
+ session.node = node
+ session.json_configuration = json_attribs
end
it "builds the node's run_context with the proper environment" do
- @session.instance_variable_set(:@client, @client)
- @expansion = Chef::RunList::RunListExpansion.new(@node.chef_environment, [])
+ session.instance_variable_set(:@client, client)
+ expansion = Chef::RunList::RunListExpansion.new(node.chef_environment, [])
- expect(@node.run_list).to receive(:expand).with(@node.chef_environment).and_return(@expansion)
- expect(Chef::ServerAPI).to receive(:new).with(Chef::Config[:chef_server_url]).and_return(@chef_rest)
- @session.rebuild_context
+ expect(node.run_list).to receive(:expand).with(node.chef_environment).and_return(expansion)
+ expect(Chef::ServerAPI).to receive(:new).with(Chef::Config[:chef_server_url]).and_return(chef_rest)
+ session.rebuild_context
end
it "passes the shell CLI args to the client" do
- expect(Chef::Client).to receive(:new).with(nil, Chef::Config[:shell_config]).and_return(@client)
- @session.send(:rebuild_node)
+ expect(Chef::Client).to receive(:new).with(json_attribs, Chef::Config[:shell_config]).and_return(client)
+ session.send(:rebuild_node)
end
end
describe Shell::SoloSession do
+ let(:json_attribs) { { "a" => "b" } }
+ let(:chef_rest) { double("Chef::ServerAPI") }
+ let(:node) { Chef::Node.build("foo") }
+ let(:session) { Shell::SoloSession.instance }
+ let(:client) do
+ double("Chef::Client.new",
+ :run_ohai => true,
+ :load_node => true,
+ :build_node => true,
+ :register => true,
+ :sync_cookbooks => {}
+ )
+ end
+
before do
Chef::Config[:shell_config] = { :override_runlist => [Chef::RunList::RunListItem.new("shell::override")] }
- @chef_rest = double("Chef::ServerAPI")
- @session = Shell::SoloSession.instance
- @node = Chef::Node.build("foo")
- @session.node = @node
- @client = double("Chef::Client.new",
- :run_ohai => true,
- :load_node => true,
- :build_node => true,
- :register => true,
- :sync_cookbooks => {})
+ session.node = node
+ session.json_configuration = json_attribs
end
it "builds the node's run_context with the proper environment" do
- @session.instance_variable_set(:@client, @client)
- @expansion = Chef::RunList::RunListExpansion.new(@node.chef_environment, [])
+ session.instance_variable_set(:@client, client)
+ expansion = Chef::RunList::RunListExpansion.new(node.chef_environment, [])
- expect(@node.run_list).to receive(:expand).with(@node.chef_environment).and_return(@expansion)
- expect(Chef::ServerAPI).to receive(:new).with(Chef::Config[:chef_server_url]).and_return(@chef_rest)
- @session.rebuild_context
+ expect(node.run_list).to receive(:expand).with(node.chef_environment).and_return(expansion)
+ expect(Chef::ServerAPI).to receive(:new).with(Chef::Config[:chef_server_url]).and_return(chef_rest)
+ session.rebuild_context
end
it "passes the shell CLI args to the client" do
- expect(Chef::Client).to receive(:new).with(nil, Chef::Config[:shell_config]).and_return(@client)
- @session.send(:rebuild_node)
+ expect(Chef::Client).to receive(:new).with(json_attribs, Chef::Config[:shell_config]).and_return(client)
+ session.send(:rebuild_node)
end
end
describe Shell::StandAloneSession do
+ let(:json_attribs) { { "a" => "b" } }
+ let(:chef_rest) { double("Chef::ServerAPI") }
+ let(:node) { Chef::Node.new }
+ let(:events) { Chef::EventDispatch::Dispatcher.new }
+ let(:session) { Shell::StandAloneSession.instance }
+ let(:client) do
+ double("Chef::Client.new",
+ :run_ohai => true,
+ :load_node => true,
+ :build_node => true,
+ :register => true,
+ :sync_cookbooks => {}
+ )
+ end
+ let(:recipe) { Chef::Recipe.new(nil, nil, run_context) }
+ let(:run_context) { Chef::RunContext.new(node, {}, events) }
+
before do
Chef::Config[:shell_config] = { :override_runlist => [Chef::RunList::RunListItem.new("shell::override")] }
- @session = Shell::StandAloneSession.instance
- @node = @session.node = Chef::Node.new
- @events = Chef::EventDispatch::Dispatcher.new
- @run_context = @session.run_context = Chef::RunContext.new(@node, {}, @events)
- @recipe = @session.recipe = Chef::Recipe.new(nil, nil, @run_context)
- Shell::Extensions.extend_context_recipe(@recipe)
+ session.node = node
+ session.json_configuration = json_attribs
+ session.run_context = run_context
+ session.recipe = recipe
+ Shell::Extensions.extend_context_recipe(recipe)
end
it "has a run_context" do
- expect(@session.run_context).to equal(@run_context)
+ expect(session.run_context).to equal(run_context)
end
it "returns a collection based on it's standalone recipe file" do
- expect(@session.resource_collection).to eq(@recipe.run_context.resource_collection)
+ expect(session.resource_collection).to eq(recipe.run_context.resource_collection)
end
it "gives nil for the definitions (for now)" do
- expect(@session.definitions).to be_nil
+ expect(session.definitions).to be_nil
end
it "gives nil for the cookbook_loader" do
- expect(@session.cookbook_loader).to be_nil
+ expect(session.cookbook_loader).to be_nil
end
it "runs chef with the standalone recipe" do
- allow(@session).to receive(:node_built?).and_return(true)
+ allow(session).to receive(:node_built?).and_return(true)
allow(Chef::Log).to receive(:level)
chef_runner = double("Chef::Runner.new", :converge => :converged)
# pre-heat resource collection cache
- @session.resource_collection
+ session.resource_collection
- expect(Chef::Runner).to receive(:new).with(@session.recipe.run_context).and_return(chef_runner)
- expect(@recipe.run_chef).to eq(:converged)
+ expect(Chef::Runner).to receive(:new).with(session.recipe.run_context).and_return(chef_runner)
+ expect(recipe.run_chef).to eq(:converged)
end
it "passes the shell CLI args to the client" do
- @client = double("Chef::Client.new",
- :run_ohai => true,
- :load_node => true,
- :build_node => true,
- :register => true,
- :sync_cookbooks => {})
- expect(Chef::Client).to receive(:new).with(nil, Chef::Config[:shell_config]).and_return(@client)
- @session.send(:rebuild_node)
+ expect(Chef::Client).to receive(:new).with(json_attribs, Chef::Config[:shell_config]).and_return(client)
+ session.send(:rebuild_node)
end
end
describe Shell::SoloLegacySession do
+ let(:json_attribs) { { "a" => "b" } }
+
before do
Chef::Config[:shell_config] = { :override_runlist => [Chef::RunList::RunListItem.new("shell::override")] }
Chef::Config[:shell_solo] = true
@@ -219,8 +243,8 @@ describe Shell::SoloLegacySession do
:build_node => true,
:register => true,
:sync_cookbooks => {})
- expect(Chef::Client).to receive(:new).with(nil, Chef::Config[:shell_config]).and_return(@client)
+ expect(Chef::Client).to receive(:new).with(json_attribs, Chef::Config[:shell_config]).and_return(@client)
+ @session.json_configuration = json_attribs
@session.send(:rebuild_node)
end
-
end
diff --git a/spec/unit/util/dsc/local_configuration_manager_spec.rb b/spec/unit/util/dsc/local_configuration_manager_spec.rb
index 3f1210dbf1..c87b446286 100644
--- a/spec/unit/util/dsc/local_configuration_manager_spec.rb
+++ b/spec/unit/util/dsc/local_configuration_manager_spec.rb
@@ -63,7 +63,7 @@ EOH
let(:lcm_standard_error) { nil }
let(:lcm_cmdlet_success) { true }
- it "should successfully return resource information for normally formatted output when cmdlet the cmdlet succeeds" do
+ it "successfully returns resource information for normally formatted output when cmdlet the cmdlet succeeds" do
test_configuration_result = lcm.test_configuration("config", {})
expect(test_configuration_result.class).to be(Array)
expect(test_configuration_result.length).to be > 0
@@ -71,6 +71,58 @@ EOH
end
end
+ context "when running on PowerShell version 5" do
+ let(:lcm_standard_output) { normal_lcm_output }
+ let(:lcm_standard_error) { nil }
+ let(:lcm_cmdlet_success) { true }
+
+ it "successfully returns resource information for normally formatted output when cmdlet the cmdlet succeeds" do
+ allow(lcm).to receive(:ps_version_gte_5?).and_return(true)
+ test_configuration_result = lcm.test_configuration("config", {})
+ expect(test_configuration_result.class).to be(Array)
+ expect(test_configuration_result.length).to be > 0
+ expect(Chef::Log).not_to receive(:warn)
+ end
+ end
+
+ context "when running on PowerShell version less than 5" do
+ let(:lcm_standard_output) { normal_lcm_output }
+ let(:lcm_standard_error) { nil }
+ let(:lcm_cmdlet_success) { true }
+
+ it "successfully returns resource information for normally formatted output when cmdlet the cmdlet succeeds" do
+ allow(lcm).to receive(:ps_version_gte_5?).and_return(false)
+ test_configuration_result = lcm.test_configuration("config", {})
+ expect(test_configuration_result.class).to be(Array)
+ expect(test_configuration_result.length).to be > 0
+ expect(Chef::Log).not_to receive(:warn)
+ end
+ end
+
+ context "#lcm_command" do
+ let(:common_command_prefix) { "$ProgressPreference = 'SilentlyContinue';" }
+ let(:ps4_base_command) { "#{common_command_prefix} Start-DscConfiguration -path tmp -wait -erroraction 'stop' -force" }
+ let(:lcm_command_ps4) { ps4_base_command + " -whatif; if (! $?) { exit 1 }" }
+ let(:lcm_command_ps5) { "#{common_command_prefix} Test-DscConfiguration -path tmp" }
+ let(:lcm_standard_output) { normal_lcm_output }
+ let(:lcm_standard_error) { nil }
+ let(:lcm_cmdlet_success) { true }
+
+ it "successfully returns command when apply_configuration true" do
+ expect(lcm.send(:lcm_command, true)).to eq(ps4_base_command)
+ end
+
+ it "successfully returns command when PowerShell version 4" do
+ allow(lcm).to receive(:ps_version_gte_5?).and_return(false)
+ expect(lcm.send(:lcm_command, false)).to eq(lcm_command_ps4)
+ end
+
+ it "successfully returns command when PowerShell version 5" do
+ allow(lcm).to receive(:ps_version_gte_5?).and_return(true)
+ expect(lcm.send(:lcm_command, false)).to eq(lcm_command_ps5)
+ end
+ end
+
context "that fails due to missing what-if switch in DSC resource cmdlet implementation" do
let(:lcm_standard_output) { "" }
let(:lcm_standard_error) { no_whatif_lcm_output }
@@ -80,7 +132,7 @@ EOH
expect(lcm.send(:whatif_not_supported?, no_whatif_lcm_output)).to be_truthy
end
- it "should should return a (possibly empty) array of ResourceInfo instances" do
+ it "returns a (possibly empty) array of ResourceInfo instances" do
expect(Chef::Log).to receive(:warn).at_least(:once)
expect(lcm).to receive(:whatif_not_supported?).and_call_original
test_configuration_result = nil
@@ -94,14 +146,14 @@ EOH
let(:lcm_standard_error) { dsc_resource_import_failure_output }
let(:lcm_cmdlet_success) { false }
- it "should log a warning if the message is formatted as expected when a resource import failure occurs" do
+ it "logs a warning if the message is formatted as expected when a resource import failure occurs" do
expect(Chef::Log).to receive(:warn).at_least(:once)
expect(lcm).to receive(:dsc_module_import_failure?).and_call_original
test_configuration_result = nil
expect { test_configuration_result = lcm.test_configuration("config", {}) }.not_to raise_error
end
- it "should return a (possibly empty) array of ResourceInfo instances" do
+ it "returns a (possibly empty) array of ResourceInfo instances" do
expect(Chef::Log).to receive(:warn).at_least(:once)
test_configuration_result = nil
expect { test_configuration_result = lcm.test_configuration("config", {}) }.not_to raise_error
@@ -114,7 +166,7 @@ EOH
let(:lcm_standard_error) { "Abort, Retry, Fail?" }
let(:lcm_cmdlet_success) { false }
- it "should log a warning" do
+ it "logs a warning" do
expect(Chef::Log).to receive(:warn).at_least(:once)
expect(lcm).to receive(:dsc_module_import_failure?).and_call_original
expect { lcm.test_configuration("config", {}) }.not_to raise_error
@@ -122,15 +174,15 @@ EOH
end
end
- it "should identify a correctly formatted error message as a resource import failure" do
+ it "identify a correctly formatted error message as a resource import failure" do
expect(lcm.send(:dsc_module_import_failure?, dsc_resource_import_failure_output)).to be(true)
end
- it "should not identify an incorrectly formatted error message as a resource import failure" do
+ it "does not identify an incorrectly formatted error message as a resource import failure" do
expect(lcm.send(:dsc_module_import_failure?, dsc_resource_import_failure_output.gsub("module", "gibberish"))).to be(false)
end
- it "should not identify a message without a CimException reference as a resource import failure" do
+ it "does not identify a message without a CimException reference as a resource import failure" do
expect(lcm.send(:dsc_module_import_failure?, dsc_resource_import_failure_output.gsub("CimException", "ArgumentException"))).to be(false)
end
end
diff --git a/spec/unit/util/windows/logon_session_spec.rb b/spec/unit/util/windows/logon_session_spec.rb
new file mode 100644
index 0000000000..b9b6c458b6
--- /dev/null
+++ b/spec/unit/util/windows/logon_session_spec.rb
@@ -0,0 +1,284 @@
+#
+# Author:: Adam Edwards (<adamed@chef.io>)
+# Copyright:: Copyright (c) 2015 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"
+require "chef/util/windows/logon_session"
+
+describe ::Chef::Util::Windows::LogonSession do
+ before do
+ stub_const("Chef::ReservedNames::Win32::API::Security", Class.new)
+ stub_const("Chef::ReservedNames::Win32::API::Security::LOGON32_LOGON_NEW_CREDENTIALS", 314)
+ stub_const("Chef::ReservedNames::Win32::API::Security::LOGON32_PROVIDER_DEFAULT", 159)
+ stub_const("Chef::ReservedNames::Win32::API::System", Class.new )
+ end
+
+ let(:session) { ::Chef::Util::Windows::LogonSession.new(session_user, password, session_domain) }
+
+ shared_examples_for "it received syntactically invalid credentials" do
+ it "does not raisees an exception when it is initialized" do
+ expect { session }.to raise_error(ArgumentError)
+ end
+ end
+
+ shared_examples_for "it received an incorrect username and password combination" do
+ before do
+ expect(Chef::ReservedNames::Win32::API::Security).to receive(:LogonUserW).and_return(false)
+ end
+
+ it "raises a Chef::Exceptions::Win32APIError exception when the open method is called" do
+ expect { session.open }.to raise_error(Chef::Exceptions::Win32APIError)
+ expect(session).not_to receive(:close)
+ expect(Chef::ReservedNames::Win32::API::System).not_to receive(:CloseHandle)
+ end
+ end
+
+ shared_examples_for "it received valid credentials" do
+ it "does not raise an exception when the open method is called" do
+ expect(Chef::ReservedNames::Win32::API::Security).to receive(:LogonUserW).and_return(true)
+ expect { session.open }.not_to raise_error
+ end
+ end
+
+ shared_examples_for "the session is not open" do
+ it "does not raise an exception when #open is called" do
+ expect(Chef::ReservedNames::Win32::API::Security).to receive(:LogonUserW).and_return(true)
+ expect { session.open }.not_to raise_error
+ end
+
+ it "raises an exception if #close is called" do
+ expect { session.close }.to raise_error(RuntimeError)
+ end
+
+ it "raises an exception if #restore_user_context is called" do
+ expect { session.restore_user_context }.to raise_error(RuntimeError)
+ end
+ end
+
+ shared_examples_for "the session is open" do
+ before do
+ allow(Chef::ReservedNames::Win32::API::System).to receive(:CloseHandle)
+ end
+ it "does not result in an exception when #restore_user_context is called" do
+ expect { session.restore_user_context }.not_to raise_error
+ end
+
+ it "does not result in an exception when #close is called" do
+ expect { session.close }.not_to raise_error
+ end
+
+ it "does close the operating system handle when #close is called" do
+ expect(Chef::ReservedNames::Win32::API::System).not_to receive(:CloseHandle)
+ expect { session.restore_user_context }.not_to raise_error
+ end
+ end
+
+ context "when the session is initialized with a nil user" do
+ context "when the password, and domain are all nil" do
+ let(:session_user) { nil }
+ let(:session_domain) { nil }
+ let(:password) { nil }
+ it_behaves_like "it received syntactically invalid credentials"
+ end
+
+ context "when the password is non-nil password, and the domain is nil" do
+ let(:session_user) { nil }
+ let(:password) { "ponies" }
+ let(:session_domain) { nil }
+ it_behaves_like "it received syntactically invalid credentials"
+ end
+
+ context "when the password is nil and the domain is non-nil" do
+ let(:session_user) { nil }
+ let(:password) { nil }
+ let(:session_domain) { "fairyland" }
+ it_behaves_like "it received syntactically invalid credentials"
+ end
+
+ context "when the password and domain are non-nil" do
+ let(:session_user) { nil }
+ let(:password) { "ponies" }
+ let(:session_domain) { "fairyland" }
+ it_behaves_like "it received syntactically invalid credentials"
+ end
+ end
+
+ context "when the session is initialized with a valid user" do
+ let(:session_user) { "chalena" }
+
+ context "when the password is nil" do
+ let(:password) { nil }
+ context "when the domain is non-nil" do
+ let(:session_domain) { "fairyland" }
+ it_behaves_like "it received syntactically invalid credentials"
+ end
+
+ context "when the domain is nil" do
+ context "when the domain is non-nil" do
+ let(:session_domain) { nil }
+ it_behaves_like "it received syntactically invalid credentials"
+ end
+ end
+ end
+
+ context "when a syntactically valid username and password are supplied" do
+ context "when the password is non-nil and the domain is nil" do
+ let(:password) { "ponies" }
+ let(:session_domain) { nil }
+ it "does not raise an exception if it is initialized with a non-nil username, non-nil password, and a nil domain" do
+ expect { session }.not_to raise_error
+ end
+
+ it_behaves_like "it received valid credentials"
+ it_behaves_like "it received an incorrect username and password combination"
+ end
+
+ context "when the password and domain are non-nil" do
+ let(:password) { "ponies" }
+ let(:session_domain) { "fairyland" }
+ it "does not raise an exception if it is initialized with a non-nil username, non-nil password, and non-nil domain" do
+ expect { session }.not_to raise_error
+ end
+
+ it_behaves_like "it received valid credentials"
+ it_behaves_like "it received an incorrect username and password combination"
+ end
+
+ context "when the #open method has not been called" do
+ let(:password) { "ponies" }
+ let(:session_domain) { "fairyland" }
+ it_behaves_like "the session is not open"
+ end
+
+ context "when the session was opened" do
+ let(:password) { "ponies" }
+ let(:session_domain) { "fairyland" }
+
+ before do
+ expect(Chef::ReservedNames::Win32::API::Security).to receive(:LogonUserW).and_return(true)
+ expect { session.open }.not_to raise_error
+ end
+
+ it "raises an exception if #open is called" do
+ expect { session.open }.to raise_error(RuntimeError)
+ end
+
+ context "when the session was opened and then closed with the #close method" do
+ before do
+ expect(Chef::ReservedNames::Win32::API::System).to receive(:CloseHandle)
+ expect { session.close }.not_to raise_error
+ end
+ it_behaves_like "the session is not open"
+ end
+
+ it "can be closed and close the operating system handle" do
+ expect(Chef::ReservedNames::Win32::API::System).to receive(:CloseHandle)
+ expect { session.close }.not_to raise_error
+ end
+
+ it "can impersonate the user" do
+ expect(Chef::ReservedNames::Win32::API::Security).to receive(:ImpersonateLoggedOnUser).and_return(true)
+ expect { session.set_user_context }.not_to raise_error
+ end
+
+ context "when #set_user_context fails due to low resources causing a failure to impersonate" do
+ before do
+ expect(Chef::ReservedNames::Win32::API::Security).to receive(:ImpersonateLoggedOnUser).and_return(false)
+ end
+
+ it "raises an exception when #set_user_context fails because impersonation failed" do
+ expect { session.set_user_context }.to raise_error(Chef::Exceptions::Win32APIError)
+ end
+
+ context "when calling subsequent methods" do
+ before do
+ expect { session.set_user_context }.to raise_error(Chef::Exceptions::Win32APIError)
+ expect(Chef::ReservedNames::Win32::API::Security).not_to receive(:RevertToSelf)
+ end
+
+ it_behaves_like "the session is open"
+ end
+ end
+
+ context "when #set_user_context successfully impersonates the user" do
+ before do
+ expect(Chef::ReservedNames::Win32::API::Security).to receive(:ImpersonateLoggedOnUser).and_return(true)
+ expect { session.set_user_context }.not_to raise_error
+ end
+
+ context "when attempting to impersonate while already impersonating" do
+ it "raises an error if the #set_user_context is called again" do
+ expect { session.set_user_context }.to raise_error(RuntimeError)
+ end
+ end
+
+ describe "the impersonation will be reverted" do
+ before do
+ expect(Chef::ReservedNames::Win32::API::Security).to receive(:RevertToSelf).and_return(true)
+ end
+ it_behaves_like "the session is open"
+ end
+
+ context "when the attempt to revert impersonation fails" do
+ before do
+ expect(Chef::ReservedNames::Win32::API::Security).to receive(:RevertToSelf).and_return(false)
+ end
+
+ it "raises an exception when #restore_user_context is called" do
+ expect { session.restore_user_context }.to raise_error(Chef::Exceptions::Win32APIError)
+ end
+
+ it "raises an exception when #close is called and impersonation fails" do
+ expect { session.close }.to raise_error(Chef::Exceptions::Win32APIError)
+ end
+
+ context "when calling methods after revert fails in #restore_user_context" do
+ before do
+ expect { session.restore_user_context }.to raise_error(Chef::Exceptions::Win32APIError)
+ end
+
+ context "when revert continues to fail" do
+ before do
+ expect(Chef::ReservedNames::Win32::API::Security).to receive(:RevertToSelf).and_return(false)
+ end
+ it "raises an exception when #close is called and impersonation fails" do
+ expect { session.close }.to raise_error(Chef::Exceptions::Win32APIError)
+ end
+ end
+
+ context "when revert stops failing and succeeds" do
+ before do
+ expect(Chef::ReservedNames::Win32::API::Security).to receive(:RevertToSelf).and_return(true)
+ end
+
+ it "does not raise an exception when #restore_user_context is called" do
+ expect { session.restore_user_context }.not_to raise_error
+ end
+
+ it "does not raise an exception when #close is called" do
+ expect(Chef::ReservedNames::Win32::API::System).to receive(:CloseHandle)
+ expect { session.close }.not_to raise_error
+ end
+ end
+ end
+ end
+ end
+
+ end
+ end
+ end
+end
diff --git a/spec/unit/win32/link_spec.rb b/spec/unit/win32/link_spec.rb
new file mode 100644
index 0000000000..5f749c034e
--- /dev/null
+++ b/spec/unit/win32/link_spec.rb
@@ -0,0 +1,73 @@
+#
+# Copyright:: Copyright 2012-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/api/file"
+ require "chef/win32/file"
+ require "chef/win32/version"
+end
+
+describe Chef::ReservedNames::Win32::File, :windows_only do
+ context "#symlink" do
+ let(:with_privilege) { Chef::ReservedNames::Win32::API::File::SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE }
+ let(:without_privilege) { 0x0 }
+
+ context "an invalid parameter is passed" do
+ it "will throw an exception if an invalid parameter is passed" do
+ allow(File).to receive(:directory?).and_return(false)
+ allow(Chef::ReservedNames::Win32::File).to receive(:encode_path) { |a| a }
+ allow_any_instance_of(Chef::ReservedNames::Win32::Version).to receive(:windows_10?).and_return(true)
+ allow_any_instance_of(Chef::ReservedNames::Win32::Version).to receive(:build_number).and_return(1)
+ allow(Chef::ReservedNames::Win32::File).to receive(:CreateSymbolicLinkW).and_return(nil)
+
+ expect { Chef::ReservedNames::Win32::File.symlink("a", "b") }.to raise_error Chef::Exceptions::Win32APIError
+ end
+ end
+
+ context "a valid parameter is passed" do
+ before(:each) do
+ allow(File).to receive(:directory?).and_return(false)
+ allow(Chef::ReservedNames::Win32::File).to receive(:encode_path) { |a| a }
+ allow(Chef::ReservedNames::Win32::File).to receive(:CreateSymbolicLinkW).with(any_args) { "don't //actually// do this" }
+ end
+
+ it "will not pass the unpirivileged symlink flag if the node is not Windows 10" do
+ allow_any_instance_of(Chef::ReservedNames::Win32::Version).to receive(:windows_10?).and_return(false)
+
+ expect(Chef::ReservedNames::Win32::File).to receive(:CreateSymbolicLinkW).with("b", "a", without_privilege)
+ described_class.symlink("a", "b")
+ end
+
+ it "will not pass the unpirivileged symlink flag if the node is not at least Windows 10 Creators Update" do
+ allow_any_instance_of(Chef::ReservedNames::Win32::Version).to receive(:windows_10?).and_return(true)
+ allow_any_instance_of(Chef::ReservedNames::Win32::Version).to receive(:build_number).and_return(1)
+
+ expect(Chef::ReservedNames::Win32::File).to receive(:CreateSymbolicLinkW).with("b", "a", without_privilege)
+ described_class.symlink("a", "b")
+ end
+
+ it "will pass the unpirivileged symlink flag if the node is Windows 10 Creators Update or higher" do
+ allow_any_instance_of(Chef::ReservedNames::Win32::Version).to receive(:windows_10?).and_return(true)
+ allow_any_instance_of(Chef::ReservedNames::Win32::Version).to receive(:build_number).and_return(15063)
+
+ expect(Chef::ReservedNames::Win32::File).to receive(:CreateSymbolicLinkW).with("b", "a", with_privilege)
+ described_class.symlink("a", "b")
+ end
+ end
+ end
+end
diff --git a/tasks/changelog.rb b/tasks/changelog.rb
deleted file mode 100644
index 74ac704abf..0000000000
--- a/tasks/changelog.rb
+++ /dev/null
@@ -1,37 +0,0 @@
-begin
- require "github_changelog_generator/task"
- require "mixlib/install"
-
- namespace :changelog do
- # Fetch the latest version from mixlib-install
- def latest_stable_version
- # for 13.1, a 12.20 release was made after 13.0, which is busting the changelog generator. Reset this post 13.1 release
- "13.0.118"
- # Mixlib::Install.available_versions("chef", "stable").last
- end
-
- # Take the changelog from the latest stable release and put it into history.
- task :archive do
- changelog = Net::HTTP.get(URI("https://raw.githubusercontent.com/chef/chef/v#{latest_stable_version}/CHANGELOG.md")).chomp.split("\n")
- File.open("HISTORY.md", "w+") { |f| f.write(changelog[2..-4].join("\n")) }
- end
-
- # Run this to just update the changelog for the current release. This will
- # take what is in HISTORY and generate a changelog of PRs between the most
- # recent stable version and HEAD.
- GitHubChangelogGenerator::RakeTask.new :update do |config|
- config.future_release = "v#{Chef::VERSION}"
- config.between_tags = ["v#{latest_stable_version}", "v#{Chef::VERSION}"]
- config.max_issues = 0
- config.add_issues_wo_labels = false
- config.enhancement_labels = "enhancement,Enhancement,New Feature,Feature".split(",")
- config.bug_labels = "bug,Bug,Improvement,Upstream Bug".split(",")
- config.exclude_labels = "duplicate,question,invalid,wontfix,no_changelog,Exclude From Changelog,Question,Discussion,Meta: Exclude From Changelog".split(",")
- config.header = "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)."
- end
- end
-
- task :changelog => "changelog:update"
-rescue LoadError
- puts "github_changelog_generator is not available. gem install github_changelog_generator to generate changelogs"
-end
diff --git a/tasks/dependencies.rb b/tasks/dependencies.rb
index c94e8b2ab2..1c4ec14911 100644
--- a/tasks/dependencies.rb
+++ b/tasks/dependencies.rb
@@ -37,7 +37,6 @@ namespace :dependencies do
desc "Update all dependencies. dependencies:update to update as little as possible (CI-only)."
task :update_ci => %w{
dependencies:update_gemfile_lock
- dependencies:update_omnibus_overrides
dependencies:update_omnibus_gemfile_lock
dependencies:update_acceptance_gemfile_lock
dependencies:update_kitchen_tests_gemfile_lock
diff --git a/tasks/maintainers.rb b/tasks/maintainers.rb
index e13d4724b0..f6385860c4 100644
--- a/tasks/maintainers.rb
+++ b/tasks/maintainers.rb
@@ -21,7 +21,7 @@ SOURCE = File.join(File.dirname(__FILE__), "..", "MAINTAINERS.toml")
TARGET = File.join(File.dirname(__FILE__), "..", "MAINTAINERS.md")
# The list of repositories that teams should own
-REPOSITORIES = ["chef/chef", "chef/chef-census", "chef/chef-repo",
+REPOSITORIES = ["chef/chef", "chef/chef-dk", "chef/chef-census", "chef/chef-repo",
"chef/client-docs", "chef/ffi-yajl", "chef/libyajl2-gem",
"chef/mixlib-authentication", "chef/mixlib-cli",
"chef/mixlib-config", "chef/mixlib-install", "chef/mixlib-log",
@@ -139,8 +139,8 @@ begin
update_team_privacy(team)
add_team_members(team, additions)
remove_team_members(team, deletions)
- rescue
- puts "failed for #{team}"
+ rescue => e
+ puts "failed for #{team}: #{e.message}"
end
def update_team_privacy(team)
diff --git a/tasks/version.rb b/tasks/version.rb
deleted file mode 100644
index e1fd538f68..0000000000
--- a/tasks/version.rb
+++ /dev/null
@@ -1,41 +0,0 @@
-#
-# 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.
-#
-
-task :ci_version_bump do
- begin
- require "rake"
-
- Rake::Task["version:bump_patch"].invoke
- Rake::Task["version:update"].invoke
-
- # We want to log errors that occur in the following tasks, but we don't
- # want them to stop an otherwise valid version bump from progressing.
- begin
- Rake::Task["changelog:update"].invoke
- rescue Exception => e
- puts "There was an error updating the CHANGELOG"
- puts e
- end
-
- begin
- Rake::Task["update_dockerfile"].invoke
- rescue Exception => e
- puts "There was an error updating the Dockerfile"
- puts e
- end
- end
-end