Skip to content

Commit

Permalink
Merge pull request #3231 from nzlosh/patch-1
Browse files Browse the repository at this point in the history
AttributeError when calling action-alias execute
  • Loading branch information
humblearner authored Sep 28, 2017
2 parents 1e4a436 + 9d1f86f commit ac17343
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 24 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Fixed
#3746
* Fix cancellation of subworkflow and subchain. Cancel of Mistral workflow or Action Chain is
cascaded down to subworkflows appropriately. Cancel from tasks in the workflow or chain is
cascaded up to the parent. (bug fix)
cascaded up to the parent. (bug fix)
* Fix delays in st2resultstracker on querying workflow status from Mistral. Make sleep time for
empty queue and no workers configurable. Reduce the default sleep times to 1 second. StackStorm
instances that handle more workflows should consider increasing the query interval for better
Expand All @@ -70,6 +70,8 @@ Fixed
are not filtered out. #3769 (bug fix)

Reported by Carlos.
* Fix action-alias execute response to show execution id and matching action-alias #3231 (bug fix)
Reported by Carlos.

2.4.1 - September 12, 2017
--------------------------
Expand Down
31 changes: 8 additions & 23 deletions st2client/st2client/commands/action_alias.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from st2client.commands import resource
from st2client.formatters import table


__all__ = [
'ActionAliasBranch',
'ActionAliasMatchCommand',
Expand Down Expand Up @@ -67,7 +68,9 @@ def __init__(self, resource, *args, **kwargs):
self.parser.add_argument('match_text',
metavar='command',
help=help)

self.parser.add_argument('-h', '--help',
action='store_true', dest='help',
help='Print usage for the given action.')
self.parser.add_argument('-a', '--attr', nargs='+',
default=self.display_attributes,
help=('List of attributes to include in the '
Expand Down Expand Up @@ -99,36 +102,17 @@ def __init__(self, resource, *args, **kwargs):
super(ActionAliasExecuteCommand, self).__init__(
resource, 'execute',
('Execute the command text by finding a matching %s.' %
resource.get_display_name().lower()),
*args, **kwargs)
resource.get_display_name().lower()), *args, **kwargs)

self.parser.add_argument('command_text',
metavar='command',
help=help)
self.parser.add_argument('-h', '--help',
action='store_true', dest='help',
help='Print usage for the given action.')
self.parser.add_argument('--trace-tag', '--trace_tag',
help='A trace tag string to track execution later.',
dest='trace_tag', required=False)
self.parser.add_argument('--trace-id',
help='Existing trace id for this execution.',
dest='trace_id', required=False)
self.parser.add_argument('-a', '--async',
action='store_true', dest='async',
help='Do not wait for action to finish.')
self.parser.add_argument('-u', '--user', type=str, default=None,
help='User under which to run the action (admins only).')

self.parser.add_argument('--attr', nargs='+',
default=self.display_attributes,
help=('List of attributes to include in the '
'output. "all" will return all '
'attributes.'))
self.parser.add_argument('-w', '--width', nargs='+', type=int,
default=None,
help=('Set the width of columns in output.'))

@resource.add_auth_token_to_kwargs_from_cli
def run(self, args, **kwargs):
alias_match = ActionAliasMatch()
Expand All @@ -152,5 +136,6 @@ def run(self, args, **kwargs):

def run_and_print(self, args, **kwargs):
execution = self.run(args, **kwargs)
print("Started execution, id '%s'" % execution.execution['id'])
print(execution.message)
print("Matching Action-alias: '%s'" % execution.actionalias['ref'])
print("To get the results, execute:\n st2 execution get %s" %
(execution.execution['id']))

0 comments on commit ac17343

Please sign in to comment.