# File lib/hammer_cli_csv/hosts.rb, line 48
      def export
        CSV.open(option_csv_file || '/dev/stdout', 'wb', {:force_quotes => true}) do |csv|
          csv << [NAME, COUNT, ORGANIZATION, ENVIRONMENT, OPERATINGSYSTEM, ARCHITECTURE, MACADDRESS, DOMAIN, PARTITIONTABLE]
          @api.resource(:hosts).call(:index, {:per_page => 999999})['results'].each do |host|
            host = @api.resource(:hosts).call(:show, {'id' => host['id']})
            raise "Host 'id=#{host['id']}' not found" if !host || host.empty?

            name = host['name']
            count = 1
            organization = foreman_organization(:id => host['organization_id'])
            environment = foreman_environment(:id => host['environment_id'])
            operatingsystem = foreman_operatingsystem(:id => host['operatingsystem_id'])
            architecture = foreman_architecture(:id => host['architecture_id'])
            mac = host['mac']
            domain = foreman_domain(:id => host['domain_id'])
            ptable = foreman_partitiontable(:id => host['ptable_id'])

            csv << [name, count, organization, environment, operatingsystem, architecture, mac, domain, ptable]
          end
        end
      end