def set_options
opts = " #{@new_resource.username}"
field_list = {
'comment' => "-c",
'home' => "-d",
'gid' => "-g",
'uid' => "-u",
'shell' => "-s"
}
field_list.sort{ |a,b| a[0] <=> b[0] }.each do |field, option|
field_symbol = field.to_sym
if @current_resource.send(field_symbol) != @new_resource.send(field_symbol)
if @new_resource.send(field_symbol)
Chef::Log.debug("#{@new_resource} setting #{field} to #{@new_resource.send(field_symbol)}")
opts << " #{option} '#{@new_resource.send(field_symbol)}'"
end
end
end
if @new_resource.supports[:manage_home]
Chef::Log.debug("#{@new_resource} is managing the users home directory")
opts << " -m"
end
opts
end