Skip to content

Commit

Permalink
Merge pull request #4394 from StackStorm/issue_4260/json_output_pack_…
Browse files Browse the repository at this point in the history
…install

Show only JSON output for st2 pack install -j
  • Loading branch information
lakshmi-kannan authored Nov 6, 2018
2 parents 3ac37d0 + 8847a03 commit bee29d0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
7 changes: 7 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,13 @@ Fixed
Also fix a bug with default config values for ``timer`` section being used if user only
specified ``timersengine`` section in the config. Previously user options were incorrectly
ignored in favor of the default values. (bug fix) #4424
* ``st2 pack install -j`` now only spits JSON output. Similarly, ``st2 pack install -y`` only spits
YAML output. This change would enable the output to be parsed by tools.
The behavior of ``st2 pack install`` hasn't changed and is human friendly. If you want to get meta
information about the pack as JSON (count of actions, sensors etc), you should rely on already
existing ``st2 pack show -j``.

Reported by Nick Maludy (improvement) #4260

2.9.1 - October 03, 2018
------------------------
Expand Down
8 changes: 7 additions & 1 deletion st2client/st2client/commands/pack.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,13 @@ def __init__(self, resource, *args, **kwargs):
help='Force pack installation.')

def run(self, args, **kwargs):
self._get_content_counts_for_pack(args, **kwargs)
is_structured_output = args.json or args.yaml

# If structured output is requested, do not print information about contents of pack
# This information is already exposed via st2 pack show ${pack_name} -j
if not is_structured_output:
self._get_content_counts_for_pack(args, **kwargs)

return self.manager.install(args.packs, python3=args.python3, force=args.force, **kwargs)

def _get_content_counts_for_pack(self, args, **kwargs):
Expand Down

0 comments on commit bee29d0

Please sign in to comment.