Skip to content

Commit

Permalink
Put decorator around the correct method and also correctly propagate
Browse files Browse the repository at this point in the history
kwargs in pack remove so pack install and pack remove commands work
correctly.
  • Loading branch information
Kami committed Feb 16, 2017
1 parent 5bd4ba2 commit 60ba1d0
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions st2client/st2client/commands/pack.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,10 +188,10 @@ def __init__(self, resource, *args, **kwargs):
default=False,
help='Force pack installation.')

@resource.add_auth_token_to_kwargs_from_cli
def run(self, args, **kwargs):
return self.manager.install(args.packs, force=args.force, **kwargs)

@resource.add_auth_token_to_kwargs_from_cli
def run_and_print(self, args, **kwargs):
instance = super(PackInstallCommand, self).run_and_print(args, **kwargs)

Expand Down Expand Up @@ -228,10 +228,10 @@ def __init__(self, resource, *args, **kwargs):
help='Name of the %s to remove.' %
resource.get_plural_display_name().lower())

@resource.add_auth_token_to_kwargs_from_cli
def run(self, args, **kwargs):
return self.manager.remove(args.packs, **kwargs)

@resource.add_auth_token_to_kwargs_from_cli
def run_and_print(self, args, **kwargs):
all_pack_instances = self.app.client.managers['Pack'].get_all()

Expand All @@ -240,7 +240,7 @@ def run_and_print(self, args, **kwargs):
packs = args.packs

if len(packs) == 1:
pack_instance = self.app.client.managers['Pack'].get_by_ref_or_id(packs[0])
pack_instance = self.app.client.managers['Pack'].get_by_ref_or_id(packs[0], **kwargs)

if pack_instance:
raise OperationFailureException('Pack %s has not been removed properly', packs[0])
Expand All @@ -252,7 +252,7 @@ def run_and_print(self, args, **kwargs):
attributes=args.attr, json=args.json, yaml=args.yaml,
attribute_display_order=self.attribute_display_order)
else:
remaining_pack_instances = self.app.client.managers['Pack'].get_all()
remaining_pack_instances = self.app.client.managers['Pack'].get_all(**kwargs)
pack_instances = []

for pack in all_pack_instances:
Expand Down

0 comments on commit 60ba1d0

Please sign in to comment.