-
Notifications
You must be signed in to change notification settings - Fork 56
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
feat(cli): add CLI commands for notices (notices, notice, notify) #298
Conversation
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.
Looks great. Some comments about user understanding.
To make it compile, also update WaitNotices to use Requester.Do Conflicts: client/client.go internals/daemon/api_notices.go internals/daemon/api_notices_test.go
} | ||
} | ||
|
||
last, err := lastWarningTimestamp() |
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.
With this PR, the code is in a funny in-between state, because warnings haven't actually been implemented in terms of notices yet (that's for a future PR). I've tried to make it work, but warnings aren't actually used anywhere yet in Pebble, so it's not critical for this to be perfect (just before warnings get refactored to be implemented in terms of notices).
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.
If the code doesn't exist yet, what about unifying both inside a single file already, on the notices side since this is the more general concept? Per earlier note, there will already be more complexity involved due to how pebble isn't a singleton on the system, so we migtht as well do this only once.
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.
By both do you mean notices and warnings? I'm not a fan of that, because all our other commands (with the exception of changes
and tasks
) are each in their own file, and it's harder to find things if they deviate from that (multiple commands in one file).
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.
Thanks, Ben. A number of comments, but most of them trivial.
} | ||
} | ||
|
||
last, err := lastWarningTimestamp() |
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.
If the code doesn't exist yet, what about unifying both inside a single file already, on the notices side since this is the more general concept? Per earlier note, there will already be more complexity involved due to how pebble isn't a singleton on the system, so we migtht as well do this only once.
Note that CI failures are just because this work is on a fork and unrelated to the changes :) |
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.
LGTM
All Gustavo's comments resolved, now merging. |
This adds the CLI commands for Pebble Notices (see spec JU048).
The new commands are:
pebble notices [--type=<type> --key=<key> --timeout=<duration>]
: list (or wait for) noticespebble notice <id-or-type> [<key>]
: fetch details about a single notice by ID or type+keypebble notify [--repeat-after=<duration>] <key> [<name=value>...]
: record a client ("custom") noticeThe PR also updates the existing
pebble okay
command to acknowledge notices (as well as warnings).I've also added a section to the README explaining notices (including concepts like "repeated") and the associated commands.