Skip to content

Instantly share code, notes, and snippets.

@skarmark
Created October 7, 2015 17:42
Show Gist options
  • Save skarmark/8f387d4864b9626ac8f3 to your computer and use it in GitHub Desktop.
Save skarmark/8f387d4864b9626ac8f3 to your computer and use it in GitHub Desktop.
$ st2 --debug run core.local 'hostname'
# -------- begin 139629745963152 request ----------
curl -X GET -H 'Accept-Encoding: gzip, deflate, compress' -H 'Accept: */*' -H 'User-Agent: python-requests/2.2.1 CPython/2.7.6 Linux/3.13.0-49-generic' http://localhost:9101/v1/actions/core.local
# -------- begin 139629745963152 response ----------
{"name": "local", "runner_type": "local-shell-cmd", "tags": [], "enabled": true, "pack": "core", "entry_point": "", "parameters": {"cmd": {"required": true, "type": "string", "description": "Arbitrary Linux command to be executed on the remote host(s)."}, "sudo": {"immutable": true}}, "ref": "core.local", "id": "55fa0c71475e060d20fc325e", "description": "Action that executes an arbitrary Linux command on the localhost."}
# -------- end 139629745963152 response ------------
# -------- begin 139629745966480 request ----------
curl -X GET -H 'Accept-Encoding: gzip, deflate, compress' -H 'Accept: */*' -H 'User-Agent: python-requests/2.2.1 CPython/2.7.6 Linux/3.13.0-49-generic' 'http://localhost:9101/v1/runnertypes/?name=local-shell-cmd'
# -------- begin 139629745966480 response ----------
[{"runner_module": "st2actions.runners.localrunner", "description": "A runner to execute local actions as a fixed user.", "enabled": true, "runner_parameters": {"sudo": {"default": false, "type": "boolean", "description": "The command will be executed with sudo."}, "env": {"type": "object", "description": "Environment variables which will be available to the command(e.g. key1=val1,key2=val2)"}, "cmd": {"type": "string", "description": "Arbitrary Linux command to be executed on the host."}, "kwarg_op": {"default": "--", "type": "string", "description": "Operator to use in front of keyword args i.e. \"--\" or \"-\"."}, "timeout": {"default": 60, "type": "integer", "description": "Action timeout in seconds. Action will get killed if it doesn't finish in timeout seconds."}, "cwd": {"type": "string", "description": "Working directory where the command will be executed in"}}, "id": "55fa0c71475e060d20fc324c", "name": "local-shell-cmd"}]
# -------- end 139629745966480 response ------------
# -------- begin 139629745964688 request ----------
curl -X POST -H 'Content-Length: 59' -H 'content-type: application/json' -H 'Accept-Encoding: gzip, deflate, compress' -H 'Accept: */*' -H 'User-Agent: python-requests/2.2.1 CPython/2.7.6 Linux/3.13.0-49-generic' --data-binary '{"action": "core.local", "parameters": {"cmd": "hostname"}}' http://localhost:9101/v1/executions
# -------- begin 139629745964688 response ----------
{"status": "requested", "start_timestamp": "2015-10-07T17:40:33.698923Z", "parameters": {"cmd": "hostname"}, "runner": {"runner_module": "st2actions.runners.localrunner", "description": "A runner to execute local actions as a fixed user.", "enabled": true, "runner_parameters": {"sudo": {"default": false, "type": "boolean", "description": "The command will be executed with sudo."}, "env": {"type": "object", "description": "Environment variables which will be available to the command(e.g. key1=val1,key2=val2)"}, "cmd": {"type": "string", "description": "Arbitrary Linux command to be executed on the host."}, "kwarg_op": {"default": "--", "type": "string", "description": "Operator to use in front of keyword args i.e. \"--\" or \"-\"."}, "timeout": {"default": 60, "type": "integer", "description": "Action timeout in seconds. Action will get killed if it doesn't finish in timeout seconds."}, "cwd": {"type": "string", "description": "Working directory where the command will be executed in"}}, "id": "55fa0c6f71be4f0d20d17623", "name": "local-shell-cmd"}, "context": {"user": "winstoncdeprod"}, "action": {"name": "local", "runner_type": "local-shell-cmd", "tags": [], "enabled": true, "pack": "core", "entry_point": "", "parameters": {"cmd": {"required": true, "type": "string", "description": "Arbitrary Linux command to be executed on the remote host(s)."}, "sudo": {"immutable": true}}, "ref": "core.local", "id": "55fa0c71475e060d20fc325e", "description": "Action that executes an arbitrary Linux command on the localhost."}, "liveaction": {"action": "core.local", "callback": {}, "runner_info": {}, "id": "56155911475e0647c8c2f8ed"}, "id": "56155911475e0647c8c2f8ee"}
# -------- end 139629745964688 response ------------
.# -------- begin 139629745964688 request ----------
curl -X GET -H 'Accept-Encoding: gzip, deflate, compress' -H 'Accept: */*' -H 'User-Agent: python-requests/2.2.1 CPython/2.7.6 Linux/3.13.0-49-generic' http://localhost:9101/v1/executions/56155911475e0647c8c2f8ee
# -------- begin 139629745964688 response ----------
{
"faultstring": "Unable to identify resource with id \"56155911475e0647c8c2f8ee\"."
}
# -------- end 139629745964688 response ------------
ERROR: 'NoneType' object has no attribute 'status'
CLI settings:
----------------
Config file path: /home/winstoncdeprod/.st2/config
Client settings:
----------------
ST2_BASE_URL: http://localhost
ST2_AUTH_URL: http://localhost:9100
ST2_API_URL: http://localhost:9101/v1
ST2_AUTH_TOKEN: None
Proxy settings:
---------------
HTTP_PROXY:
HTTPS_PROXY:
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/st2client/shell.py", line 321, in run
args.func(args)
File "/usr/local/lib/python2.7/dist-packages/st2client/commands/resource.py", line 41, in decorate
return func(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/st2client/commands/action.py", line 200, in run_and_print
execution = self.run(args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/st2client/commands/resource.py", line 41, in decorate
return func(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/st2client/commands/action.py", line 798, in run
args=args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/st2client/commands/action.py", line 349, in _get_execution_result
while execution.status in pending_statuses:
AttributeError: 'NoneType' object has no attribute 'status'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment