{"action":"created","comment":{"url":"https://api.github.com/repos/StackStorm/st2/pulls/comments/78772572","id":78772572,"diff_hunk":"@@ -781,8 +742,48 @@ def _get_inherited_env_vars(self):\n \n         return env_vars\n \n+    @add_auth_token_to_kwargs_from_cli\n+    def run_and_print(self, args, **kwargs):\n+        if self._print_help(args, **kwargs):\n+            return\n+\n+        execution = self.run(args, **kwargs)\n+        if args.async:\n+            self.print_output('To get the results, execute:\\n st2 execution get %s' %\n+                              (execution.id), six.text_type)\n+        else:\n+            self._print_execution_details(execution=execution, args=args, **kwargs)\n+\n+        if execution.status == 'failed':\n+            # Exit with non zero if the action has failed\n+            sys.exit(1)\n+\n+    def _get_execution_result(self, execution, action_exec_mgr, args, **kwargs):\n+        pending_statuses = [\n+            LIVEACTION_STATUS_REQUESTED,\n+            LIVEACTION_STATUS_SCHEDULED,\n+            LIVEACTION_STATUS_RUNNING,\n+            LIVEACTION_STATUS_CANCELING\n+        ]\n+\n+        if not args.async:\n+            while execution.status in pending_statuses:\n+                time.sleep(self.poll_interval)\n+                if not args.json and not args.yaml:\n+                    sys.stdout.write('.')\n+                    sys.stdout.flush()\n+                execution = action_exec_mgr.get_by_id(execution.id, **kwargs)\n+\n+            sys.stdout.write('\\n')\n+\n+            if execution.status == LIVEACTION_STATUS_CANCELED:\n+                return execution\n+\n+        return execution\n+\n \n-class ActionRunCommand(ActionRunCommandMixin, resource.ResourceCommand):\n+class ActionRunCommand(ActionRunCommandMixin,","path":"st2client/st2client/commands/action.py","position":172,"original_position":172,"commit_id":"94e988ecb868360e5808d0244bfdfb58f9586faf","original_commit_id":"94e988ecb868360e5808d0244bfdfb58f9586faf","user":{"login":"Kami","id":125088,"avatar_url":"https://avatars.githubusercontent.com/u/125088?v=3","gravatar_id":"","url":"https://api.github.com/users/Kami","html_url":"https://github.com/Kami","followers_url":"https://api.github.com/users/Kami/followers","following_url":"https://api.github.com/users/Kami/following{/other_user}","gists_url":"https://api.github.com/users/Kami/gists{/gist_id}","starred_url":"https://api.github.com/users/Kami/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Kami/subscriptions","organizations_url":"https://api.github.com/users/Kami/orgs","repos_url":"https://api.github.com/users/Kami/repos","events_url":"https://api.github.com/users/Kami/events{/privacy}","received_events_url":"https://api.github.com/users/Kami/received_events","type":"User","site_admin":false},"body":"We use 100 characters long lines so those breaks are not needed.","created_at":"2016-09-14T15:28:55Z","updated_at":"2016-09-14T15:28:55Z","html_url":"https://github.com/StackStorm/st2/pull/2895#discussion_r78772572","pull_request_url":"https://api.github.com/repos/StackStorm/st2/pulls/2895","_links":{"self":{"href":"https://api.github.com/repos/StackStorm/st2/pulls/comments/78772572"},"html":{"href":"https://github.com/StackStorm/st2/pull/2895#discussion_r78772572"},"pull_request":{"href":"https://api.github.com/repos/StackStorm/st2/pulls/2895"}}},"pull_request":{"url":"https://api.github.com/repos/StackStorm/st2/pulls/2895","id":84819459,"html_url":"https://github.com/StackStorm/st2/pull/2895","diff_url":"https://github.com/StackStorm/st2/pull/2895.diff","patch_url":"https://github.com/StackStorm/st2/pull/2895.patch","issue_url":"https://api.github.com/repos/StackStorm/st2/issues/2895","number":2895,"state":"open","locked":false,"title":"Refactor chatops to process input alias matching server side","user":{"login":"tonybaloney","id":1532417,"avatar_url":"https://avatars.githubusercontent.com/u/1532417?v=3","gravatar_id":"","url":"https://api.github.com/users/tonybaloney","html_url":"https://github.com/tonybaloney","followers_url":"https://api.github.com/users/tonybaloney/followers","following_url":"https://api.github.com/users/tonybaloney/following{/other_user}","gists_url":"https://api.github.com/users/tonybaloney/gists{/gist_id}","starred_url":"https://api.github.com/users/tonybaloney/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tonybaloney/subscriptions","organizations_url":"https://api.github.com/users/tonybaloney/orgs","repos_url":"https://api.github.com/users/tonybaloney/repos","events_url":"https://api.github.com/users/tonybaloney/events{/privacy}","received_events_url":"https://api.github.com/users/tonybaloney/received_events","type":"User","site_admin":false},"body":"This PR is proposing to allow clients to submit text captured via another method (e.g. Python bot or direct input) into the StackStorm chatops system. To cater for this, StackStorm needs to be changed to:\r\n* Move the business logic of flattening action alias format strings into regex patterns into an API controller\r\n* Move the matching logic from hubot-stackstorm into a server-side controller\r\n\r\nStrategy:\r\n\r\n- [x] Create a utility submodule in `st2common.util` for the alias matching/regex logic\r\n- [x] Create a series of test scenarios for checking regex logic in the `re` stdlib compared with the existing hubot code.\r\n- [x] Create an API action for matching a text input from a chatops window to an alias/action reference\r\n- [x] Create a helper function on the `st2client` project, e.g. **`st2 alias match \"honk-honk\"`**\r\n\r\nFunctionality in future PRs:\r\n- [ ] Create an API view for formatted alias patterns\r\n- [ ] Create an API view for showing help strings of aliases\r\n- [ ] Modify the `st2stream` API to support server side filtering (not required but preferred).\r\n\r\nThis is a collaboration with @nzlosh","created_at":"2016-09-12T06:06:53Z","updated_at":"2016-09-14T15:28:55Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5ca131fd7af51c461d3c70cd921b5894fb47e891","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/StackStorm/st2/pulls/2895/commits","review_comments_url":"https://api.github.com/repos/StackStorm/st2/pulls/2895/comments","review_comment_url":"https://api.github.com/repos/StackStorm/st2/pulls/comments{/number}","comments_url":"https://api.github.com/repos/StackStorm/st2/issues/2895/comments","statuses_url":"https://api.github.com/repos/StackStorm/st2/statuses/94e988ecb868360e5808d0244bfdfb58f9586faf","head":{"label":"tonybaloney:serversiderules","ref":"serversiderules","sha":"94e988ecb868360e5808d0244bfdfb58f9586faf","user":{"login":"tonybaloney","id":1532417,"avatar_url":"https://avatars.githubusercontent.com/u/1532417?v=3","gravatar_id":"","url":"https://api.github.com/users/tonybaloney","html_url":"https://github.com/tonybaloney","followers_url":"https://api.github.com/users/tonybaloney/followers","following_url":"https://api.github.com/users/tonybaloney/following{/other_user}","gists_url":"https://api.github.com/users/tonybaloney/gists{/gist_id}","starred_url":"https://api.github.com/users/tonybaloney/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tonybaloney/subscriptions","organizations_url":"https://api.github.com/users/tonybaloney/orgs","repos_url":"https://api.github.com/users/tonybaloney/repos","events_url":"https://api.github.com/users/tonybaloney/events{/privacy}","received_events_url":"https://api.github.com/users/tonybaloney/received_events","type":"User","site_admin":false},"repo":{"id":44355876,"name":"st2","full_name":"tonybaloney/st2","owner":{"login":"tonybaloney","id":1532417,"avatar_url":"https://avatars.githubusercontent.com/u/1532417?v=3","gravatar_id":"","url":"https://api.github.com/users/tonybaloney","html_url":"https://github.com/tonybaloney","followers_url":"https://api.github.com/users/tonybaloney/followers","following_url":"https://api.github.com/users/tonybaloney/following{/other_user}","gists_url":"https://api.github.com/users/tonybaloney/gists{/gist_id}","starred_url":"https://api.github.com/users/tonybaloney/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tonybaloney/subscriptions","organizations_url":"https://api.github.com/users/tonybaloney/orgs","repos_url":"https://api.github.com/users/tonybaloney/repos","events_url":"https://api.github.com/users/tonybaloney/events{/privacy}","received_events_url":"https://api.github.com/users/tonybaloney/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/tonybaloney/st2","description":"StackStorm (aka \"IFTTT for Ops\") is event-driven automation commonly used for auto-remediation, security responses, facilitated troubleshooting, complex deployments, and more. Includes rules engine, workflow, 1500+ integrations, native ChatOps and so forth.  Zingy installer available at http://docs.stackstorm.com/install/index.html. Ping us on slack - https://stackstorm-community.slack.com/. ","fork":true,"url":"https://api.github.com/repos/tonybaloney/st2","forks_url":"https://api.github.com/repos/tonybaloney/st2/forks","keys_url":"https://api.github.com/repos/tonybaloney/st2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tonybaloney/st2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tonybaloney/st2/teams","hooks_url":"https://api.github.com/repos/tonybaloney/st2/hooks","issue_events_url":"https://api.github.com/repos/tonybaloney/st2/issues/events{/number}","events_url":"https://api.github.com/repos/tonybaloney/st2/events","assignees_url":"https://api.github.com/repos/tonybaloney/st2/assignees{/user}","branches_url":"https://api.github.com/repos/tonybaloney/st2/branches{/branch}","tags_url":"https://api.github.com/repos/tonybaloney/st2/tags","blobs_url":"https://api.github.com/repos/tonybaloney/st2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tonybaloney/st2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tonybaloney/st2/git/refs{/sha}","trees_url":"https://api.github.com/repos/tonybaloney/st2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tonybaloney/st2/statuses/{sha}","languages_url":"https://api.github.com/repos/tonybaloney/st2/languages","stargazers_url":"https://api.github.com/repos/tonybaloney/st2/stargazers","contributors_url":"https://api.github.com/repos/tonybaloney/st2/contributors","subscribers_url":"https://api.github.com/repos/tonybaloney/st2/subscribers","subscription_url":"https://api.github.com/repos/tonybaloney/st2/subscription","commits_url":"https://api.github.com/repos/tonybaloney/st2/commits{/sha}","git_commits_url":"https://api.github.com/repos/tonybaloney/st2/git/commits{/sha}","comments_url":"https://api.github.com/repos/tonybaloney/st2/comments{/number}","issue_comment_url":"https://api.github.com/repos/tonybaloney/st2/issues/comments{/number}","contents_url":"https://api.github.com/repos/tonybaloney/st2/contents/{+path}","compare_url":"https://api.github.com/repos/tonybaloney/st2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tonybaloney/st2/merges","archive_url":"https://api.github.com/repos/tonybaloney/st2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tonybaloney/st2/downloads","issues_url":"https://api.github.com/repos/tonybaloney/st2/issues{/number}","pulls_url":"https://api.github.com/repos/tonybaloney/st2/pulls{/number}","milestones_url":"https://api.github.com/repos/tonybaloney/st2/milestones{/number}","notifications_url":"https://api.github.com/repos/tonybaloney/st2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tonybaloney/st2/labels{/name}","releases_url":"https://api.github.com/repos/tonybaloney/st2/releases{/id}","deployments_url":"https://api.github.com/repos/tonybaloney/st2/deployments","created_at":"2015-10-16T01:49:11Z","updated_at":"2016-09-12T05:21:07Z","pushed_at":"2016-09-14T06:00:59Z","git_url":"git://github.com/tonybaloney/st2.git","ssh_url":"git@github.com:tonybaloney/st2.git","clone_url":"https://github.com/tonybaloney/st2.git","svn_url":"https://github.com/tonybaloney/st2","homepage":"http://www.stackstorm.com/","size":15732,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"StackStorm:master","ref":"master","sha":"b0ff90b65245a743bf22d9cb342ea89c48dfe72e","user":{"login":"StackStorm","id":4969009,"avatar_url":"https://avatars.githubusercontent.com/u/4969009?v=3","gravatar_id":"","url":"https://api.github.com/users/StackStorm","html_url":"https://github.com/StackStorm","followers_url":"https://api.github.com/users/StackStorm/followers","following_url":"https://api.github.com/users/StackStorm/following{/other_user}","gists_url":"https://api.github.com/users/StackStorm/gists{/gist_id}","starred_url":"https://api.github.com/users/StackStorm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/StackStorm/subscriptions","organizations_url":"https://api.github.com/users/StackStorm/orgs","repos_url":"https://api.github.com/users/StackStorm/repos","events_url":"https://api.github.com/users/StackStorm/events{/privacy}","received_events_url":"https://api.github.com/users/StackStorm/received_events","type":"Organization","site_admin":false},"repo":{"id":19051806,"name":"st2","full_name":"StackStorm/st2","owner":{"login":"StackStorm","id":4969009,"avatar_url":"https://avatars.githubusercontent.com/u/4969009?v=3","gravatar_id":"","url":"https://api.github.com/users/StackStorm","html_url":"https://github.com/StackStorm","followers_url":"https://api.github.com/users/StackStorm/followers","following_url":"https://api.github.com/users/StackStorm/following{/other_user}","gists_url":"https://api.github.com/users/StackStorm/gists{/gist_id}","starred_url":"https://api.github.com/users/StackStorm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/StackStorm/subscriptions","organizations_url":"https://api.github.com/users/StackStorm/orgs","repos_url":"https://api.github.com/users/StackStorm/repos","events_url":"https://api.github.com/users/StackStorm/events{/privacy}","received_events_url":"https://api.github.com/users/StackStorm/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/StackStorm/st2","description":"StackStorm (aka \"IFTTT for Ops\") is event-driven automation commonly used for auto-remediation, security responses, facilitated troubleshooting, complex deployments, and more. Includes rules engine, workflow,1800+ integrations (see /st2contrib), native ChatOps and so forth.  Installer available at http://docs.stackstorm.com/install/index.html. Ping us on slack - https://stackstorm-community.slack.com/. ","fork":false,"url":"https://api.github.com/repos/StackStorm/st2","forks_url":"https://api.github.com/repos/StackStorm/st2/forks","keys_url":"https://api.github.com/repos/StackStorm/st2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/StackStorm/st2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/StackStorm/st2/teams","hooks_url":"https://api.github.com/repos/StackStorm/st2/hooks","issue_events_url":"https://api.github.com/repos/StackStorm/st2/issues/events{/number}","events_url":"https://api.github.com/repos/StackStorm/st2/events","assignees_url":"https://api.github.com/repos/StackStorm/st2/assignees{/user}","branches_url":"https://api.github.com/repos/StackStorm/st2/branches{/branch}","tags_url":"https://api.github.com/repos/StackStorm/st2/tags","blobs_url":"https://api.github.com/repos/StackStorm/st2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/StackStorm/st2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/StackStorm/st2/git/refs{/sha}","trees_url":"https://api.github.com/repos/StackStorm/st2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/StackStorm/st2/statuses/{sha}","languages_url":"https://api.github.com/repos/StackStorm/st2/languages","stargazers_url":"https://api.github.com/repos/StackStorm/st2/stargazers","contributors_url":"https://api.github.com/repos/StackStorm/st2/contributors","subscribers_url":"https://api.github.com/repos/StackStorm/st2/subscribers","subscription_url":"https://api.github.com/repos/StackStorm/st2/subscription","commits_url":"https://api.github.com/repos/StackStorm/st2/commits{/sha}","git_commits_url":"https://api.github.com/repos/StackStorm/st2/git/commits{/sha}","comments_url":"https://api.github.com/repos/StackStorm/st2/comments{/number}","issue_comment_url":"https://api.github.com/repos/StackStorm/st2/issues/comments{/number}","contents_url":"https://api.github.com/repos/StackStorm/st2/contents/{+path}","compare_url":"https://api.github.com/repos/StackStorm/st2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/StackStorm/st2/merges","archive_url":"https://api.github.com/repos/StackStorm/st2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/StackStorm/st2/downloads","issues_url":"https://api.github.com/repos/StackStorm/st2/issues{/number}","pulls_url":"https://api.github.com/repos/StackStorm/st2/pulls{/number}","milestones_url":"https://api.github.com/repos/StackStorm/st2/milestones{/number}","notifications_url":"https://api.github.com/repos/StackStorm/st2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/StackStorm/st2/labels{/name}","releases_url":"https://api.github.com/repos/StackStorm/st2/releases{/id}","deployments_url":"https://api.github.com/repos/StackStorm/st2/deployments","created_at":"2014-04-23T00:51:34Z","updated_at":"2016-09-14T12:47:11Z","pushed_at":"2016-09-14T14:38:24Z","git_url":"git://github.com/StackStorm/st2.git","ssh_url":"git@github.com:StackStorm/st2.git","clone_url":"https://github.com/StackStorm/st2.git","svn_url":"https://github.com/StackStorm/st2","homepage":"http://www.stackstorm.com/","size":18080,"stargazers_count":1573,"watchers_count":1573,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":178,"mirror_url":null,"open_issues_count":132,"forks":178,"open_issues":132,"watchers":1573,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/StackStorm/st2/pulls/2895"},"html":{"href":"https://github.com/StackStorm/st2/pull/2895"},"issue":{"href":"https://api.github.com/repos/StackStorm/st2/issues/2895"},"comments":{"href":"https://api.github.com/repos/StackStorm/st2/issues/2895/comments"},"review_comments":{"href":"https://api.github.com/repos/StackStorm/st2/pulls/2895/comments"},"review_comment":{"href":"https://api.github.com/repos/StackStorm/st2/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/StackStorm/st2/pulls/2895/commits"},"statuses":{"href":"https://api.github.com/repos/StackStorm/st2/statuses/94e988ecb868360e5808d0244bfdfb58f9586faf"}}}}
{"actor":{"display_login":"Kami"}}