summaryrefslogtreecommitdiff
path: root/lib/chef/provider/mount
diff options
context:
space:
mode:
authorDeepali Jagtap <deepali.jagtap@gmail.com>2013-07-17 16:11:35 +0530
committeradamedx <adamed@opscode.com>2013-07-22 04:20:31 -0700
commit80093622f8df0fc27a4737c68c70d148af67186a (patch)
tree69f874a0194c1d5e92adb4cb147ee6fc0b795f03 /lib/chef/provider/mount
parentcdcd1ac140a5127e2a4c6821ac1ce03c4c3231e3 (diff)
downloadchef-80093622f8df0fc27a4737c68c70d148af67186a.tar.gz
Incorporated review comments
Diffstat (limited to 'lib/chef/provider/mount')
-rw-r--r--lib/chef/provider/mount/aix.rb42
-rw-r--r--lib/chef/provider/mount/mount.rb2
2 files changed, 22 insertions, 22 deletions
diff --git a/lib/chef/provider/mount/aix.rb b/lib/chef/provider/mount/aix.rb
index 18933a89f2..625871f8fb 100644
--- a/lib/chef/provider/mount/aix.rb
+++ b/lib/chef/provider/mount/aix.rb
@@ -26,12 +26,13 @@ class Chef
# Override for aix specific handling
def initialize(new_resource, run_context)
super
- if @new_resource.options[0] == "defaults"
- @new_resource.options.clear
- end
- if @new_resource.fstype == "auto"
- @new_resource.fstype = nil
- end
+ # 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
+ end
+ if @new_resource.fstype == "auto"
+ @new_resource.fstype = nil
+ end
end
def enabled?
@@ -43,7 +44,7 @@ class Chef
shell_out("lsfs -c #{@new_resource.mount_point}").stdout.each_line do | line |
case line
when /^#\s/
- next
+ next
when /^#{Regexp.escape(@new_resource.mount_point)}:#{device_fstab_regex}:(\S+):(\[\S+\])?:(\S+)?:(\S+):(\S+):(\S+):(\S+)/
# mount point entry with ipv6 address for nodename (ipv6 address use ':')
enabled = true
@@ -76,14 +77,14 @@ class Chef
search_device = device_fstab_regex
end
case line
- when /#{search_device}\s+#{Regexp.escape(@new_resource.mount_point)}/
- mounted = true
- Chef::Log.debug("Special device #{device_logstring} mounted as #{@new_resource.mount_point}")
- puts #{mounted}
- when /^[\/\w]+\s+#{Regexp.escape(@new_resource.mount_point)}\s+/
- enabled = false
- Chef::Log.debug("Found conflicting mount point #{@new_resource.mount_point} in /etc/fstab")
- end
+ when /#{search_device}\s+#{Regexp.escape(@new_resource.mount_point)}/
+ mounted = true
+ Chef::Log.debug("Special device #{device_logstring} mounted as #{@new_resource.mount_point}")
+ puts #{mounted}
+ when /^[\/\w]+\s+#{Regexp.escape(@new_resource.mount_point)}\s+/
+ mounted = false
+ Chef::Log.debug("Found conflicting mount point #{@new_resource.mount_point} in /etc/fstab")
+ end
end
@current_resource.mounted(mounted)
end
@@ -123,8 +124,7 @@ class Chef
def enable_fs
if @current_resource.enabled && mount_options_unchanged?
- Chef::Log.debug("#{@new_resource} is already enabled - nothing to do
-")
+ Chef::Log.debug("#{@new_resource} is already enabled - nothing to do")
return nil
end
@@ -155,7 +155,7 @@ class Chef
contents = []
if @current_resource.enabled
found_device = false
- ::File.open("/etc/filesystems", "r").each_line do |line|
+ ::File.open("/etc/filesystems", "r").each_line do |line|
case line
when /^\/[\/\w]+:$/
if line =~ /#{Regexp.escape(@new_resource.mount_point)}+:/
@@ -167,13 +167,13 @@ class Chef
if !found_device
contents << line
end
+ end
+ ::File.open("/etc/filesystems", "w") do |fstab|
+ contents.each { |line| fstab.puts line}
end
else
Chef::Log.debug("#{@new_resource} is not enabled - nothing to do")
end
- ::File.open("/etc/filesystems", "w") do |fstab|
- contents.each { |line| fstab.puts line}
- end
end
end
diff --git a/lib/chef/provider/mount/mount.rb b/lib/chef/provider/mount/mount.rb
index d0a053360e..7f256bad21 100644
--- a/lib/chef/provider/mount/mount.rb
+++ b/lib/chef/provider/mount/mount.rb
@@ -252,7 +252,7 @@ class Chef
def mount_options_unchanged?
@current_resource.fstype == @new_resource.fstype and
- @current_resource.options.sort == @new_resource.options.sort and
+ @current_resource.options == @new_resource.options and
@current_resource.dump == @new_resource.dump and
@current_resource.pass == @new_resource.pass
end