Project

General

Profile

Revision 8e5eda06

Added by Thomas McKay almost 9 years ago

clean-test - updates

View differences:

lib/hammer_cli_csv/systems.rb
70 70
        @k_organization_api.index({:per_page => 999999})[0]['results'].each do |organization|
71 71
          @k_system_api.index({
72 72
                                'per_page' => 999999,
73
                                'organization_id' => organization['label']
73
                                'organization_id' => katello_organization(:name => organization['name'])
74 74
                               })[0]['results'].each do |system|
75 75
            system = @k_system_api.show({
76 76
                                          'id' => system['uuid'],
......
79 79

  
80 80
            name = system['name']
81 81
            count = 1
82
            organization_label = organization['label']
82
            organization_name = organization['name']
83 83
            environment = system['environment']['label']
84 84
            contentview = system['content_view']['name']
85 85
            systemgroups = CSV.generate do |column|
......
108 108
                "#{subscription['product_id']}|#{subscription['product_name']}"
109 109
              end
110 110
            end.delete!("\n")
111
            csv << [name, count, organization_label, environment, contentview, systemgroups, virtual, host,
111
            csv << [name, count, organization_name, environment, contentview, systemgroups, virtual, host,
112 112
                    operatingsystem, architecture, sockets, ram, cores, sla, products, subscriptions]
113 113
          end
114 114
        end
......
136 136
    def create_systems_from_csv(line)
137 137
      if !@existing[line[ORGANIZATION]]
138 138
        @existing[line[ORGANIZATION]] = {}
139
        @k_system_api.index({'organization_id' => line[ORGANIZATION], 'page_size' => 999999})[0]['results'].each do |system|
139
        @k_system_api.index({
140
                              'organization_id' => katello_organization(:name => line[ORGANIZATION]),
141
                              'page_size' => 999999})[0]['results'].each do |system|
140 142
          @existing[line[ORGANIZATION]][system['name']] = system['uuid'] if system
141 143
        end
142 144
      end
......
153 155
          print "Creating system '#{name}'..." if option_verbose?
154 156
          system_id = @k_system_api.create({
155 157
                                 'name' => name,
156
                                 'organization_id' => line[ORGANIZATION],
158
                                 'organization_id' => katello_organization(:name => line[ORGANIZATION]),
157 159
                                 'environment_id' => katello_environment(line[ORGANIZATION], :name => line[ENVIRONMENT]),
158 160
                                 'content_view_id' => katello_contentview(line[ORGANIZATION], :name => line[CONTENTVIEW]),
159 161
                                 'facts' => facts(line),

Also available in: Unified diff