summaryrefslogtreecommitdiff
path: root/lib/chef/provider/mount/solaris.rb
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2014-05-23 14:08:47 -0700
committerLamont Granquist <lamont@scriptkiddie.org>2014-05-29 10:30:29 -0700
commit2252c6a3147465dd35b0965580d4215a507359b4 (patch)
treec7f78b83b4dac9bf5b7bce3ade1f59145b100f8b /lib/chef/provider/mount/solaris.rb
parent60661f1bf977d319c3dd40839a3bd1d654aa0276 (diff)
downloadchef-2252c6a3147465dd35b0965580d4215a507359b4.tar.gz
turn mountable? into define_resource_requirements
Diffstat (limited to 'lib/chef/provider/mount/solaris.rb')
-rw-r--r--lib/chef/provider/mount/solaris.rb37
1 files changed, 18 insertions, 19 deletions
diff --git a/lib/chef/provider/mount/solaris.rb b/lib/chef/provider/mount/solaris.rb
index fdcea7501f..f39e4034c2 100644
--- a/lib/chef/provider/mount/solaris.rb
+++ b/lib/chef/provider/mount/solaris.rb
@@ -1,11 +1,8 @@
-# Author:: Hugo Fichter
-# Based on previous work from Joshua Timberman
-# (See original header below)
-# License:: Apache License, Version 2.0
-
#
-# Author:: Joshua Timberman (<joshua@opscode.com>)
-# Copyright:: Copyright (c) 2009 Opscode, Inc
+# Author:: Hugo Fichter
+# Author:: Lamont Granquist (<lamont@getchef.com>)
+# Author:: Joshua Timberman (<joshua@getchef.com>)
+# Copyright:: Copyright (c) 2009-2014 Opscode, Inc
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -46,10 +43,23 @@ class Chef
current_resource.enabled(enabled?)
end
+ def define_resource_requirements do
+ requirements.assert(:mount, :remount) do |a|
+ a.assertion { !device_should_exist? || ::File.exists?(new_resource.device) }
+ a.failure_message(Chef::Exceptions::Mount, "Device #{new_resource.device} does not exist")
+ a.whyrun("Assuming device #{new_resource.device} would have been created")
+ end
+
+ requirements.assert(:mount, :remount) do |a|
+ a.assertion { ::File.exists?(new_resource.mount_point) }
+ a.failure_message(Chef::Exceptions::Mount, "Mount point #{new_resource.mount_point} does not exist")
+ a.whyrun("Assuming mount point #{new_resource.mount_point} would have been created")
+ end
+ end
+
protected
def mount_fs
- mountable?
actual_options = unless new_resource.options.nil?
new_resource.options(new_resource.options.delete("noauto"))
end
@@ -114,17 +124,6 @@ class Chef
private
- # FIXME: should be mountable! and probably should be in define_resource_requirements
- def mountable?
- # only check for existence of non-remote devices
- if (device_should_exist? && !::File.exists?(new_resource.device) )
- raise Chef::Exceptions::Mount, "Device #{new_resource.device} does not exist"
- elsif( !::File.exists?(new_resource.mount_point) )
- raise Chef::Exceptions::Mount, "Mount point #{new_resource.mount_point} does not exist"
- end
- true
- end
-
def enabled?
# Check to see if there is a entry in /etc/vfstab. Last entry for a volume wins.
enabled = false