Closed mbrannigan closed 5 years ago
@blag thanks for helping out with this! If you need any attachments / additional information, please let me know.
about 100 aliases were making it
I have a strong suspicion that this is the same fundamental issue as https://github.com/StackStorm/st2/issues/4034
Changing https://github.com/StackStorm/st2/blob/master/conf/st2.conf.sample#L34 might work.
Updated st2.conf
to set max_page_size
to 300
in the api
section and restarted st2 with st2ctl restart
.
https://gist.github.com/mbrannigan/1a0919e8d488402be6048092ccdb4d9a
unpause
still isn't listed.
After cleaning up the gist a bit:
cat bar2 | jq -r '.[].formats' | egrep " \"" | grep ".*pause sidekiq"
"pause sidekiq queues (on|in|for|with|using) environment {{ environment }}"
Validates that unpause sidekiq
is still not listed.
cat bar2 | jq -r '.[].formats' | egrep " \"" | wc -l
148
148 aliases now listed during loadCommands
Validated, this is related to: https://github.com/StackStorm/st2/issues/4034
The "148" number is a red herring. There are 100 aliases returned, but those aliases have an average of > 1 format per aliases. So counting formats gives us 148 unique formats, but there are really only 100 aliases.
Proper fix requires proper pagination handling with st2client.js
The following shows the number of aliases returned by the API
curl --silent -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: sdfsdf' http://127.0.0.1:9101/v1/actionalias | grep -c '\"ref\"'
100
Providing a different limit allows the rest of the aliases to be listed.
curl --silent -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: sdfsdf' http://127.0.0.1:9101/v1/actionalias?limit=200 | grep -c '\"ref\"'
111
The missing aliases are present in the json returned.
It looks like the resource module defaults this list to 100:
https://github.com/StackStorm/st2/blob/master/st2api/st2api/controllers/resource.py#L96
I updated actionalias.py to default the limit to 500 in the meantime. The missing aliases are now showing up.
def get_all(self, sort=None, offset=0, limit=500, requester_user=None, **raw_filters):
return super(ActionAliasController, self)._get_all(sort=sort,
offset=offset,
limit=500,
raw_filters=raw_filters,
requester_user=requester_user)
Any update on adding pagination?
Sorry for the errant status update. Actually, this isn't yet fixed. We have a few more things to do before this fix is published in a release:
As you can see, there's a bit of yak shaving we still need to do, but we are actively working on it.
Thank you so much for the work that was put into this. I really do appreciate it!
We have approximately 135 aliases:
Not all of them are being made available to hubot.
When dumping
Raw actions from ST2 API
duringloadCommands
in/opt/stackstorm/chatops/node_modules/hubot-stackstorm/scripts/stackstorm.js
, it was determined that about 100 aliases were making it.