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/compute_profiles.rb
12 12
      URL = 'URL'
13 13

  
14 14
      def export
15
        CSV.open(option_file || '/dev/stdout', 'wb', {:force_quotes => true}) do |csv|
16
          csv << [NAME, ORGANIZATIONS, LOCATIONS, DESCRIPTION, PROVIDER, URL]
17
          @api.resource(:compute_profiles).call(:index, {:per_page => 999999})['results'].each do |compute_profile|
18
            puts compute_profile
19
            compute_profile = @api.resource(:compute_profiles).call(:show, {'id' => compute_profile['id']})
20
            name = compute_profile['name']
21
            organizations = export_column(compute_profile, 'organizations', 'name')
22
            locations = export_column(compute_profile, 'locations', 'name')
23
            description = compute_profile['description']
24
            provider = compute_profile['provider']
25
            url = compute_profile['url']
26
            csv << [name, organizations, locations, description, provider, url]
27
          end
15
        csv << [NAME, ORGANIZATIONS, LOCATIONS, DESCRIPTION, PROVIDER, URL]
16
        @api.resource(:compute_profiles).call(:index, {:per_page => 999999})['results'].each do |compute_profile|
17
          puts compute_profile
18
          compute_profile = @api.resource(:compute_profiles).call(:show, {'id' => compute_profile['id']})
19
          name = compute_profile['name']
20
          organizations = export_column(compute_profile, 'organizations', 'name')
21
          locations = export_column(compute_profile, 'locations', 'name')
22
          description = compute_profile['description']
23
          provider = compute_profile['provider']
24
          url = compute_profile['url']
25
          csv << [name, organizations, locations, description, provider, url]
28 26
        end
29 27
      end
30 28

  

Also available in: Unified diff