def create_locations_from_csv(line)
line[COUNT].to_i.times do |number|
name = namify(line[NAME], number)
location_id = @existing[name]
if !location_id
print "Creating location '#{name}'... " if option_verbose?
@api.resource(:locations).call(:create, {
'location' => {
'name' => name,
'parent_id' => foreman_location(:name => line[PARENT])
}
})
else
print "Updating location '#{name}'... " if option_verbose?
@api.resource(:locations).call(:update, {
'id' => location_id,
'location' => {
'parent_id' => foreman_location(:name => line[PARENT])
}
})
end
print "done\n" if option_verbose?
end
end