Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show only JSON output for st2 pack install -j #4394

Merged
merged 6 commits into from
Nov 6, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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