diff options
author | Jose Asuncion <jeunito@gmail.com> | 2017-07-06 07:29:29 -0700 |
---|---|---|
committer | Jose Asuncion <jeunito@gmail.com> | 2017-07-06 07:30:07 -0700 |
commit | 0eb90ddd97fa97e3a225453baaccf32194aef06d (patch) | |
tree | 8d43fe80fd80b8b00b24287712f660b705b676f7 | |
parent | 606304ec18bd518c2eff9b9b4257aff55df50f2d (diff) | |
parent | 1da1234ee26dad05e8ca406d226478ef40e88195 (diff) | |
download | chef-0eb90ddd97fa97e3a225453baaccf32194aef06d.tar.gz |
Merge branch 'master' into feat/5556
Signed-off-by: Jose Asuncion <jeunito@gmail.com>
-rw-r--r-- | .gitignore | 3 | ||||
-rw-r--r-- | CHANGELOG.md | 5 | ||||
-rw-r--r-- | Dockerfile | 2 | ||||
-rw-r--r-- | Gemfile.lock | 10 | ||||
-rw-r--r-- | RELEASE_NOTES.md | 4 | ||||
-rw-r--r-- | VERSION | 2 | ||||
-rw-r--r-- | chef-config/lib/chef-config/version.rb | 2 | ||||
-rw-r--r-- | lib/chef/provider/mount/aix.rb | 57 | ||||
-rw-r--r-- | lib/chef/version.rb | 2 | ||||
-rw-r--r-- | spec/unit/provider/mount/aix_spec.rb | 34 |
10 files changed, 99 insertions, 22 deletions
diff --git a/.gitignore b/.gitignore index 984c86f9c4..846ffdcedd 100644 --- a/.gitignore +++ b/.gitignore @@ -54,3 +54,6 @@ acceptance/vendor kitchen-tests/vendor *.swp + +# Visual Studio Code files +.vscode diff --git a/CHANGELOG.md b/CHANGELOG.md index 3ebe7cb9dc..29273512e2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,7 @@ 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). -## [v13.2.21](https://github.com/chef/chef/tree/v13.2.21) (2017-06-30) -[Full Changelog](https://github.com/chef/chef/compare/v13.0.118...v13.2.21) +## [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) **Closed issues:** @@ -9,6 +9,7 @@ This changelog reflects the current state of chef's master branch on github and **Merged pull requests:** +- \[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)) diff --git a/Dockerfile b/Dockerfile index 3d0227c94b..4befc17d39 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ FROM busybox MAINTAINER Chef Software, Inc. <docker@chef.io> ARG CHANNEL=stable -ARG VERSION=13.1.31 +ARG VERSION=13.2.20 RUN wget "http://packages.chef.io/files/${CHANNEL}/chef/${VERSION}/el/5/chef-${VERSION}-1.el5.x86_64.rpm" -O /tmp/chef-client.rpm && \ rpm2cpio /tmp/chef-client.rpm | cpio -idmv && \ diff --git a/Gemfile.lock b/Gemfile.lock index 630c5d07ee..757efb6524 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -30,10 +30,10 @@ GIT PATH remote: . specs: - chef (13.2.21) + chef (13.3.1) addressable bundler (>= 1.10) - chef-config (= 13.2.21) + chef-config (= 13.3.1) chef-zero (>= 13.0) diff-lcs (~> 1.2, >= 1.2.4) erubis (~> 2.7) @@ -60,10 +60,10 @@ PATH specinfra (~> 2.10) syslog-logger (~> 1.6) uuidtools (~> 2.1.5) - chef (13.2.21-universal-mingw32) + chef (13.3.1-universal-mingw32) addressable bundler (>= 1.10) - chef-config (= 13.2.21) + chef-config (= 13.3.1) chef-zero (>= 13.0) diff-lcs (~> 1.2, >= 1.2.4) erubis (~> 2.7) @@ -105,7 +105,7 @@ PATH PATH remote: chef-config specs: - chef-config (13.2.21) + chef-config (13.3.1) addressable fuzzyurl mixlib-config (~> 2.0) diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 2d1444c40a..bd52f579ed 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -1,8 +1,8 @@ _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 +# Chef Client Release Notes 13.3: -# 13.2 +# Chef Client Release Notes 13.2: ## Properly send policyfile data @@ -1 +1 @@ -13.2.21
\ No newline at end of file +13.3.1
\ 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 1fec06eefd..ea61b842c4 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.2.21" + VERSION = "13.3.1" end # diff --git a/lib/chef/provider/mount/aix.rb b/lib/chef/provider/mount/aix.rb index 73460e84a1..ef760b0ba6 100644 --- a/lib/chef/provider/mount/aix.rb +++ b/lib/chef/provider/mount/aix.rb @@ -40,30 +40,60 @@ class Chef # Check to see if there is an entry in /etc/filesystems. Last entry for a volume wins. Using command "lsfs" to fetch entries. enabled = false + regex_arr = device_fstab_regex.split(":") + if regex_arr.size.eql?(2) + nodename = regex_arr[0] + devicename = regex_arr[1] + else + devicename = regex_arr[0] + end # lsfs o/p = #MountPoint:Device:Vfs:Nodename:Type:Size:Options:AutoMount:Acct # search only for current mount point shell_out("lsfs -c #{@new_resource.mount_point}").stdout.each_line do |line| case line when /^#\s/ next - when /^#{Regexp.escape(@new_resource.mount_point)}:#{device_fstab_regex}:(\S+):(\[\S+\])?:(\S+)?:(\S+):(\S+):(\S+):(\S+)/ + when /^#{Regexp.escape(@new_resource.mount_point)}:#{devicename}:(\S+):#{nodename}:(\S+)?:(\S+):(\S+):(\S+):(\S+)/ # mount point entry with ipv6 address for nodename (ipv6 address use ':') enabled = true @current_resource.fstype($1) - @current_resource.options($5) - Chef::Log.debug("Found mount #{device_fstab} to #{@new_resource.mount_point} in /etc/filesystems") + @current_resource.options($4) + Chef::Log.debug("Found mount point #{@new_resource.mount_point} :: device_type #{@current_resource.device_type} in /etc/filesystems") next - when /^#{Regexp.escape(@new_resource.mount_point)}:#{device_fstab_regex}::(\S+):(\S+)?:(\S+)?:(\S+):(\S+):(\S+):(\S+)/ + when /^#{Regexp.escape(@new_resource.mount_point)}:#{nodename}:(\S+)::(\S+)?:(\S+):(\S+):(\S+):(\S+)/ # mount point entry with hostname or ipv4 address enabled = true @current_resource.fstype($1) + @current_resource.options($4) + @current_resource.device("") + Chef::Log.debug("Found mount point #{@new_resource.mount_point} :: device_type #{@current_resource.device_type} in /etc/filesystems") + next + when /^#{Regexp.escape(@new_resource.mount_point)}:(\S+)?:(\S+):#{devicename}:(\S+)?:(\S+):(\S+):(\S+):(\S+)/ + # mount point entry with hostname or ipv4 address + enabled = true + @current_resource.fstype($2) @current_resource.options($5) - Chef::Log.debug("Found mount #{device_fstab} to #{@new_resource.mount_point} in /etc/filesystems") + @current_resource.device(devicename + "/") + Chef::Log.debug("Found mount point #{@new_resource.mount_point} :: device_type #{@current_resource.device_type} in /etc/filesystems") next - when /^#{Regexp.escape(@new_resource.mount_point)}/ - enabled = false - Chef::Log.debug("Found conflicting mount point #{@new_resource.mount_point} in /etc/filesystems") + when /^#{Regexp.escape(@new_resource.mount_point)}:(.*?):(.*?):(.*?):(.*?):(.*?):(.*?):(.*?):(.*?)/ + if $3.split("=")[0].eql?("LABEL") || $1.split("=")[0].eql?("LABEL") + @current_resource.device_type("label") + elsif $3.split("=")[0].eql?("UUID") || $1.split("=")[0].eql?("UUID") + @current_resource.device_type("uuid") + else + @current_resource.device_type("device") + end + + if @current_resource.device_type != @new_resource.device_type + enabled = true + Chef::Log.debug("Found mount point #{@new_resource.mount_point} :: device_type #{@current_resource.device_type} in /etc/filesystems") + else + enabled = false + Chef::Log.debug("Found conflicting mount point #{@new_resource.mount_point} in /etc/filesystems") + end end + end @current_resource.enabled(enabled) end @@ -149,6 +179,17 @@ class Chef end end + def mount_options_unchanged? + current_resource_options = @current_resource.options.delete_if { |x| x == "rw" } + + @current_resource.device == @new_resource.device && + @current_resource.fsck_device == @new_resource.fsck_device && + @current_resource.fstype == @new_resource.fstype && + current_resource_options == @new_resource.options && + @current_resource.dump == @new_resource.dump && + @current_resource.pass == @new_resource.pass + end + def disable_fs contents = [] if @current_resource.enabled diff --git a/lib/chef/version.rb b/lib/chef/version.rb index 7353402804..b969e726a5 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.2.21") + VERSION = Chef::VersionString.new("13.3.1") end # diff --git a/spec/unit/provider/mount/aix_spec.rb b/spec/unit/provider/mount/aix_spec.rb index 3371c270c5..615f3c3304 100644 --- a/spec/unit/provider/mount/aix_spec.rb +++ b/spec/unit/provider/mount/aix_spec.rb @@ -44,6 +44,11 @@ MOUNT #MountPoint:Device:Vfs:Nodename:Type:Size:Options:AutoMount:Acct /tmp/foo:/dev/sdz1:jfs2::bootfs:10485760:rw:yes:no ENABLED + + @test_wrong_output = <<-WRONG +#MountPoint:Device:Vfs:Nodename:Type:Size:Options:AutoMount:Acct +/tmp/foo::/dev/sdz1:jfs2:bootfs:10485760:rw:yes:no +WRONG end before(:each) do @@ -102,6 +107,25 @@ ENABLED expect(@provider.current_resource.mounted).to be_falsey end + + context "mount_options_unchanged?" do + it "should return true if mounted device is the same" do + stub_mounted_enabled(@provider, @mounted_output, @enabled_output) + @provider.load_current_resource + + allow(@provider.current_resource).to receive(:fstype).and_return("jfs2") + expect(@provider.send :mount_options_unchanged?).to be true + end + + it "should return false if mounted device has changed" do + stub_mounted_enabled(@provider, @mounted_output, @enabled_output) + @provider.load_current_resource + + allow(@provider.current_resource).to receive(:fstype).and_return("XXXX") + expect(@provider.send :mount_options_unchanged?).to be false + end + end + end # tests for #enabled? @@ -188,12 +212,20 @@ ENABLED it "should not enable mount if it is mounted and already enabled and mount options are unchanged" do stub_mounted_enabled(@provider, @mounted_output, @enabled_output) - @new_resource.options "rw" expect(@provider).not_to receive(:enable_fs) @provider.run_action(:enable) end + + it "should return false if enabled_output is given in wrong syntax" do + stub_mounted_enabled(@provider, @mounted_output, @test_wrong_output) + + expect(@provider).to receive(:enable_fs) + + @provider.run_action(:enable) + end + end describe "disable_fs" do |