module Poise::Helpers::Win32User
A resource mixin to intercept properties named `user`, `group`, or `owner`, if their default value is `'root'` and make it work on Windows (and FreeBSD, AIX).
@since 2.7.0 @example
class MyResource < Chef::Resource include Poise::Helpers::Win32User attribute(:user, default: 'root') attribute(:group, default: 'root') end
@example Avoiding automatic translation
class MyResource < Chef::Resource include Poise::Helpers::Win32User attribute(:user, default: lazy { 'root' }) attribute(:group, default: lazy { 'root' }) end
Constants
- GROUP_PROPERTIES
Group-ish property names. @api private
- USER_PROPERTIES
User-ish property names. @api private
Public Instance Methods
set_or_return(symbol, arg, options={})
click to toggle source
Intercept property access to swap out the default value. @api private
Calls superclass method
# File lib/poise/helpers/win32_user.rb, line 50 def set_or_return(symbol, arg, options={}) if options && options[:default] == 'root' if USER_PROPERTIES.include?(symbol) && node.platform_family?('windows') options = options.dup options[:default] = Poise::Utils::Win32.admin_user elsif GROUP_PROPERTIES.include?(symbol) options = options.dup options[:default] = node['root_group'] end end super(symbol, arg, options) end