Project

General

Profile

Actions

Feature #1222

closed

API enhancement

Added by Brian Gupta over 12 years ago. Updated over 10 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
API
Target version:
-
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

Someone made a feature request that the default output of foremancli https://gist.github.com/1271734 is CSV for multifield records... currently I default to just printing the returned object with puts, which concatenates all the fields of the object. I agree this doesn't make sense for anything other than a host list. But I want to handle the default in a uniform manner and I'm not really sure how to handle outputting structured data in a uniform manner. Short of making exceptions for every collection, which I don't want to do, is there any ruby coolaid that I can use to tell what the structure of the returned object is and make a decision to render it appropriately? Or are you open to changing the API to be more uniform?

e.g. - hosts should just spit out a list with one host per line, users should spit out CSV with one user per line, and for reports I have no idea.. as that is a multinested structure

Also I can't make a universal decision on the structures returned.. e.g. look at the difference between puppetclasses and users. puppetclasses has the name of the top level elementid match the subhash's name element. users, has the the top level elementid identical for every record ("user").


Related issues 3 (0 open3 closed)

Related to Hammer CLI - Feature #945: foreman CLIClosedBrian Gupta05/26/2011Actions
Related to Foreman - Feature #1359: export to csv, excelClosed11/28/2011Actions
Related to Hammer CLI - Feature #2978: Add CSV output to the list commandsResolvedMartin Bacovsky08/28/2013Actions
Actions #1

Updated by Ohad Levy over 12 years ago

  • Status changed from New to Feedback
  • Target version deleted (0.4)

the way i see it is that foreman needs to provide different responses for different content type

e.g.
html --> return a web page
json --> return json structures
csv --> etc

I don't think that the CLI should do any conversions, as that would be hard to maintain over time

Actions #2

Updated by Benjamin Papillon over 10 years ago

  • Description updated (diff)
  • Status changed from Feedback to Closed

Hello,

With 1.3 released, Hammer is now handling the command line tool. It is already able to export to CSV.

Regards,

Benjamin Papillon

Actions #3

Updated by Dominic Cleal over 10 years ago

Actions #4

Updated by Dominic Cleal over 10 years ago

  • Related to Feature #2978: Add CSV output to the list commands added
Actions

Also available in: Atom PDF