summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.travis.yml36
-rw-r--r--CHANGELOG.md9
-rw-r--r--Gemfile.lock10
-rw-r--r--VERSION2
-rw-r--r--chef-config/lib/chef-config/version.rb2
-rw-r--r--kitchen-tests/.kitchen.travis.yml3
-rw-r--r--kitchen-tests/.kitchen.yml1
-rw-r--r--kitchen-tests/Berksfile.lock17
-rw-r--r--kitchen-tests/cookbooks/audit_test/.gitignore15
-rw-r--r--kitchen-tests/cookbooks/audit_test/chefignore95
-rw-r--r--kitchen-tests/cookbooks/base/attributes/default.rb1
-rw-r--r--lib/chef/node_map.rb2
-rw-r--r--lib/chef/provider/systemd_unit.rb67
-rw-r--r--lib/chef/resource/systemd_unit.rb3
-rw-r--r--lib/chef/version.rb2
-rw-r--r--spec/unit/node_map_spec.rb18
16 files changed, 96 insertions, 187 deletions
diff --git a/.travis.yml b/.travis.yml
index 8e52f38611..80effc9fcf 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -217,24 +217,24 @@ matrix:
env:
- CENTOS=7
- KITCHEN_YAML=.kitchen.travis.yml
-# - rvm: 2.4.2
-# services: docker
-# sudo: required
-# gemfile: kitchen-tests/Gemfile
-# before_install:
-# - gem update --system $(grep rubygems omnibus_overrides.rb | cut -d'"' -f2)
-# - gem install bundler -v $(grep bundler omnibus_overrides.rb | cut -d'"' -f2)
-# bundler_args: --without ci docgen guard integration maintenance omnibus_package --frozen
-# before_script:
-# - sudo iptables -L DOCKER || ( echo "DOCKER iptables chain missing" ; sudo iptables -N DOCKER )
-# - cd kitchen-tests
-# script:
-# - bundle exec kitchen test base-fedora-latest
-# after_failure:
-# - cat .kitchen/logs/kitchen.log
-# env:
-# - FEDORA=latest
-# - KITCHEN_YAML=.kitchen.travis.yml
+ - rvm: 2.4.2
+ services: docker
+ sudo: required
+ gemfile: kitchen-tests/Gemfile
+ before_install:
+ - gem update --system $(grep rubygems omnibus_overrides.rb | cut -d'"' -f2)
+ - gem install bundler -v $(grep bundler omnibus_overrides.rb | cut -d'"' -f2)
+ bundler_args: --without ci docgen guard integration maintenance omnibus_package --frozen
+ before_script:
+ - sudo iptables -L DOCKER || ( echo "DOCKER iptables chain missing" ; sudo iptables -N DOCKER )
+ - cd kitchen-tests
+ script:
+ - bundle exec kitchen test base-fedora-latest
+ after_failure:
+ - cat .kitchen/logs/kitchen.log
+ env:
+ - FEDORA=latest
+ - KITCHEN_YAML=.kitchen.travis.yml
# - rvm: 2.4.2
# services: docker
# sudo: required
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8fd1bb1815..60a21df81f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,15 +1,18 @@
<!-- usage documentation: http://expeditor-docs.es.chef.io/configuration/changelog/ -->
-<!-- latest_release 13.6.17 -->
-## [v13.6.17](https://github.com/chef/chef/tree/v13.6.17) (2017-11-27)
+<!-- latest_release 13.6.20 -->
+## [v13.6.20](https://github.com/chef/chef/tree/v13.6.20) (2017-11-29)
#### Merged Pull Requests
-- Only warn if a secret was actually given [#6605](https://github.com/chef/chef/pull/6605) ([coderanger](https://github.com/coderanger))
+- add unit_name name_property to systemd_unit (fixes #6542) [#6546](https://github.com/chef/chef/pull/6546) ([nathwill](https://github.com/nathwill))
<!-- latest_release -->
<!-- release_rollup since=13.6.4 -->
### Changes since 13.6.4 release
#### Merged Pull Requests
+- add unit_name name_property to systemd_unit (fixes #6542) [#6546](https://github.com/chef/chef/pull/6546) ([nathwill](https://github.com/nathwill)) <!-- 13.6.20 -->
+- fix NodeMap to not throw exceptions on platform_versions [#6608](https://github.com/chef/chef/pull/6608) ([lamont-granquist](https://github.com/lamont-granquist)) <!-- 13.6.19 -->
+- Enable Fedora integration testing in Travis [#6523](https://github.com/chef/chef/pull/6523) ([tas50](https://github.com/tas50)) <!-- 13.6.18 -->
- Only warn if a secret was actually given [#6605](https://github.com/chef/chef/pull/6605) ([coderanger](https://github.com/coderanger)) <!-- 13.6.17 -->
- Makes life easier for hook authors switching from the older report handler syntax [#6574](https://github.com/chef/chef/pull/6574) ([coderanger](https://github.com/coderanger)) <!-- 13.6.16 -->
- [MSYS-688] Fixed invalid date and Invalid starttime error [#6544](https://github.com/chef/chef/pull/6544) ([NimishaS](https://github.com/NimishaS)) <!-- 13.6.15 -->
diff --git a/Gemfile.lock b/Gemfile.lock
index 6b32e1c93d..9da758e6f0 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -17,10 +17,10 @@ GIT
PATH
remote: .
specs:
- chef (13.6.17)
+ chef (13.6.20)
addressable
bundler (>= 1.10)
- chef-config (= 13.6.17)
+ chef-config (= 13.6.20)
chef-zero (>= 13.0)
diff-lcs (~> 1.2, >= 1.2.4)
erubis (~> 2.7)
@@ -47,10 +47,10 @@ PATH
specinfra (~> 2.10)
syslog-logger (~> 1.6)
uuidtools (~> 2.1.5)
- chef (13.6.17-universal-mingw32)
+ chef (13.6.20-universal-mingw32)
addressable
bundler (>= 1.10)
- chef-config (= 13.6.17)
+ chef-config (= 13.6.20)
chef-zero (>= 13.0)
diff-lcs (~> 1.2, >= 1.2.4)
erubis (~> 2.7)
@@ -92,7 +92,7 @@ PATH
PATH
remote: chef-config
specs:
- chef-config (13.6.17)
+ chef-config (13.6.20)
addressable
fuzzyurl
mixlib-config (~> 2.0)
diff --git a/VERSION b/VERSION
index 0f2711b72a..17303bdd18 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-13.6.17 \ No newline at end of file
+13.6.20 \ No newline at end of file
diff --git a/chef-config/lib/chef-config/version.rb b/chef-config/lib/chef-config/version.rb
index d63d24efbf..cfd5997db8 100644
--- a/chef-config/lib/chef-config/version.rb
+++ b/chef-config/lib/chef-config/version.rb
@@ -21,7 +21,7 @@
module ChefConfig
CHEFCONFIG_ROOT = File.expand_path("../..", __FILE__)
- VERSION = "13.6.17"
+ VERSION = "13.6.20"
end
#
diff --git a/kitchen-tests/.kitchen.travis.yml b/kitchen-tests/.kitchen.travis.yml
index 720f034cb5..7c00fdaeed 100644
--- a/kitchen-tests/.kitchen.travis.yml
+++ b/kitchen-tests/.kitchen.travis.yml
@@ -61,9 +61,6 @@ platforms:
intermediate_instructions:
- RUN yum -y install sudo
- RUN sed -i -e "s/Defaults.*requiretty.*/Defaults !requiretty/g" /etc/sudoers
- attributes:
- chef_client:
- init_style: init
- name: centos-7
driver:
diff --git a/kitchen-tests/.kitchen.yml b/kitchen-tests/.kitchen.yml
index 4e570b125e..bb9791de90 100644
--- a/kitchen-tests/.kitchen.yml
+++ b/kitchen-tests/.kitchen.yml
@@ -17,7 +17,6 @@ provisioner:
github_repo: "chef"
ohai_refname: "master"
refname: <%= %x(git rev-parse HEAD) %>
- data_path: test/fixtures
client_rb:
diff_disabled: true
diff --git a/kitchen-tests/Berksfile.lock b/kitchen-tests/Berksfile.lock
index 6cd1308fcd..98eaf17ca3 100644
--- a/kitchen-tests/Berksfile.lock
+++ b/kitchen-tests/Berksfile.lock
@@ -22,24 +22,23 @@ GRAPH
build-essential (8.0.3)
mingw (>= 1.1)
seven_zip (>= 0.0.0)
- chef-client (8.1.8)
- cron (>= 2.0.0)
+ chef-client (9.0.2)
+ cron (>= 4.2.0)
logrotate (>= 1.9.0)
windows (>= 2.0.0)
chef_hostname (0.6.1)
compat_resource (12.19.0)
- cron (4.1.3)
- compat_resource (>= 0.0.0)
- iptables (4.2.1)
+ cron (5.0.1)
+ iptables (4.3.1)
logrotate (2.2.0)
mingw (2.0.1)
seven_zip (>= 0.0.0)
multipackage (4.0.0)
compat_resource (>= 0.0.0)
nscd (5.0.0)
- ntp (3.5.2)
+ ntp (3.5.4)
ohai (5.2.0)
- openssh (2.5.0)
+ openssh (2.6.0)
iptables (>= 1.0)
resolver (2.0.1)
selinux (2.1.0)
@@ -48,6 +47,6 @@ GRAPH
sudo (3.5.3)
ubuntu (2.0.1)
apt (>= 0.0.0)
- users (5.1.0)
- windows (3.1.2)
+ users (5.2.1)
+ windows (3.4.0)
ohai (>= 4.0.0)
diff --git a/kitchen-tests/cookbooks/audit_test/.gitignore b/kitchen-tests/cookbooks/audit_test/.gitignore
deleted file mode 100644
index 1e074046f0..0000000000
--- a/kitchen-tests/cookbooks/audit_test/.gitignore
+++ /dev/null
@@ -1,15 +0,0 @@
-.vagrant
-*~
-*#
-.#*
-\#*#
-.*.sw[a-z]
-*.un~
-
-# Bundler
-Gemfile.lock
-bin/*
-.bundle/*
-
-.kitchen/
-.kitchen.local.yml
diff --git a/kitchen-tests/cookbooks/audit_test/chefignore b/kitchen-tests/cookbooks/audit_test/chefignore
deleted file mode 100644
index 80dc2d20ef..0000000000
--- a/kitchen-tests/cookbooks/audit_test/chefignore
+++ /dev/null
@@ -1,95 +0,0 @@
-# Put files/directories that should be ignored in this file when uploading
-# or sharing to the community site.
-# Lines that start with '# ' are comments.
-
-# OS generated files #
-######################
-.DS_Store
-Icon?
-nohup.out
-ehthumbs.db
-Thumbs.db
-
-# SASS #
-########
-.sass-cache
-
-# EDITORS #
-###########
-\#*
-.#*
-*~
-*.sw[a-z]
-*.bak
-REVISION
-TAGS*
-tmtags
-*_flymake.*
-*_flymake
-*.tmproj
-.project
-.settings
-mkmf.log
-
-## COMPILED ##
-##############
-a.out
-*.o
-*.pyc
-*.so
-*.com
-*.class
-*.dll
-*.exe
-*/rdoc/
-
-# Testing #
-###########
-.watchr
-.rspec
-spec/*
-spec/fixtures/*
-test/*
-features/*
-Guardfile
-Procfile
-
-# SCM #
-#######
-.git
-*/.git
-.gitignore
-.gitmodules
-.gitconfig
-.gitattributes
-.svn
-*/.bzr/*
-*/.hg/*
-*/.svn/*
-
-# Berkshelf #
-#############
-Berksfile
-Berksfile.lock
-cookbooks/*
-tmp
-
-# Cookbooks #
-#############
-CONTRIBUTING
-
-# Strainer #
-############
-Colanderfile
-Strainerfile
-.colander
-.strainer
-
-# Vagrant #
-###########
-.vagrant
-Vagrantfile
-
-# Travis #
-##########
-.travis.yml
diff --git a/kitchen-tests/cookbooks/base/attributes/default.rb b/kitchen-tests/cookbooks/base/attributes/default.rb
index 75e57cb27b..e22dfa9fae 100644
--- a/kitchen-tests/cookbooks/base/attributes/default.rb
+++ b/kitchen-tests/cookbooks/base/attributes/default.rb
@@ -43,7 +43,6 @@ default["openssh"]["server"]["challenge_response_authentication"] = "no"
default["openssh"]["server"]["kerberos_authentication"] = "no"
# tcp keepalives are useful to keep connections up through VPNs and firewalls
default["openssh"]["server"]["tcp_keepalive"] = "yes"
-default["openssh"]["server"]["use_privilege_separation"] = "yes"
default["openssh"]["server"]["max_start_ups"] = "10"
# PAM (i think) already prints the motd on login
default["openssh"]["server"]["print_motd"] = "no"
diff --git a/lib/chef/node_map.rb b/lib/chef/node_map.rb
index 7a1a09ae24..25b1f57d44 100644
--- a/lib/chef/node_map.rb
+++ b/lib/chef/node_map.rb
@@ -143,7 +143,7 @@ class Chef
filter_values.empty? ||
Array(filter_values).any? do |v|
- Chef::VersionConstraint::Platform.new(v).include?(value)
+ Gem::Requirement.new(v).satisfied_by?(Gem::Version.new(value))
end
end
diff --git a/lib/chef/provider/systemd_unit.rb b/lib/chef/provider/systemd_unit.rb
index a2ef64044b..e1853bd984 100644
--- a/lib/chef/provider/systemd_unit.rb
+++ b/lib/chef/provider/systemd_unit.rb
@@ -35,6 +35,7 @@ class Chef
def load_current_resource
@current_resource = Chef::Resource::SystemdUnit.new(new_resource.name)
+ current_resource.unit_name(new_resource.unit_name)
current_resource.content(::File.read(unit_path)) if ::File.exist?(unit_path)
current_resource.user(new_resource.user)
current_resource.enabled(enabled?)
@@ -57,7 +58,7 @@ class Chef
def action_create
if current_resource.content != new_resource.to_ini
- converge_by("creating unit: #{new_resource.name}") do
+ converge_by("creating unit: #{new_resource.unit_name}") do
manage_unit_file(:create)
daemon_reload if new_resource.triggers_reload
end
@@ -66,7 +67,7 @@ class Chef
def action_delete
if ::File.exist?(unit_path)
- converge_by("deleting unit: #{new_resource.name}") do
+ converge_by("deleting unit: #{new_resource.unit_name}") do
manage_unit_file(:delete)
daemon_reload if new_resource.triggers_reload
end
@@ -75,117 +76,117 @@ class Chef
def action_enable
if current_resource.static
- Chef::Log.debug("#{new_resource.name} is a static unit, enabling is a NOP.")
+ Chef::Log.debug("#{new_resource.unit_name} is a static unit, enabling is a NOP.")
end
unless current_resource.enabled || current_resource.static
- converge_by("enabling unit: #{new_resource.name}") do
- systemctl_execute!(:enable, new_resource.name)
+ converge_by("enabling unit: #{new_resource.unit_name}") do
+ systemctl_execute!(:enable, new_resource.unit_name)
end
end
end
def action_disable
if current_resource.static
- Chef::Log.debug("#{new_resource.name} is a static unit, disabling is a NOP.")
+ Chef::Log.debug("#{new_resource.unit_name} is a static unit, disabling is a NOP.")
end
if current_resource.enabled && !current_resource.static
- converge_by("disabling unit: #{new_resource.name}") do
- systemctl_execute!(:disable, new_resource.name)
+ converge_by("disabling unit: #{new_resource.unit_name}") do
+ systemctl_execute!(:disable, new_resource.unit_name)
end
end
end
def action_mask
unless current_resource.masked
- converge_by("masking unit: #{new_resource.name}") do
- systemctl_execute!(:mask, new_resource.name)
+ converge_by("masking unit: #{new_resource.unit_name}") do
+ systemctl_execute!(:mask, new_resource.unit_name)
end
end
end
def action_unmask
if current_resource.masked
- converge_by("unmasking unit: #{new_resource.name}") do
- systemctl_execute!(:unmask, new_resource.name)
+ converge_by("unmasking unit: #{new_resource.unit_name}") do
+ systemctl_execute!(:unmask, new_resource.unit_name)
end
end
end
def action_start
unless current_resource.active
- converge_by("starting unit: #{new_resource.name}") do
- systemctl_execute!(:start, new_resource.name)
+ converge_by("starting unit: #{new_resource.unit_name}") do
+ systemctl_execute!(:start, new_resource.unit_name)
end
end
end
def action_stop
if current_resource.active
- converge_by("stopping unit: #{new_resource.name}") do
- systemctl_execute!(:stop, new_resource.name)
+ converge_by("stopping unit: #{new_resource.unit_name}") do
+ systemctl_execute!(:stop, new_resource.unit_name)
end
end
end
def action_restart
- converge_by("restarting unit: #{new_resource.name}") do
- systemctl_execute!(:restart, new_resource.name)
+ converge_by("restarting unit: #{new_resource.unit_name}") do
+ systemctl_execute!(:restart, new_resource.unit_name)
end
end
def action_reload
if current_resource.active
- converge_by("reloading unit: #{new_resource.name}") do
- systemctl_execute!(:reload, new_resource.name)
+ converge_by("reloading unit: #{new_resource.unit_name}") do
+ systemctl_execute!(:reload, new_resource.unit_name)
end
else
- Chef::Log.debug("#{new_resource.name} is not active, skipping reload.")
+ Chef::Log.debug("#{new_resource.unit_name} is not active, skipping reload.")
end
end
def action_try_restart
- converge_by("try-restarting unit: #{new_resource.name}") do
- systemctl_execute!("try-restart", new_resource.name)
+ converge_by("try-restarting unit: #{new_resource.unit_name}") do
+ systemctl_execute!("try-restart", new_resource.unit_name)
end
end
def action_reload_or_restart
- converge_by("reload-or-restarting unit: #{new_resource.name}") do
- systemctl_execute!("reload-or-restart", new_resource.name)
+ converge_by("reload-or-restarting unit: #{new_resource.unit_name}") do
+ systemctl_execute!("reload-or-restart", new_resource.unit_name)
end
end
def action_reload_or_try_restart
- converge_by("reload-or-try-restarting unit: #{new_resource.name}") do
- systemctl_execute!("reload-or-try-restart", new_resource.name)
+ converge_by("reload-or-try-restarting unit: #{new_resource.unit_name}") do
+ systemctl_execute!("reload-or-try-restart", new_resource.unit_name)
end
end
def active?
- systemctl_execute("is-active", new_resource.name).exitstatus == 0
+ systemctl_execute("is-active", new_resource.unit_name).exitstatus == 0
end
def enabled?
- systemctl_execute("is-enabled", new_resource.name).exitstatus == 0
+ systemctl_execute("is-enabled", new_resource.unit_name).exitstatus == 0
end
def masked?
- systemctl_execute(:status, new_resource.name).stdout.include?("masked")
+ systemctl_execute(:status, new_resource.unit_name).stdout.include?("masked")
end
def static?
- systemctl_execute("is-enabled", new_resource.name).stdout.include?("static")
+ systemctl_execute("is-enabled", new_resource.unit_name).stdout.include?("static")
end
private
def unit_path
if new_resource.user
- "/etc/systemd/user/#{new_resource.name}"
+ "/etc/systemd/user/#{new_resource.unit_name}"
else
- "/etc/systemd/system/#{new_resource.name}"
+ "/etc/systemd/system/#{new_resource.unit_name}"
end
end
diff --git a/lib/chef/resource/systemd_unit.rb b/lib/chef/resource/systemd_unit.rb
index 1a19a7d682..66c4e6f594 100644
--- a/lib/chef/resource/systemd_unit.rb
+++ b/lib/chef/resource/systemd_unit.rb
@@ -46,6 +46,9 @@ class Chef
default: true, desired_state: false
property :verify, [TrueClass, FalseClass],
default: true, desired_state: false
+ property :unit_name, String, desired_state: false,
+ identity: true,
+ name_property: true
def to_ini
case content
diff --git a/lib/chef/version.rb b/lib/chef/version.rb
index 492da224c5..01f95d065c 100644
--- a/lib/chef/version.rb
+++ b/lib/chef/version.rb
@@ -23,7 +23,7 @@ require "chef/version_string"
class Chef
CHEF_ROOT = File.expand_path("../..", __FILE__)
- VERSION = Chef::VersionString.new("13.6.17")
+ VERSION = Chef::VersionString.new("13.6.20")
end
#
diff --git a/spec/unit/node_map_spec.rb b/spec/unit/node_map_spec.rb
index 822f689eab..64106323c2 100644
--- a/spec/unit/node_map_spec.rb
+++ b/spec/unit/node_map_spec.rb
@@ -101,6 +101,24 @@ describe Chef::NodeMap do
end
end
+ describe "platform version checks" do
+ before do
+ node_map.set(:thing, :foo, platform_family: "rhel", platform_version: ">= 7")
+ end
+
+ it "handles non-x.y.z platform versions without throwing an exception" do
+ allow(node).to receive(:[]).with(:platform_family).and_return("rhel")
+ allow(node).to receive(:[]).with(:platform_version).and_return("7.19.2.2F")
+ expect(node_map.get(node, :thing)).to eql(:foo)
+ end
+
+ it "handles non-x.y.z platform versions without throwing an exception when the match fails" do
+ allow(node).to receive(:[]).with(:platform_family).and_return("rhel")
+ allow(node).to receive(:[]).with(:platform_version).and_return("4.19.2.2F")
+ expect(node_map.get(node, :thing)).to eql(nil)
+ end
+ end
+
describe "with a block doing platform_version checks" do
before do
node_map.set(:thing, :foo, platform_family: "rhel") do |node|