diff options
Diffstat (limited to 'lib/chef/provider/mount')
-rw-r--r-- | lib/chef/provider/mount/aix.rb | 12 | ||||
-rw-r--r-- | lib/chef/provider/mount/mount.rb | 20 |
2 files changed, 16 insertions, 16 deletions
diff --git a/lib/chef/provider/mount/aix.rb b/lib/chef/provider/mount/aix.rb index 128bb4c6c3..0d7e11a1b8 100644 --- a/lib/chef/provider/mount/aix.rb +++ b/lib/chef/provider/mount/aix.rb @@ -1,5 +1,5 @@ # -# Author:: +# Author:: # Copyright:: Copyright (c) 2009 Opscode, Inc # License:: Apache License, Version 2.0 # @@ -38,7 +38,7 @@ class Chef def enabled? # 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 - + # 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 | @@ -74,8 +74,8 @@ class Chef device_details = device_fstab.split(":") search_device = device_details[1] else - search_device = device_fstab_regex - end + search_device = device_fstab_regex + end case line when /#{search_device}\s+#{Regexp.escape(@new_resource.mount_point)}/ mounted = true @@ -140,7 +140,7 @@ class Chef fstab.puts("\tnodename\t\t= #{device_details[0]}") else fstab.puts("\tdev\t\t= #{device_fstab}") - end + end fstab.puts("\tvfs\t\t= #{@new_resource.fstype}") fstab.puts("\tmount\t\t= false") fstab.puts "\toptions\t\t= #{@new_resource.options.join(',')}" unless @new_resource.options.nil? || @new_resource.options.empty? @@ -164,7 +164,7 @@ class Chef if !found_device contents << line end - end + end ::File.open("/etc/filesystems", "w") do |fstab| contents.each { |line| fstab.puts line} end diff --git a/lib/chef/provider/mount/mount.rb b/lib/chef/provider/mount/mount.rb index f7118d6c3c..7a8c87c718 100644 --- a/lib/chef/provider/mount/mount.rb +++ b/lib/chef/provider/mount/mount.rb @@ -39,7 +39,7 @@ class Chef mounted? enabled? end - + def mountable? # only check for existence of non-remote devices if (device_should_exist? && !::File.exists?(device_real) ) @@ -49,7 +49,7 @@ class Chef end return true end - + def enabled? # Check to see if there is a entry in /etc/fstab. Last entry for a volume wins. enabled = false @@ -72,7 +72,7 @@ class Chef end @current_resource.enabled(enabled) end - + def mounted? mounted = false shell_out!("mount").stdout.each_line do |line| @@ -141,7 +141,7 @@ class Chef Chef::Log.debug("#{@new_resource} is already enabled - nothing to do") return nil end - + if @current_resource.enabled # The current options don't match what we have, so # disable, then enable. @@ -156,7 +156,7 @@ class Chef def disable_fs if @current_resource.enabled contents = [] - + found = false ::File.readlines("/etc/fstab").reverse_each do |line| if !found && line =~ /^#{device_fstab_regex}\s+#{Regexp.escape(@new_resource.mount_point)}/ @@ -167,7 +167,7 @@ class Chef contents << line end end - + ::File.open("/etc/fstab", "w") do |fstab| contents.reverse_each { |line| fstab.puts line} end @@ -181,7 +181,7 @@ class Chef end def device_should_exist? - ( @new_resource.device != "none" ) && + ( @new_resource.device != "none" ) && ( not network_device? ) && ( not %w[ tmpfs fuse ].include? @new_resource.fstype ) end @@ -200,7 +200,7 @@ class Chef end def device_real - if @real_device == nil + if @real_device == nil if @new_resource.device_type == :device @real_device = @new_resource.device else @@ -247,14 +247,14 @@ class Chef device_fstab end end - + def mount_options_unchanged? @current_resource.fstype == @new_resource.fstype and @current_resource.options == @new_resource.options and @current_resource.dump == @new_resource.dump and @current_resource.pass == @new_resource.pass end - + end end end |