-
Notifications
You must be signed in to change notification settings - Fork 198
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
Upgrade agent #1368
Upgrade agent #1368
Conversation
The high level goal is to render in a better way what caused an update: coreos#247 (comment) This gets us for Cockpit: `Initiated txn DownloadUpdateRpmDiff for client(dbus:1.28 unit:session-6.scope uid:0): /org/projectatomic/rpmostree1/fedora_atomic` which isn't as good as I'd hoped; I was thinking we'd get `cockpit.service` but actually Cockpit does invocations as a real login for good reason. We get a similar result from the CLI.
This makes the logs a bit more useful, but the ultimate goal here is to write the originating client `id` to the cached update data, so users know that e.g. `gnome-software` triggered it.
Then e.g.
|
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 idea, just a few nits otherwise LGTM!
src/daemon/rpmostreed-daemon.c
Outdated
@@ -96,26 +100,39 @@ G_DEFINE_TYPE_WITH_CODE (RpmostreedDaemon, rpmostreed_daemon, G_TYPE_OBJECT, | |||
struct RpmOstreeClient { | |||
char *address; | |||
guint name_watch_id; | |||
/* In Rust this'd be Option<uid_t> etc. */ |
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.
RIIR? :)
if (get_client_pid (self, address, &client->pid)) | ||
{ | ||
client->pid_valid = TRUE; | ||
if (sd_pid_get_user_unit (client->pid, &client->sd_unit) == 0) |
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.
So in your example, this returned session-1.scope
for the cli. Would it (or the following call) return e.g. rpm-ostreed-automatic.service
for the automatic updates timer?
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.
Yep with this it looks like:
May 16 16:18:56 localhost.localdomain rpm-ostree[3390]: client(id:cli dbus:1.47 unit:rpm-ostreed-automatic.service uid:0) vanished; remaining=0
And now checked in a test ⬇️
@@ -32,7 +32,7 @@ | |||
to either invoke methods on the daemon, or monitor status. | |||
If no clients are registered, the daemon may exit. | |||
|
|||
No options are currently defined. | |||
'name' (type 's') - Package/component name (e.g. `cockpit`, `gnome-software`) |
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.
s/name/id/
?
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.
Yeah, I noticed that in self-review, had already pushed a fixup.
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.
Ahh right, sigh. I tend to do reviews by looking at each commit one at a time, and I missed the fixup! WDYT if in general we just squash fixups into the commits as long as the PR hasn't been reviewed? Fixups are really helpful for follow-up reviews, but demand extra processing for initial reviews.
vm_rpmostree status -v > out.txt | ||
assert_not_file_has_content out.txt "Available update" | ||
# And check the unit name https://github.com/projectatomic/rpm-ostree/pull/1368 | ||
vm_cmd journalctl -u rpm-ostreed --after-cursor > journal.txt |
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.
Don't we want to pass $cursor
here?
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.
Argh, I ran test-autoupdate-stage
locally. Fixed ⬇️
This makes the logs a bit more useful, but the ultimate goal here is to write the originating client `id` to the cached update data, so users know that e.g. `gnome-software` triggered it. Closes: #1368 Approved by: jlebon
☀️ Test successful - status-atomicjenkins |
See: coreos/rpm-ostree#1368 This will help users understand what software initiated updates.
May 15 21:37:19 localhost.localdomain rpm-ostree[4340]: client(id:cli dbus:1.95 unit:session-1.scope uid:0) vanished; remaining=0