StackStorm / StackStorm/st2

Query param offset, not working for rules api

Open
#3,759 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
6.5k
Forks
787
PR merge metrics
No merged PRs in 30d

Description

$ st2 rule list
+------------------------------+---------+-------------------------------------------+---------+
| ref                          | pack    | description                               | enabled |
+------------------------------+---------+-------------------------------------------+---------+
| chatops.notify               | chatops | Notification rule to send results of      | True    |
|                              |         | action executions to stream for chatops   |         |
| nagios.check_load            | nagios  | Check cpu load on host                    | False   |
| nagios.check_load_procd      | nagios  | Check D state procs on host when load is  | True    |
|                              |         | high                                      |         |
| nagios.check_load_procs      | nagios  | Check running procs on host when load is  | True    |
|                              |         | high                                      |         |
| nagios.check_proc            | nagios  | Check process state on host               | True    |
| nagios.notify_chat           | nagios  | Post to chat when nagios service state    | False   |
|                              |         | changes                                   |         |
| nagios.send_mail             | nagios  | Send mail when nagios service state       | False   |
|                              |         | changes                                   |         |
| twitter.relay_tweet_to_slack | twitter | Relay Tweet to the Slack channel.         | True    |
+------------------------------+---------+-------------------------------------------+---------+


$ 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: 86f19c4f4b6c43b993fbf89b074d9dd7' 'http://127.0.0.1:9101/v1/rules/?limit=1&offset=0' | grep '"ref": "chatops.post_result"'
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  1017  100  1017    0     0  47267      0 --:--:-- --:--:-- --:--:-- 48428
            "ref": "chatops.post_result",


$ 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: 86f19c4f4b6c43b993fbf89b074d9dd7' 'http://127.0.0.1:9101/v1/rules/?limit=1&offset=3' | grep '"ref": "chatops.post_result"'
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  1017  100  1017    0     0  41784      0 --:--:-- --:--:-- --:--:-- 42375
            "ref": "chatops.post_result",

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the requests against the /v1/rules/ endpoint with limit=1 and different offset values. Trace the rules API pagination handling to determine why offset=3 returns the same result as offset=0; done means successive offsets return the corresponding rule pages, with tests covering the behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.