diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2014-06-02 14:51:28 -0700 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2014-06-02 14:51:28 -0700 |
commit | c007919ab4c8717eb749e16a016b94e60d879598 (patch) | |
tree | 02431ff2ac24f77adf0c6e8807d4e3009b68e2d7 /lib/chef | |
parent | eb5b359cb7e88fc10f418223c23ba143793ce89c (diff) | |
download | chef-c007919ab4c8717eb749e16a016b94e60d879598.tar.gz |
move validation to resource code
Diffstat (limited to 'lib/chef')
-rw-r--r-- | lib/chef/provider/mount/solaris.rb | 4 | ||||
-rw-r--r-- | lib/chef/resource/mount.rb | 10 |
2 files changed, 8 insertions, 6 deletions
diff --git a/lib/chef/provider/mount/solaris.rb b/lib/chef/provider/mount/solaris.rb index bb76831559..fb4150e810 100644 --- a/lib/chef/provider/mount/solaris.rb +++ b/lib/chef/provider/mount/solaris.rb @@ -48,10 +48,6 @@ class Chef end def define_resource_requirements - if device_type != :device - raise Chef::Exceptions::Mount, "Mount resource can only be of device_type ':device' on Solaris" - end - requirements.assert(:mount, :remount) do |a| a.assertion { !device_should_exist? || ::File.exist?(device) } a.failure_message(Chef::Exceptions::Mount, "Device #{device} does not exist") diff --git a/lib/chef/resource/mount.rb b/lib/chef/resource/mount.rb index 507c5329e3..4b6a8461e9 100644 --- a/lib/chef/resource/mount.rb +++ b/lib/chef/resource/mount.rb @@ -42,6 +42,7 @@ class Chef @action = :mount @supports = { :remount => false } @allowed_actions.push(:mount, :umount, :remount, :enable, :disable) + @allowed_actions.push(:mount, :umount, :remount, :enable, :disable) @username = nil @password = nil @domain = nil @@ -65,10 +66,15 @@ class Chef def device_type(arg=nil) real_arg = arg.kind_of?(String) ? arg.to_sym : arg + valid_devices = if RUBY_PLATFORM =~ /solaris/i + [ :device ] + else + [ :device, :label, :uuid ] + end set_or_return( :device_type, real_arg, - :equal_to => [ :device, :label, :uuid ] + :equal_to => valid_devices, ) end @@ -76,7 +82,7 @@ class Chef set_or_return( :fstype, arg, - :kind_of => [ String ] + :kind_of => [ String ], ) end |