Project

General

Profile

Revision c06f1783

Added by Thomas McKay over 6 years ago

fixes #15743 - import and export of subscriptions one-per-line

View differences:

lib/hammer_cli_csv/organizations.rb
7 7
      LABEL = 'Label'
8 8
      DESCRIPTION = 'Description'
9 9

  
10
      def export
11
        CSV.open(option_file || '/dev/stdout', 'wb', {:force_quotes => true}) do |csv|
12
          csv << [NAME, LABEL, DESCRIPTION]
10
      def export(csv)
11
        csv << [NAME, LABEL, DESCRIPTION]
13 12

  
14
          if @server_status['release'] == 'Headpin'
15
            @headpin.get(:organizations).each do |organization|
16
              next if option_organization && organization['name'] != option_organization
17
              csv << [organization['name'], organization['label'], organization['description']]
18
            end
19
          else
20
            @api.resource(:organizations).call(:index, {:per_page => 999999})['results'].each do |organization|
21
              next if option_organization && organization['name'] != option_organization
22
              csv << [organization['name'], organization['label'], organization['description']]
23
            end
13
        if @server_status['release'] == 'Headpin'
14
          @headpin.get(:organizations).each do |organization|
15
            next if option_organization && organization['name'] != option_organization
16
            csv << [organization['name'], organization['label'], organization['description']]
17
          end
18
        else
19
          @api.resource(:organizations).call(:index, {:per_page => 999999})['results'].each do |organization|
20
            next if option_organization && organization['name'] != option_organization
21
            csv << [organization['name'], organization['label'], organization['description']]
24 22
          end
25 23
        end
26 24
      end

Also available in: Unified diff