Project

General

Profile

Revision bf81b9cf

Added by Thomas McKay over 8 years ago

test-fixes - setup_test clean except for manifest upload repeat

View differences:

lib/hammer_cli_csv/activation_keys.rb
44 44
        csv << [NAME, COUNT, ORGANIZATION, DESCRIPTION, LIMIT, ENVIRONMENT, CONTENTVIEW,
45 45
                SYSTEMGROUPS, SUBSCRIPTIONS]
46 46
        @api.resource(:organizations).call(:index, {:per_page => 999999})['results'].each do |organization|
47
          @api.resource(:activationkeys).call(:index, {'per_page' => 999999,
47
          @api.resource(:activation_keys).call(:index, {'per_page' => 999999,
48 48
                                       'organization_id' => organization['label']
49 49
                                     })['results'].each do |activationkey|
50 50
            puts "Writing activation key '#{activationkey['name']}'" if option_verbose?
......
85 85
    def create_activationkeys_from_csv(line)
86 86
      if !@existing[line[ORGANIZATION]]
87 87
        @existing[line[ORGANIZATION]] = {}
88
        @api.resource(:activationkeys).call(:index, {
88
        @api.resource(:activation_keys).call(:index, {
89 89
                                     'per_page' => 999999,
90 90
                                     'organization_id' => katello_organization(:name => line[ORGANIZATION])
91 91
                                   })['results'].each do |activationkey|
......
98 98

  
99 99
        if !@existing[line[ORGANIZATION]].include? name
100 100
          print "Creating activation key '#{name}'..." if option_verbose?
101
          activationkey = @api.resource(:activationkeys).call(:create, {
101
          activationkey = @api.resource(:activation_keys).call(:create, {
102 102
                                      'name' => name,
103 103
                                      'environment_id' => katello_environment(line[ORGANIZATION],
104 104
                                                                              :name => line[ENVIRONMENT]),
......
109 109
          @existing[line[ORGANIZATION]][activationkey['name']] = activationkey['id']
110 110
        else
111 111
          print "Updating activation key '#{name}'..." if option_verbose?
112
          activationkey = @api.resource(:activationkeys).call(:update, {
112
          activationkey = @api.resource(:activation_keys).call(:update, {
113 113
                                        'id' => @existing[line[ORGANIZATION]][name],
114 114
                                        'name' => name,
115 115
                                        'environment_id' => katello_environment(line[ORGANIZATION],
......
131 131
      if line[SYSTEMGROUPS] && line[SYSTEMGROUPS] != ''
132 132
        # TODO: note that existing system groups are not removed
133 133
        CSV.parse_line(line[SYSTEMGROUPS], {:skip_blanks => true}).each do |name|
134
          @api.resource(:systemgroups).call(:add_activation_keys, {
134
          @api.resource(:system_groups).call(:add_activation_keys, {
135 135
                                                   'id' => katello_systemgroup(line[ORGANIZATION], :name => name),
136 136
                                                   'activation_key_ids' => [activationkey['id']]
137 137
                                                 })

Also available in: Unified diff