Project

General

Profile

Revision bfc065ce

Added by Thomas McKay over 8 years ago

roles-test - wip

roles-test - users now get roles, orgs, and locations

View differences:

lib/hammer_cli_csv/lifecycle_environments.rb
59 59
              label = environment['label']
60 60
              prior = environment['prior']
61 61
              description = environment['description']
62
              csv << [name, count, label, organization['label'], prior, description]
62
              csv << [name, count, label, organization['name'], prior, description]
63 63
            end
64 64
          end
65 65
        end
......
71 71
      @k_organization_api.index({'per_page' => 999999})[0]['results'].each do |organization|
72 72
        @k_environment_api.index({
73 73
                                   'per_page' => 999999,
74
                                   'organization_id' => organization['label']
74
                                   'organization_id' => katello_organization(:name => organization['name'])
75 75
                                 })[0]['results'].each do |environment|
76
          @existing[organization['label']] ||= {}
77
          @existing[organization['label']][environment['name']] = environment['id'] if environment
76
          @existing[organization['name']] ||= {}
77
          @existing[organization['name']][environment['name']] = environment['id'] if environment
78 78
        end
79 79
      end
80 80

  
......
92 92
        if !@existing[line[ORGANIZATION]].include? name
93 93
          print "Creating environment '#{name}'..." if option_verbose?
94 94
          @k_environment_api.create({
95
                                      'organization_id' => line[ORGANIZATION],
95
                                      'organization_id' => katello_organization(:name => line[ORGANIZATION]),
96 96
                                      'name' => name,
97 97
                                      'label' => label,
98
                                      'prior' => prior,
98
                                      'prior' => katello_environment(line[ORGANIZATION], :name => prior),
99 99
                                      'description' => line[DESCRIPTION]
100 100
                                    })
101 101
        else
102 102
          print "Updating environment '#{name}'..." if option_verbose?
103 103
          @k_environment_api.update({
104
                                      'id' => label,
104
                                      'id' => katello_environment(line[ORGANIZATION], :name => label),
105 105
                                      'name' => name,
106 106
                                      'new_name' => name,
107
                                      'organization_id' => line[ORGANIZATION],
107
                                      'organization_id' => katello_organization(:name => line[ORGANIZATION]),
108 108
                                      'prior' => prior,
109 109
                                      'description' => line[DESCRIPTION]
110 110
                                    })

Also available in: Unified diff