Module: Chef::Mixin::Securable
- Includes:
- WindowsSecurableAttributes
- Included in:
- Resource::CookbookFile, Resource::Directory, Resource::File, Resource::Link, Resource::RemoteDirectory, Resource::RemoteFile, Resource::Template
- Defined in:
- lib/chef/mixin/securable.rb
Defined Under Namespace
Modules: WindowsMacros, WindowsSecurableAttributes
Class Method Summary collapse
-
.included(including_class) ⇒ Object
Callback that fires when included; will extend the including class with WindowsMacros and define #rights and #deny_rights on it.
Instance Method Summary collapse
Methods included from WindowsSecurableAttributes
Class Method Details
.included(including_class) ⇒ Object
Callback that fires when included; will extend the including class with WindowsMacros and define #rights and #deny_rights on it.
181 182 183 184 185 186 187 188 |
# File 'lib/chef/mixin/securable.rb', line 181 def self.included(including_class) if RUBY_PLATFORM.match?(/mswin|mingw|windows/) including_class.extend(WindowsMacros) # create a default 'rights' attribute including_class.rights_attribute(:rights) including_class.rights_attribute(:deny_rights) end end |
Instance Method Details
#group(arg = nil) ⇒ Object
33 34 35 36 37 38 39 |
# File 'lib/chef/mixin/securable.rb', line 33 def group(arg = nil) set_or_return( :group, arg, regex: Chef::Config[:group_valid_regex] ) end |
#mode(arg = nil) ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/chef/mixin/securable.rb', line 41 def mode(arg = nil) set_or_return( :mode, arg, callbacks: { "not in valid numeric range" => lambda do |m| if m.is_a?(String) m =~ /^0/ || m = "0#{m}" end # Windows does not support the sticky or setuid bits if ChefUtils.windows? Integer(m) <= 0777 && Integer(m) >= 0 else Integer(m) <= 07777 && Integer(m) >= 0 end end, } ) end |