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/reports.rb
13 13
      PENDING = 'Pending'
14 14
      METRICS = 'Metrics'
15 15

  
16
      def export
17
        CSV.open(option_file || '/dev/stdout', 'wb', {:force_quotes => false}) do |csv|
18
          csv << [NAME]
19
          @api.resource(:reports).call(:index, {
20
              'per_page' => 999999
21
          })['results'].each do |report|
22
            csv << [report['host_name'], report['metrics'].to_json]
23
          end
16
      def export(csv)
17
        csv << [NAME]
18
        @api.resource(:reports).call(:index, {
19
            'per_page' => 999999
20
        })['results'].each do |report|
21
          csv << [report['host_name'], report['metrics'].to_json]
24 22
        end
25

  
26
        HammerCLI::EX_OK
27 23
      end
28 24

  
29 25
      def import

Also available in: Unified diff