Method: Chef::Node#policy_name

Defined in:
lib/chef/node.rb

#policy_name(arg = NOT_PASSED) ⇒ String

The policy_name for this node. Setting this to a non-nil value will enable policyfile mode when chef-client is run. If set in the config file or in node json, running chef-client will update this value.

Parameters:

  • arg (String) (defaults to: NOT_PASSED)

    the new policy_name value

Returns:

  • (String)

    the current policy_name, or the one you just set

See Also:



151
152
153
154
155
156
# File 'lib/chef/node.rb', line 151

def policy_name(arg = NOT_PASSED)
  return @policy_name if arg.equal?(NOT_PASSED)

  validate({ policy_name: arg }, { policy_name: { kind_of: [ String, NilClass ], regex: /^[\-:.[:alnum:]_]+$/ } })
  @policy_name = arg
end