hammer_cli_csv 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. checksums.yaml +8 -8
  2. data/config/cli_config.yml +2 -0
  3. data/lib/hammer_cli_csv.rb +4 -11
  4. data/lib/hammer_cli_csv/activation_keys.rb +7 -21
  5. data/lib/hammer_cli_csv/architectures.rb +6 -37
  6. data/lib/hammer_cli_csv/base.rb +177 -21
  7. data/lib/hammer_cli_csv/compute_profiles.rb +4 -21
  8. data/lib/hammer_cli_csv/compute_resources.rb +4 -16
  9. data/lib/hammer_cli_csv/containers.rb +65 -0
  10. data/lib/hammer_cli_csv/content_hosts.rb +22 -26
  11. data/lib/hammer_cli_csv/content_view_filters.rb +90 -60
  12. data/lib/hammer_cli_csv/content_views.rb +4 -17
  13. data/lib/hammer_cli_csv/csv.rb +0 -12
  14. data/lib/hammer_cli_csv/domains.rb +74 -38
  15. data/lib/hammer_cli_csv/exception_handler.rb +0 -11
  16. data/lib/hammer_cli_csv/export.rb +14 -20
  17. data/lib/hammer_cli_csv/headpin_api.rb +0 -11
  18. data/lib/hammer_cli_csv/host_collections.rb +5 -23
  19. data/lib/hammer_cli_csv/host_groups.rb +115 -0
  20. data/lib/hammer_cli_csv/hosts.rb +32 -56
  21. data/lib/hammer_cli_csv/import.rb +46 -24
  22. data/lib/hammer_cli_csv/installation_medias.rb +4 -15
  23. data/lib/hammer_cli_csv/job_templates.rb +142 -0
  24. data/lib/hammer_cli_csv/lifecycle_environments.rb +5 -38
  25. data/lib/hammer_cli_csv/locations.rb +4 -33
  26. data/lib/hammer_cli_csv/operating_systems.rb +17 -33
  27. data/lib/hammer_cli_csv/organizations.rb +13 -41
  28. data/lib/hammer_cli_csv/partition_tables.rb +66 -54
  29. data/lib/hammer_cli_csv/products.rb +12 -24
  30. data/lib/hammer_cli_csv/provisioning_templates.rb +4 -18
  31. data/lib/hammer_cli_csv/puppet_environments.rb +36 -59
  32. data/lib/hammer_cli_csv/puppet_facts.rb +36 -58
  33. data/lib/hammer_cli_csv/puppet_reports.rb +4 -38
  34. data/lib/hammer_cli_csv/reports.rb +4 -15
  35. data/lib/hammer_cli_csv/roles.rb +4 -15
  36. data/lib/hammer_cli_csv/settings.rb +49 -0
  37. data/lib/hammer_cli_csv/smart_proxies.rb +9 -24
  38. data/lib/hammer_cli_csv/splice.rb +0 -12
  39. data/lib/hammer_cli_csv/subnets.rb +10 -21
  40. data/lib/hammer_cli_csv/subscriptions.rb +21 -24
  41. data/lib/hammer_cli_csv/sync_plans.rb +4 -19
  42. data/lib/hammer_cli_csv/users.rb +4 -15
  43. data/lib/hammer_cli_csv/version.rb +1 -12
  44. data/test/content_hosts_test.rb +1 -1
  45. data/test/content_views_test.rb +52 -0
  46. data/test/data/content-hosts.csv +1 -1
  47. data/test/data/content-view-filters.csv +1 -1
  48. data/test/data/content-views.csv +5 -5
  49. data/test/data/hosts.csv +2 -2
  50. data/test/data/operating-systems.csv +16 -16
  51. data/test/data/products.csv +1 -1
  52. data/test/data/settings.csv +5 -0
  53. data/test/import_test.rb +79 -0
  54. metadata +14 -18
@@ -1,22 +1,9 @@
1
- # Copyright 2014 Red Hat, Inc.
2
- #
3
- # This software is licensed to you under the GNU General Public
4
- # License as published by the Free Software Foundation; either version
5
- # 2 of the License (GPLv2) or (at your option) any later version.
6
- # There is NO WARRANTY for this software, express or implied,
7
- # including the implied warranties of MERCHANTABILITY,
8
- # NON-INFRINGEMENT, or FITNESS FOR A PARTICULAR PURPOSE. You should
9
- # have received a copy of GPLv2 along with this software; if not, see
10
- # http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
11
-
12
1
  module HammerCLICsv
13
2
  class CsvCommand
14
3
  class ProvisioningTemplatesCommand < BaseCommand
15
4
  command_name 'provisioning-templates'
16
5
  desc 'import or export provisioning templates'
17
6
 
18
- option %w(--organization), 'ORGANIZATION', 'Only process organization matching this name'
19
-
20
7
  ORGANIZATIONS = 'Organizations'
21
8
  LOCATIONS = 'Locations'
22
9
  OPERATINGSYSTEMS = 'Operating Systems'
@@ -25,8 +12,8 @@ module HammerCLICsv
25
12
  TEMPLATE = 'Template'
26
13
 
27
14
  def export
28
- CSV.open(option_csv_file || '/dev/stdout', 'wb', {:force_quotes => true}) do |csv|
29
- csv << [NAME, COUNT, ORGANIZATIONS, LOCATIONS, OPERATINGSYSTEMS, ASSOCIATIONS, KIND, TEMPLATE]
15
+ CSV.open(option_file || '/dev/stdout', 'wb', {:force_quotes => true}) do |csv|
16
+ csv << [NAME, ORGANIZATIONS, LOCATIONS, OPERATINGSYSTEMS, ASSOCIATIONS, KIND, TEMPLATE]
30
17
  @api.resource(:config_templates).call(:index, {
31
18
  :per_page => 999999
32
19
  })['results'].each do |template_id|
@@ -34,7 +21,6 @@ module HammerCLICsv
34
21
  next if template['locked']
35
22
  next unless option_organization.nil? || template['organizations'].detect { |org| org['name'] == option_organization }
36
23
  name = template['name']
37
- count = 1
38
24
  kind = template['snippet'] ? 'snippet' : template['template_kind_name']
39
25
  organizations = export_column(template, 'organizations', 'name')
40
26
  locations = export_column(template, 'locations', 'name')
@@ -43,7 +29,7 @@ module HammerCLICsv
43
29
  # http://projects.theforeman.org/issues/10293
44
30
  associations = export_associations(template)
45
31
  unless name == 'Boot disk iPXE - generic host' || name == 'Boot disk iPXE - host'
46
- csv << [name, count, organizations, locations, operatingsystems, associations, kind, template['template']]
32
+ csv << [name, organizations, locations, operatingsystems, associations, kind, template['template']]
47
33
  end
48
34
  end
49
35
  end
@@ -78,7 +64,7 @@ module HammerCLICsv
78
64
  foreman_operatingsystem(:name => operatingsystem)
79
65
  end
80
66
 
81
- line[COUNT].to_i.times do |number|
67
+ count(line[COUNT]).times do |number|
82
68
  name = namify(line[NAME], number)
83
69
  if !@existing.include? name
84
70
  print _("Creating provisioning template '%{name}'...") % {:name => name } if option_verbose?
@@ -1,30 +1,3 @@
1
- # Copyright 2013-2014 Red Hat, Inc.
2
- #
3
- # This software is licensed to you under the GNU General Public
4
- # License as published by the Free Software Foundation; either version
5
- # 2 of the License (GPLv2) or (at your option) any later version.
6
- # There is NO WARRANTY for this software, express or implied,
7
- # including the implied warranties of MERCHANTABILITY,
8
- # NON-INFRINGEMENT, or FITNESS FOR A PARTICULAR PURPOSE. You should
9
- # have received a copy of GPLv2 along with this software; if not, see
10
- # http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
11
-
12
- #
13
- # -= Environments CSV =-
14
- #
15
- # Columns
16
- # Name
17
- # - Environment name
18
- # - May contain '%d' which will be replaced with current iteration number of Count
19
- # - eg. "os%d" -> "os1"
20
- # Count
21
- # - Number of times to iterate on this line of the CSV file
22
- #
23
-
24
- require 'hammer_cli'
25
- require 'json'
26
- require 'csv'
27
-
28
1
  module HammerCLICsv
29
2
  class CsvCommand
30
3
  class PuppetEnvironmentsCommand < BaseCommand
@@ -32,15 +5,17 @@ module HammerCLICsv
32
5
  desc 'import or export puppet environments'
33
6
 
34
7
  ORGANIZATIONS = 'Organizations'
8
+ LOCATIONS = 'Locations'
35
9
 
36
10
  def export
37
- CSV.open(option_csv_file || '/dev/stdout', 'wb', {:force_quotes => true}) do |csv|
38
- csv << [NAME, COUNT, ORGANIZATIONS]
11
+ CSV.open(option_file || '/dev/stdout', 'wb', {:force_quotes => true}) do |csv|
12
+ csv << [NAME, ORGANIZATIONS, LOCATIONS]
39
13
  @api.resource(:environments).call(:index, {:per_page => 999999})['results'].each do |environment|
14
+ environment = @api.resource(:environments).call(:show, {:id => environment['id']})
40
15
  name = environment['name']
41
- count = 1
42
- csv << [name, count]
43
- raise 'TODO: organizations'
16
+ organizations = export_column(environment, 'organizations', 'name')
17
+ locations = export_column(environment, 'locations', 'name')
18
+ csv << [name, organizations, locations]
44
19
  end
45
20
  end
46
21
  end
@@ -57,45 +32,47 @@ module HammerCLICsv
57
32
  end
58
33
 
59
34
  def create_environments_from_csv(line)
60
- line[COUNT].to_i.times do |number|
35
+ organizations = collect_column(line[ORGANIZATIONS]) do |organization|
36
+ foreman_organization(:name => organization)
37
+ end
38
+ locations = collect_column(line[LOCATIONS]) do |location|
39
+ foreman_location(:name => location)
40
+ end
41
+
42
+ count(line[COUNT]).times do |number|
61
43
  name = namify(line[NAME], number)
62
44
  if !@existing.include? name
63
45
  print "Creating environment '#{name}'..." if option_verbose?
64
46
  id = @api.resource(:environments).call(:create, {
65
47
  'environment' => {
66
- 'name' => name
48
+ 'name' => name,
49
+ 'organization_ids' => organizations
67
50
  }
68
51
  })['id']
69
52
  else
70
53
  print "Updating environment '#{name}'..." if option_verbose?
71
- id = @api.resource(:environments).call(:update, {
72
- 'id' => @existing[name],
73
- 'environment' => {
74
- 'name' => name
75
- }
76
- })['environment']['id']
77
- end
78
54
 
79
- # Update associated resources
80
- # TODO: Bug #4738: organization json does not include puppet environments
81
- # http://projects.theforeman.org/issues/4738#change-15319
82
- # Update below to match style of domains
83
- organization_ids = CSV.parse_line(line[ORGANIZATIONS]).collect do |organization|
84
- foreman_organization(:name => organization)
85
- end
86
- organization_ids += @api.resource(:environments).call(:show, {'id' => id})['organizations'].collect do |organization|
87
- organization['id']
88
- end
89
- organization_ids.uniq!
55
+ environment = @api.resource(:environments).call(:show, {'id' => @existing[name]})
56
+ environment['organizations'].collect do |organization|
57
+ organizations << organization['id']
58
+ end
59
+ organizations.uniq!
60
+ environment['locations'].collect do |location|
61
+ locations << location['id']
62
+ end
63
+ locations.uniq!
90
64
 
91
- @api.resource(:environments).call(:update, {
92
- 'id' => id,
93
- 'environment' => {
94
- 'organization_ids' => organization_ids
95
- }
96
- })
65
+ @api.resource(:environments).call(:update, {
66
+ 'id' => @existing[name],
67
+ 'environment' => {
68
+ 'name' => name,
69
+ 'organization_ids' => organizations,
70
+ 'location_ids' => locations
71
+ }
72
+ })
73
+ end
97
74
 
98
- print "done\n" if option_verbose?
75
+ puts "done" if option_verbose?
99
76
  end
100
77
  rescue RuntimeError => e
101
78
  raise "#{e}\n #{line}"
@@ -1,82 +1,60 @@
1
- # Copyright 2013-2014 Red Hat, Inc.
2
- #
3
- # This software is licensed to you under the GNU General Public
4
- # License as published by the Free Software Foundation; either version
5
- # 2 of the License (GPLv2) or (at your option) any later version.
6
- # There is NO WARRANTY for this software, express or implied,
7
- # including the implied warranties of MERCHANTABILITY,
8
- # NON-INFRINGEMENT, or FITNESS FOR A PARTICULAR PURPOSE. You should
9
- # have received a copy of GPLv2 along with this software; if not, see
10
- # http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
11
-
12
- #
13
- # -= Puppet Facts CSV =-
14
- #
15
- # Columns
16
- # Name
17
- # - Host name
18
- # - May contain '%d' which will be replaced with current iteration number of Count
19
- # - eg. "os%d" -> "os1"
20
- # Count
21
- # - Number of times to iterate on this line of the CSV file
22
- # <Fact Key names>
23
- # - May contain '%d' which will be replaced with current iteration number of Count
24
- #
25
-
26
- require 'hammer_cli'
27
- require 'json'
28
- require 'csv'
29
-
30
1
  module HammerCLICsv
31
2
  class CsvCommand
32
3
  class PuppetFactsCommand < BaseCommand
33
4
  command_name 'puppet-facts'
34
5
  desc 'import or export puppet facts'
35
6
 
7
+ ORGANIZATION = 'Organization'
8
+ FACTS = 'Puppet Facts'
9
+
10
+ SEPARATOR = ' = '
11
+
36
12
  def export
37
- CSV.open(option_csv_file || '/dev/stdout', 'wb', {:force_quotes => true}) do |csv|
38
- headers = [NAME, COUNT]
39
- # Extracted facts are always based upon the first host found, otherwise this would be an intensive
40
- # method to gather all the possible column names
41
- any_host = @api.resource(:hosts).call(:index, {:per_page => 1})['results'][0]
42
- headers += @api.resource(:puppetfactss).call(:index, {
43
- 'host_id' => any_host['name'],
44
- 'per_page' => 999999
45
- })['results'][any_host['name']].keys
46
- csv << headers
13
+ CSV.open(option_file || '/dev/stdout', 'wb', {:force_quotes => true}) do |csv|
14
+ csv << [NAME, ORGANIZATION, FACTS]
47
15
 
48
- @api.resource(:hosts).call(:index, {:per_page => 999999})['results'].each do |host|
49
- line = [host['name'], 1]
50
- facts = @api.resource(:puppetfactss).call(:index, {'host_id' => host['name'], 'per_page' => 999999})[host['name']]
16
+ search_options = {:per_page => 999999}
17
+ search_options['search'] = "organization=\"#{option_organization}\"" if option_organization
18
+ @api.resource(:hosts).call(:index, search_options)['results'].each do |host|
19
+ facts = @api.resource(:fact_values).call(:index, {
20
+ 'search' => "host = #{host['name']}",
21
+ 'per_page' => 999999
22
+ })['results']
23
+ facts = @api.resource(:fact_values).call(:index, {
24
+ 'search' => "host = #{host['name']}",
25
+ 'per_page' => 999999
26
+ })['results'][host['name']]
51
27
  facts ||= {}
52
- headers[2..-1].each do |fact_name|
53
- line << facts[fact_name] || ''
28
+
29
+ values = CSV.generate do |column|
30
+ column << facts.collect do |fact_name, fact_value|
31
+ "#{fact_name}#{SEPARATOR}#{fact_value}"
32
+ end
54
33
  end
55
- csv << line
34
+ values.delete!("\n")
35
+
36
+ csv << [host['name'], host['organization_name'], values]
56
37
  end
57
38
  end
58
39
  end
59
40
 
60
41
  def import
61
- @headers = nil
62
-
63
42
  thread_import(true) do |line|
64
43
  create_puppetfacts_from_csv(line)
65
44
  end
66
45
  end
67
46
 
68
47
  def create_puppetfacts_from_csv(line)
69
- if @headers.nil?
70
- @headers = line
71
- return
72
- end
48
+ return if option_organization && line[ORGANIZATION] != option_organization
73
49
 
74
- line[COUNT].to_i.times do |number|
50
+ count(line[COUNT]).times do |number|
75
51
  name = namify(line[NAME], number)
76
52
  print "Updating puppetfacts '#{name}'..." if option_verbose?
77
- facts = line.to_hash
78
- facts.delete(NAME)
79
- facts.delete(COUNT)
53
+ facts = {}
54
+ collect_column(line[FACTS]) do |fact|
55
+ (fact_name, fact_value) = fact.split(SEPARATOR)
56
+ facts[fact_name] = fact_value
57
+ end
80
58
 
81
59
  # Namify the values if the host name was namified
82
60
  if name != line[NAME]
@@ -86,9 +64,9 @@ module HammerCLICsv
86
64
  end
87
65
 
88
66
  @api.resource(:hosts).call(:facts, {
89
- 'name' => name,
90
- 'facts' => facts
91
- })
67
+ 'name' => name,
68
+ 'facts' => facts
69
+ })
92
70
  print "done\n" if option_verbose?
93
71
  end
94
72
  rescue RuntimeError => e
@@ -1,36 +1,3 @@
1
- # Copyright 2013-2014 Red Hat, Inc.
2
- #
3
- # This software is licensed to you under the GNU General Public
4
- # License as published by the Free Software Foundation; either version
5
- # 2 of the License (GPLv2) or (at your option) any later version.
6
- # There is NO WARRANTY for this software, express or implied,
7
- # including the implied warranties of MERCHANTABILITY,
8
- # NON-INFRINGEMENT, or FITNESS FOR A PARTICULAR PURPOSE. You should
9
- # have received a copy of GPLv2 along with this software; if not, see
10
- # http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
11
-
12
- #
13
- # -= Systems CSV =-
14
- #
15
- # Columns
16
- # Name
17
- # - System name
18
- # - May contain '%d' which will be replaced with current iteration number of Count
19
- # - eg. "os%d" -> "os1"
20
- # Count
21
- # - Number of times to iterate on this line of the CSV file
22
- # MAC Address
23
- # - MAC address
24
- # - May contain '%d' which will be replaced with current iteration number of Count
25
- # - eg. "FF:FF:FF:FF:FF:%02x" -> "FF:FF:FF:FF:FF:0A"
26
- # - Warning: be sure to keep count below 255 or MAC hex will exceed limit
27
- #
28
-
29
- require 'hammer_cli'
30
- require 'json'
31
- require 'csv'
32
- require 'uri'
33
-
34
1
  module HammerCLICsv
35
2
  class CsvCommand
36
3
  class PuppetReportsCommand < BaseCommand
@@ -53,8 +20,8 @@ module HammerCLICsv
53
20
  SUBSCRIPTIONS = 'Subscriptions'
54
21
 
55
22
  def export
56
- CSV.open(option_csv_file || '/dev/stdout', 'wb', {:force_quotes => false}) do |csv|
57
- csv << [NAME, COUNT, ORGANIZATION, ENVIRONMENT, CONTENTVIEW, SYSTEMGROUPS, VIRTUAL, HOST,
23
+ CSV.open(option_file || '/dev/stdout', 'wb', {:force_quotes => false}) do |csv|
24
+ csv << [NAME, ORGANIZATION, ENVIRONMENT, CONTENTVIEW, SYSTEMGROUPS, VIRTUAL, HOST,
58
25
  OPERATINGSYSTEM, ARCHITECTURE, SOCKETS, RAM, CORES, SLA, PRODUCTS, SUBSCRIPTIONS]
59
26
  @api.resource(:organizations).call(:index, {
60
27
  :per_page => 999999
@@ -69,7 +36,6 @@ module HammerCLICsv
69
36
  })
70
37
 
71
38
  name = system['name']
72
- count = 1
73
39
  organization_label = organization['label']
74
40
  environment = system['environment']['label']
75
41
  contentview = system['content_view']['name']
@@ -102,7 +68,7 @@ module HammerCLICsv
102
68
  end
103
69
  end
104
70
  subscriptions.delete!("\n")
105
- csv << [name, count, organization_label, environment, contentview, hostcollections, virtual, host,
71
+ csv << [name, organization_label, environment, contentview, hostcollections, virtual, host,
106
72
  operatingsystem, architecture, sockets, ram, cores, sla, products, subscriptions]
107
73
  end
108
74
  end
@@ -138,7 +104,7 @@ module HammerCLICsv
138
104
  end
139
105
  end
140
106
 
141
- line[COUNT].to_i.times do |number|
107
+ count(line[COUNT]).times do |number|
142
108
  name = namify(line[NAME], number)
143
109
 
144
110
  # TODO: w/ @daviddavis p-r
@@ -1,14 +1,3 @@
1
- # Copyright 2013-2014 Red Hat, Inc.
2
- #
3
- # This software is licensed to you under the GNU General Public
4
- # License as published by the Free Software Foundation; either version
5
- # 2 of the License (GPLv2) or (at your option) any later version.
6
- # There is NO WARRANTY for this software, express or implied,
7
- # including the implied warranties of MERCHANTABILITY,
8
- # NON-INFRINGEMENT, or FITNESS FOR A PARTICULAR PURPOSE. You should
9
- # have received a copy of GPLv2 along with this software; if not, see
10
- # http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
11
-
12
1
  module HammerCLICsv
13
2
  class CsvCommand
14
3
  class ReportsCommand < BaseCommand
@@ -25,12 +14,12 @@ module HammerCLICsv
25
14
  METRICS = 'Metrics'
26
15
 
27
16
  def export
28
- CSV.open(option_csv_file || '/dev/stdout', 'wb', {:force_quotes => false}) do |csv|
29
- csv << [NAME, COUNT]
17
+ CSV.open(option_file || '/dev/stdout', 'wb', {:force_quotes => false}) do |csv|
18
+ csv << [NAME]
30
19
  @api.resource(:reports).call(:index, {
31
20
  'per_page' => 999999
32
21
  })['results'].each do |report|
33
- csv << [report['host_name'], 1, report['metrics'].to_json]
22
+ csv << [report['host_name'], report['metrics'].to_json]
34
23
  end
35
24
  end
36
25
 
@@ -51,7 +40,7 @@ module HammerCLICsv
51
40
  end
52
41
 
53
42
  def create_reports_from_csv(line)
54
- line[COUNT].to_i.times do |number|
43
+ count(line[COUNT]).times do |number|
55
44
  name = namify(line[NAME], number)
56
45
 
57
46
  if !@existing_reports[name]
@@ -1,14 +1,3 @@
1
- # Copyright 2013-2014 Red Hat, Inc.
2
- #
3
- # This software is licensed to you under the GNU General Public
4
- # License as published by the Free Software Foundation; either version
5
- # 2 of the License (GPLv2) or (at your option) any later version.
6
- # There is NO WARRANTY for this software, express or implied,
7
- # including the implied warranties of MERCHANTABILITY,
8
- # NON-INFRINGEMENT, or FITNESS FOR A PARTICULAR PURPOSE. You should
9
- # have received a copy of GPLv2 along with this software; if not, see
10
- # http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
11
-
12
1
  module HammerCLICsv
13
2
  class CsvCommand
14
3
  class RolesCommand < BaseCommand
@@ -22,8 +11,8 @@ module HammerCLICsv
22
11
  LOCATIONS = 'Locations'
23
12
 
24
13
  def export
25
- CSV.open(option_csv_file || '/dev/stdout', 'wb', {:force_quotes => false}) do |csv|
26
- csv << [NAME, COUNT, RESOURCE, SEARCH, PERMISSIONS, ORGANIZATIONS, LOCATIONS]
14
+ CSV.open(option_file || '/dev/stdout', 'wb', {:force_quotes => false}) do |csv|
15
+ csv << [NAME, RESOURCE, SEARCH, PERMISSIONS, ORGANIZATIONS, LOCATIONS]
27
16
  @api.resource(:roles).call(:index, {'per_page' => 999999})['results'].each do |role|
28
17
  @api.resource(:filters).call(:index, {
29
18
  'per_page' => 999999,
@@ -34,7 +23,7 @@ module HammerCLICsv
34
23
  permissions = export_column(filter, 'permissions', 'name')
35
24
  organizations = export_column(filter, 'organizations', 'name')
36
25
  locations = export_column(filter, 'locations', 'name')
37
- csv << [role['name'], 1, filter['resource_type'], filter['search'] || '', permissions, organizations, locations]
26
+ csv << [role['name'], filter['resource_type'], filter['search'] || '', permissions, organizations, locations]
38
27
  end
39
28
  end
40
29
  end
@@ -70,7 +59,7 @@ module HammerCLICsv
70
59
  foreman_location(:name => location)
71
60
  end
72
61
 
73
- line[COUNT].to_i.times do |number|
62
+ count(line[COUNT]).times do |number|
74
63
  name = namify(line[NAME], number)
75
64
  search = line[SEARCH] ? namify(line[SEARCH], number) : nil
76
65