-
Notifications
You must be signed in to change notification settings - Fork 506
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
updog: commands for smooth coordination #301
Conversation
Also @jahkeup for the purposes of |
Taking this out of draft and including the jitter feature in #264 here as it makes a bit more sense. |
Flesh out the updog commands to facilitate being called by some update coordinator. - update `check-update` to allow listing all applicable updates - add the --reboot flag to reboot into an update after updating flags - add `prepare` which will download migrations before an update (currently stubbed). Signed-off-by: Samuel Mendoza-Jonas <samjonas@amazon.com>
Instead of calculating some jitter and waiting, Updog will return the calculated update time to the caller so that it can be called again at a later time. The caller should then supply the start time to Updog when calling it again. If an update exists but Updog is in a later wave, the start of that wave is returned. This also adds a helper function `output()` to clean up a few spots where Updog's output depends on whether --json has been set. Signed-off-by: Samuel Mendoza-Jonas <samjonas@amazon.com>
Rebased after #313 |
@sam-aws let me check out the operation given these changes, after that I think we can start to plan the next commands and flags to enrich its functionality. I'll review this PR here in a few! 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One change in logging, but otherwise LGTM.
serde_json::to_string(&object).context(error::UpdateSerialize)? | ||
); | ||
} else { | ||
println!("{}", string); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! This is handy for the human v. machine usage.
Co-Authored-By: Jake <jakeev@amazon.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🐶 🐕 🚢
enum Command { | ||
CheckUpdate, | ||
Whats, | ||
Prepare, | ||
Update, | ||
UpdateImage, | ||
UpdateFlags, | ||
UpdateApply, | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe not for this PR, but I think having doc comments above each of these variants that matches fn usage
is going to be necessary pretty soon.
if let Some((_, wave)) = self.waves.range((Included(0), Included(seed))).last() { | ||
return Some(wave); | ||
} | ||
None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can also be written as:
self.waves.range((Included(0), Included(seed))).last().map(|(_, wave)| wave)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
} | ||
} | ||
Command::Prepare => { | ||
// TODO unimplemented |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you want this to silently do nothing for the time being, rather than use unimplemented!()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the former for dogswatch's sake - we don't do this yet but we don't want dogswatch to think something went wrong.
Issue #, if available:
Related to #184
Description of changes:
Flesh out the updog commands to facilitate being called by some update
coordinator.
check-update
to allow listing all applicable updatesprepare
which will download migrations before an update(currently stubbed).
TODO
Wait for updata: Update metadata generation tool #265 so we can also cover Updog: Report update jitter to caller #264Signed-off-by: Samuel Mendoza-Jonas samjonas@amazon.com
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.