Skip to content
This repository has been archived by the owner on Jun 4, 2021. It is now read-only.

Fix event ordering #332

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

smcclellan
Copy link
Contributor

Facts, whether events, node log, hook log, or commands, were counter-
intuitively ordered. This commit puts the latest entry at the bottom,
which should be most useful.

Additionally, whenever a limited "fact" collection is requested, it will
limit from the bottom up. This means razor events --limit 5 will show the 5
most recent events, with the most recent at the bottom.

Fixes https://tickets.puppetlabs.com/browse/RAZOR-734

@smcclellan smcclellan force-pushed the events-ordering branch 5 times, most recently from 7c7b9cf to 30724bd Compare December 12, 2015 10:19
Scott McClellan added 2 commits December 12, 2015 04:21
Facts, whether events, node log, hook log, or commands, were counter-
intuitively ordered. This commit puts the latest entry at the bottom,
which should be most useful.

Additionally, whenever a limited "fact" collection is requested, it will
limit from the bottom up. This means `razor events --limit 5` will show the 5
most recent events, with the most recent at the bottom.

Fixes https://tickets.puppetlabs.com/browse/RAZOR-734
The commands collection, which can grow quite lengthy, currently does not
allow any pagination. This provides the "start" and "limit" query arguments,
which are present for many other collections.
if params[:start].nil? and params[:limit] and !total.nil?
# We have a request for a limited list of facts without a starting
# value. Take from the end so the latest entries are included.
params[:start] = [total - params[:limit], 0].max
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This may be considered a break of the API. Probably a better way to deal with this is to add metadata properties to the previous endpoint or something. I'm not clear on the best approach here.

@puppetcla
Copy link

CLA signed by all contributors.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


Scott McClellan seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

1 similar comment
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


Scott McClellan seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants