{"action":"created","issue":{"url":"https://api.github.com/repos/StackStorm/st2/issues/3761","repository_url":"https://api.github.com/repos/StackStorm/st2","labels_url":"https://api.github.com/repos/StackStorm/st2/issues/3761/labels{/name}","comments_url":"https://api.github.com/repos/StackStorm/st2/issues/3761/comments","events_url":"https://api.github.com/repos/StackStorm/st2/issues/3761/events","html_url":"https://github.com/StackStorm/st2/pull/3761","id":259970449,"number":3761,"title":"Add \"limit=-1\" support for the API and CLI and block negative values for limit query param","user":{"login":"humblearner","id":11877841,"avatar_url":"https://avatars2.githubusercontent.com/u/11877841?v=4","gravatar_id":"","url":"https://api.github.com/users/humblearner","html_url":"https://github.com/humblearner","followers_url":"https://api.github.com/users/humblearner/followers","following_url":"https://api.github.com/users/humblearner/following{/other_user}","gists_url":"https://api.github.com/users/humblearner/gists{/gist_id}","starred_url":"https://api.github.com/users/humblearner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/humblearner/subscriptions","organizations_url":"https://api.github.com/users/humblearner/orgs","repos_url":"https://api.github.com/users/humblearner/repos","events_url":"https://api.github.com/users/humblearner/events{/privacy}","received_events_url":"https://api.github.com/users/humblearner/received_events","type":"User","site_admin":false},"labels":[{"id":591965294,"url":"https://api.github.com/repos/StackStorm/st2/labels/API","name":"API","color":"fbca04","default":false},{"id":94405702,"url":"https://api.github.com/repos/StackStorm/st2/labels/bug","name":"bug","color":"fc2929","default":true},{"id":193920212,"url":"https://api.github.com/repos/StackStorm/st2/labels/cli","name":"cli","color":"5319e7","default":false},{"id":94405704,"url":"https://api.github.com/repos/StackStorm/st2/labels/enhancement","name":"enhancement","color":"84b6eb","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/StackStorm/st2/milestones/12","html_url":"https://github.com/StackStorm/st2/milestone/12","labels_url":"https://api.github.com/repos/StackStorm/st2/milestones/12/labels","id":2702980,"number":12,"title":"2.5.0","description":"","creator":{"login":"armab","id":1533818,"avatar_url":"https://avatars2.githubusercontent.com/u/1533818?v=4","gravatar_id":"","url":"https://api.github.com/users/armab","html_url":"https://github.com/armab","followers_url":"https://api.github.com/users/armab/followers","following_url":"https://api.github.com/users/armab/following{/other_user}","gists_url":"https://api.github.com/users/armab/gists{/gist_id}","starred_url":"https://api.github.com/users/armab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/armab/subscriptions","organizations_url":"https://api.github.com/users/armab/orgs","repos_url":"https://api.github.com/users/armab/repos","events_url":"https://api.github.com/users/armab/events{/privacy}","received_events_url":"https://api.github.com/users/armab/received_events","type":"User","site_admin":false},"open_issues":6,"closed_issues":6,"state":"open","created_at":"2017-08-15T17:00:10Z","updated_at":"2017-09-23T01:04:57Z","due_on":null,"closed_at":null},"comments":1,"created_at":"2017-09-23T00:56:50Z","updated_at":"2017-09-25T08:34:25Z","closed_at":null,"author_association":"OWNER","pull_request":{"url":"https://api.github.com/repos/StackStorm/st2/pulls/3761","html_url":"https://github.com/StackStorm/st2/pull/3761","diff_url":"https://github.com/StackStorm/st2/pull/3761.diff","patch_url":"https://github.com/StackStorm/st2/pull/3761.patch"},"body":"Closes #3735, Closes #3708\r\n\r\n**Before:**\r\n```\r\n$ st2 execution list -n -1\r\nERROR: 500 Server Error: Internal Server Error\r\nMESSAGE: Internal Server Error for url: http://127.0.0.1:9101/v1/executions/?limit=-1&exclude_attributes=result%2Ctrigger_instance&sort_desc=True&parent=null\r\n```\r\n```\r\n$ st2 execution list -n -11\r\n+--------------------------+------------+--------------+------------------------+-------------------------+------------------------+\r\n| id                       | action.ref | context.user | status                 | start_timestamp         | end_timestamp          |\r\n+--------------------------+------------+--------------+------------------------+-------------------------+------------------------+\r\n| 59c4ad9a909a5049b27360ab | core.local | stanley      | succeeded (0s elapsed) | Fri, 22 Sep 2017        | Fri, 22 Sep 2017       |\r\n|                          |            |              |                        | 06:28:42 UTC            | 06:28:42 UTC           |\r\n| 59c4ad9c909a5049b27360ae | core.local | stanley      | succeeded (1s elapsed) | Fri, 22 Sep 2017        | Fri, 22 Sep 2017       |\r\n|                          |            |              |                        | 06:28:44 UTC            | 06:28:45 UTC           |\r\n| 59c4ada3909a5049b27360b1 | core.local | stanley      | succeeded (0s elapsed) | Fri, 22 Sep 2017        | Fri, 22 Sep 2017       |\r\n|                          |            |              |                        | 06:28:51 UTC            | 06:28:51 UTC           |\r\n| 59c4ada5909a5049b27360b4 | core.local | stanley      | succeeded (1s elapsed) | Fri, 22 Sep 2017        | Fri, 22 Sep 2017       |\r\n|                          |            |              |                        | 06:28:53 UTC            | 06:28:54 UTC           |\r\n+--------------------------+------------+--------------+------------------------+-------------------------+------------------------+\r\n+----------------------------------------------------------------------------------------------------------------------------------+\r\n| Note: Only first -11 action executions are displayed. Use -n/--last flag for more results.                                       |\r\n+----------------------------------------------------------------------------------------------------------------------------------+\r\n\r\n```\r\n\r\n**After:**\r\n```\r\n$ st2 execution list -n -1\r\n+--------------------------+------------+--------------+------------------------+-------------------------+------------------------+\r\n| id                       | action.ref | context.user | status                 | start_timestamp         | end_timestamp          |\r\n+--------------------------+------------+--------------+------------------------+-------------------------+------------------------+\r\n| 59c4ad9a909a5049b27360ab | core.local | stanley      | succeeded (0s elapsed) | Fri, 22 Sep 2017        | Fri, 22 Sep 2017       |\r\n|                          |            |              |                        | 06:28:42 UTC            | 06:28:42 UTC           |\r\n| 59c4ad9c909a5049b27360ae | core.local | stanley      | succeeded (1s elapsed) | Fri, 22 Sep 2017        | Fri, 22 Sep 2017       |\r\n|                          |            |              |                        | 06:28:44 UTC            | 06:28:45 UTC           |\r\n| 59c4ada3909a5049b27360b1 | core.local | stanley      | succeeded (0s elapsed) | Fri, 22 Sep 2017        | Fri, 22 Sep 2017       |\r\n|                          |            |              |                        | 06:28:51 UTC            | 06:28:51 UTC           |\r\n| 59c4ada5909a5049b27360b4 | core.local | stanley      | succeeded (1s elapsed) | Fri, 22 Sep 2017        | Fri, 22 Sep 2017       |\r\n|                          |            |              |                        | 06:28:53 UTC            | 06:28:54 UTC           |\r\n+--------------------------+------------+--------------+------------------------+-------------------------+------------------------+\r\n```\r\n```\r\n$ st2 execution list -n -11\r\nERROR: 400 Client Error: Bad Request\r\nMESSAGE: Limit, \"-11\" specified, must be a positive number. for url: http://127.0.0.1:9101/v1/executions/?limit=-11&exclude_attributes=result%2Ctrigger_instance&sort_desc=True&parent=null\r\n\r\n$ curl -X GET -H  'Connection: keep-alive' -H  'Accept-Encoding: gzip, deflate' -H  'Accept: */*' -H  'User-Agent: python-requests/2.14.2' -H  'X-Auth-Token: 46a703f653f84629b5ac15cd145e69fc' 'http://127.0.0.1:9101/v1/executions/?limit=-1&exclude_attributes=result%2Ctrigger_instance&sort_desc=True&parent=null' | grep -c \"start_timestamp\"\r\n\r\n4\r\n```\r\nand block negative integers in limit query param:\r\n\r\n```\r\n$ curl -X GET -H  'Connection: keep-alive' -H  'Accept-Encoding: gzip, deflate' -H  'Accept: */*' -H  'User-Agent: python-requests/2.14.2' -H  'X-Auth-Token: 46a703f653f84629b5ac15cd145e69fc' 'http://127.0.0.1:9101/v1/executions/?limit=-11&exclude_attributes=result%2Ctrigger_instance&sort_desc=True&parent=null'\r\n{\r\n    \"faultstring\": \"Limit, \\\"-11\\\" specified, must be a positive number.\"\r\n}%\r\n```\r\nTODO:\r\n- [ ]  Changelog\r\n- [ ]  RBAC support"},"comment":{"url":"https://api.github.com/repos/StackStorm/st2/issues/comments/331813548","html_url":"https://github.com/StackStorm/st2/pull/3761#issuecomment-331813548","issue_url":"https://api.github.com/repos/StackStorm/st2/issues/3761","id":331813548,"user":{"login":"Kami","id":125088,"avatar_url":"https://avatars3.githubusercontent.com/u/125088?v=4","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},"created_at":"2017-09-25T08:34:25Z","updated_at":"2017-09-25T08:34:25Z","author_association":"OWNER","body":"Also, what will we do with the default limit on the API side? IIRC, right now it's set to 100 for some API endpoints (notably executions), but not all."}}
{"actor":{"display_login":"Kami"}}