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/smart_proxies.rb
9 9
      URL = 'URL'
10 10
      LIFECYCLE_ENVIRONMENTS = 'Lifecycle Environments'
11 11

  
12
      def export
13
        CSV.open(option_file || '/dev/stdout', 'wb', {:force_quotes => true}) do |csv|
14
          csv << [NAME, ORGANIZATIONS, LOCATIONS, URL, LIFECYCLE_ENVIRONMENTS]
15
          @api.resource(:smart_proxies).call(:index, {:per_page => 999999})['results'].each do |smart_proxy|
16
            smart_proxy = @api.resource(:smart_proxies).call(:show, {'id' => smart_proxy['id']})
17
            name = smart_proxy['name']
18
            organizations = export_column(smart_proxy, 'organizations', 'name')
19
            locations = export_column(smart_proxy, 'locations', 'name')
20
            url = smart_proxy['url']
21
            csv << [name, organizations, locations, url]
22
          end
12
      def export(csv)
13
        csv << [NAME, ORGANIZATIONS, LOCATIONS, URL, LIFECYCLE_ENVIRONMENTS]
14
        @api.resource(:smart_proxies).call(:index, {:per_page => 999999})['results'].each do |smart_proxy|
15
          smart_proxy = @api.resource(:smart_proxies).call(:show, {'id' => smart_proxy['id']})
16
          name = smart_proxy['name']
17
          organizations = export_column(smart_proxy, 'organizations', 'name')
18
          locations = export_column(smart_proxy, 'locations', 'name')
19
          url = smart_proxy['url']
20
          csv << [name, organizations, locations, url]
23 21
        end
24 22
      end
25 23

  

Also available in: Unified diff