diff options
author | Thom May <thom@may.lt> | 2018-02-23 11:34:54 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-23 11:34:54 +0000 |
commit | 60683ae0a12af882a37e778c5949df5840548ee3 (patch) | |
tree | 7ec0fc607962986755d113db6bc3375f2bbb2f95 | |
parent | eda02bf4266b097c4b956b1cbc4bf3756c47271a (diff) | |
parent | c6ba4150220f4befd4cc1c389035cb7efacf8e32 (diff) | |
download | chef-60683ae0a12af882a37e778c5949df5840548ee3.tar.gz |
Merge pull request #6905 from chef/mdadm
Modernize mdadm
-rw-r--r-- | lib/chef/resource/mdadm.rb | 90 |
1 files changed, 9 insertions, 81 deletions
diff --git a/lib/chef/resource/mdadm.rb b/lib/chef/resource/mdadm.rb index 354582d1cf..6d4014b110 100644 --- a/lib/chef/resource/mdadm.rb +++ b/lib/chef/resource/mdadm.rb @@ -26,91 +26,19 @@ class Chef # reboot. If the config file is required, it must be done by specifying a template with the correct array layout, # and then by using the mount provider to create a file systems table (fstab) entry. class Mdadm < Chef::Resource - - identity_attr :raid_device - - state_attrs :devices, :level, :chunk + resource_name :mdadm default_action :create allowed_actions :create, :assemble, :stop - def initialize(name, run_context = nil) - super - - @chunk = 16 - @devices = [] - @exists = false - @level = 1 - @metadata = "0.90" - @bitmap = nil - @raid_device = name - @layout = nil - end - - def chunk(arg = nil) - set_or_return( - :chunk, - arg, - :kind_of => [ Integer ] - ) - end - - def devices(arg = nil) - set_or_return( - :devices, - arg, - :kind_of => [ Array ] - ) - end - - def exists(arg = nil) - set_or_return( - :exists, - arg, - :kind_of => [ TrueClass, FalseClass ] - ) - end - - def level(arg = nil) - set_or_return( - :level, - arg, - :kind_of => [ Integer ] - ) - end - - def metadata(arg = nil) - set_or_return( - :metadata, - arg, - :kind_of => [ String ] - ) - end - - def bitmap(arg = nil) - set_or_return( - :bitmap, - arg, - :kind_of => [ String ] - ) - end - - def raid_device(arg = nil) - set_or_return( - :raid_device, - arg, - :kind_of => [ String ] - ) - end - - def layout(arg = nil) - set_or_return( - :layout, - arg, - :kind_of => [ String ] - ) - end - + property :chunk, Integer, default: 16 + property :devices, Array, default: [] + property :exists, [ TrueClass, FalseClass ], default: false + property :level, Integer, default: 1 + property :metadata, String, default: "0.90" + property :bitmap, String + property :raid_device, String, identity: true, name_property: true + property :layout, String end end end |