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

Commit

Permalink
Merge pull request #448 from AlanCoding/zero_exit_code
Browse files Browse the repository at this point in the history
just return list of ids for multiple results, format=id
  • Loading branch information
AlanCoding authored Dec 14, 2017
2 parents 6c1e078 + cbde2e6 commit 9a78cca
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 9a78cca

Please sign in to comment.