Skip to content
This repository has been archived by the owner on Sep 16, 2020. It is now read-only.

Commit

Permalink
just return list of ids for multiple results, format=id
Browse files Browse the repository at this point in the history
  • Loading branch information
AlanCoding committed Dec 5, 2017
1 parent 1a662f5 commit cbde2e6
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions tower_cli/cli/resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,9 @@ def _format_id(self, payload):
"""Echos only the id"""
if 'id' in payload:
return str(payload['id'])
if 'results' in payload and payload['count'] == 1:
return str(payload['results'][0]['id'])
raise MultipleRelatedError(
'Can not use id format when multiple objects are returned.')
if 'results' in payload:
return ' '.join([six.text_type(item['id']) for item in payload['results']])
raise MultipleRelatedError('Could not serialize output with id format.')

@staticmethod
def get_print_value(data, col):
Expand Down

0 comments on commit cbde2e6

Please sign in to comment.