diff options
author | Thom May <thom@chef.io> | 2018-03-13 14:16:03 +0000 |
---|---|---|
committer | Thom May <thom@chef.io> | 2018-03-14 16:29:48 +0000 |
commit | c4ce9d9393d88f1f441f588fed70720b747cfd72 (patch) | |
tree | d923ef73e54dcaeb50eee47ceba8bae623f6b46f /lib/chef/provider | |
parent | 61e3d4bb382da5a0f6c09dd144ce4c6fc96c3ca9 (diff) | |
download | chef-c4ce9d9393d88f1f441f588fed70720b747cfd72.tar.gz |
Clean up mount provider teststm/6851
Signed-off-by: Thom May <thom@chef.io>
Diffstat (limited to 'lib/chef/provider')
-rw-r--r-- | lib/chef/provider/mount/aix.rb | 2 | ||||
-rw-r--r-- | lib/chef/provider/mount/solaris.rb | 27 |
2 files changed, 15 insertions, 14 deletions
diff --git a/lib/chef/provider/mount/aix.rb b/lib/chef/provider/mount/aix.rb index 240b71f747..4b60a4295d 100644 --- a/lib/chef/provider/mount/aix.rb +++ b/lib/chef/provider/mount/aix.rb @@ -28,7 +28,7 @@ class Chef super # options and fstype are set to "defaults" and "auto" respectively in the Mount Resource class. These options are not valid for AIX, override them. if @new_resource.options[0] == "defaults" - @new_resource.options.clear + @new_resource.options([]) end if @new_resource.fstype == "auto" @new_resource.send(:clear_fstype) diff --git a/lib/chef/provider/mount/solaris.rb b/lib/chef/provider/mount/solaris.rb index a5a7a327cb..f59a2d2c6a 100644 --- a/lib/chef/provider/mount/solaris.rb +++ b/lib/chef/provider/mount/solaris.rb @@ -121,8 +121,8 @@ class Chef end def mount_options_unchanged? - new_options = options_remove_noauto(options) - current_options = options_remove_noauto(current_resource.nil? ? nil : current_resource.options) + new_options = native_options(options) + current_options = native_options(current_resource.nil? ? nil : current_resource.options) current_resource.fsck_device == fsck_device && current_resource.fstype == fstype && @@ -168,7 +168,8 @@ class Chef def read_vfstab_status # Check to see if there is an entry in /etc/vfstab. Last entry for a volume wins. enabled = false - fstype = options = pass = nil + pass = false + fstype = options = nil ::File.foreach(VFSTAB) do |line| case line when /^[#\s]/ @@ -220,11 +221,7 @@ class Chef end def vfstab_entry - actual_options = unless options.nil? - tempops = options.dup - tempops.delete("noauto") - tempops - end + actual_options = native_options(options) autostr = mount_at_boot? ? "yes" : "no" passstr = pass == 0 ? "-" : pass optstr = (actual_options.nil? || actual_options.empty?) ? "-" : actual_options.join(",") @@ -251,11 +248,15 @@ class Chef contents << vfstab_entry end - def options_remove_noauto(temp_options) - new_options = [] - new_options += temp_options.nil? ? [] : temp_options - new_options.delete("noauto") - new_options + def native_options(temp_options) + if temp_options == %w{defaults} + ["-"] + else + new_options = [] + new_options += temp_options.nil? ? [] : temp_options.dup + new_options.delete("noauto") + new_options + end end def device_regex |