Method: Chef::Provider::Group::Groupadd#set_options

Defined in:
lib/chef/provider/group/groupadd.rb

#set_optionsObject

Little bit of magic as per Adam’s useradd provider to pull the assign the command line flags

Returns

<string>

A string containing the option and then the quoted value



109
110
111
112
113
114
115
116
117
118
119
120
121
# File 'lib/chef/provider/group/groupadd.rb', line 109

def set_options
  opts = []
  { gid: "-g" }.sort_by { |a| a[0] }.each do |field, option|
    next unless current_resource.send(field) != new_resource.send(field)
    next unless new_resource.send(field)

    opts << option
    opts << new_resource.send(field)
    logger.trace("#{new_resource} set #{field} to #{new_resource.send(field)}")
  end
  opts << new_resource.group_name
  opts
end