Project

General

Profile

Actions

Bug #1651

closed

foremancli fails on fact_values queries

Added by Tray Torrance almost 12 years ago. Updated over 10 years ago.

Status:
Rejected
Priority:
Normal
Assignee:
Category:
-
Target version:
-
Difficulty:
Triaged:
Team Backlog:
Fixed in Releases:
Found in Releases:
In Kanboard:

Description

$ foremancli -s https://foreman.example.com --fact_values 'fact.name = operatingsystem'
/var/lib/gems/1.8/gems/foremancli-0.4.1/bin/foremancli:185:in `print_response': undefined method `join' for #<Hash:0x7fb33b963598> (NoMethodError)
        from /var/lib/gems/1.8/gems/foremancli-0.4.1/bin/foremancli:194
        from /var/lib/gems/1.8/gems/foremancli-0.4.1/bin/foremancli:189:in `each'
        from /var/lib/gems/1.8/gems/foremancli-0.4.1/bin/foremancli:189
        from /usr/local/bin/foremancli:19:in `load'
        from /usr/local/bin/foremancli:19

Debug Output:

$ foremancli -ds https://foreman.example.com --fact_values 'fact.name = operatingsystem'
RestClient.get "https://foreman.example.com/fact_values?search=fact.name%20=%20operatingsystem", "Accept"=>"application/json", "Accept-Encoding"=>"gzip, deflate", "Content-Type"=>"application/json" 
# => 200 OK | application/json 14936 bytes
/var/lib/gems/1.8/gems/foremancli-0.4.1/bin/foremancli:185:in `print_response': undefined method `join' for #<Hash:0x7ff91b0fec10> (NoMethodError)
        from /var/lib/gems/1.8/gems/foremancli-0.4.1/bin/foremancli:194
        from /var/lib/gems/1.8/gems/foremancli-0.4.1/bin/foremancli:189:in `each'
        from /var/lib/gems/1.8/gems/foremancli-0.4.1/bin/foremancli:189
        from /usr/local/bin/foremancli:19:in `load'
        from /usr/local/bin/foremancli:19

Looks like the output here is an array of nested hashes, and the output filter is choking on it?

-torrancew

Actions #1

Updated by Brian Gupta almost 12 years ago

Ok did a quick test. Looks like if you specify a --json or --yaml flag it works. What would you like the ideal default behavior to be?

Thanks,
Brian

Actions #2

Updated by Brian Gupta almost 12 years ago

Thinking more about it... and remembering that there are a number of collections that don't work without a format flag (--json or --yaml). Since we are addressing this in hammer, by setting a default format, and allowed formats for each collection, I am inclined not to address this in foremancli.

Thoughts?

Actions #3

Updated by Martin Bacovsky over 10 years ago

  • Description updated (diff)
  • Status changed from New to Rejected

This will be resolved by new Hammer (CLI). This bug was untouched for a year, closing it as a 'won't fix'.
If this is still important feel free to reopen the bug.

Actions #4

Updated by Dominic Cleal over 10 years ago

  • Project changed from Foreman to Hammer CLI
  • Category deleted (44)
Actions

Also available in: Atom PDF