From 55040a56ad5c764bf0ad0ace68a2b208f4cf3ff9 Mon Sep 17 00:00:00 2001 From: Jonathan Lebon Date: Sat, 17 Feb 2018 18:59:05 +0000 Subject: [PATCH] daemon/sysroot: Emit UPDATED signal for configs Let's also make sure we refresh `RPMOSTreeOS` objects when configs changed. Specifically, what they export to their D-Bus interfaces may be dependent on daemon settings, as is the case with auto-updates. We might want to decouple this into two separate signals in the future (one for sysroot changes, and one for config changes), though given that only `RPMOSTreeOS` listens for `UPDATED` right now, we can just get away with a single one for the time being. Closes: #1261 Approved by: cgwalters --- src/daemon/rpmostreed-sysroot.c | 14 ++++++++++++-- src/daemon/rpmostreed-sysroot.h | 1 + src/daemon/rpmostreed-transaction.c | 2 +- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/daemon/rpmostreed-sysroot.c b/src/daemon/rpmostreed-sysroot.c index c694077e..4de637a1 100644 --- a/src/daemon/rpmostreed-sysroot.c +++ b/src/daemon/rpmostreed-sysroot.c @@ -409,6 +409,7 @@ handle_unregister_client (RPMOSTreeSysroot *object, return TRUE; } +/* remap relevant daemon configs to D-Bus properties */ static gboolean reset_config_properties (RpmostreedSysroot *self, GError **error) @@ -438,9 +439,15 @@ handle_reload_config (RPMOSTreeSysroot *object, if (changed && !reset_config_properties (self, error)) goto out; - if (!rpmostreed_sysroot_reload (self, error)) + gboolean sysroot_changed; + if (!rpmostreed_sysroot_reload (self, &sysroot_changed, error)) goto out; + /* also send an UPDATED signal if configs changed to cause OS interfaces to reload; we do + * it here if not done already in `rpmostreed_sysroot_reload` */ + if (changed && !sysroot_changed) + g_signal_emit (self, signals[UPDATED], 0); + rpmostree_sysroot_complete_reload_config (object, invocation); out: if (local_error) @@ -683,6 +690,7 @@ rpmostreed_sysroot_class_init (RpmostreedSysrootClass *klass) gboolean rpmostreed_sysroot_reload (RpmostreedSysroot *self, + gboolean *out_changed, GError **error) { gboolean ret = FALSE; @@ -695,6 +703,8 @@ rpmostreed_sysroot_reload (RpmostreedSysroot *self, goto out; ret = TRUE; + if (out_changed) + *out_changed = did_change; out: if (ret && did_change) g_signal_emit (self, signals[UPDATED], 0); @@ -713,7 +723,7 @@ on_deploy_changed (GFileMonitor *monitor, if (event_type == G_FILE_MONITOR_EVENT_ATTRIBUTE_CHANGED) { - if (!rpmostreed_sysroot_reload (self, &error)) + if (!rpmostreed_sysroot_reload (self, NULL, &error)) goto out; } diff --git a/src/daemon/rpmostreed-sysroot.h b/src/daemon/rpmostreed-sysroot.h index db6aa446..f1281b71 100644 --- a/src/daemon/rpmostreed-sysroot.h +++ b/src/daemon/rpmostreed-sysroot.h @@ -36,6 +36,7 @@ gboolean rpmostreed_sysroot_populate (RpmostreedSysroot *self GCancellable *cancellable, GError **error); gboolean rpmostreed_sysroot_reload (RpmostreedSysroot *self, + gboolean *out_changed, GError **error); OstreeSysroot * rpmostreed_sysroot_get_root (RpmostreedSysroot *self); diff --git a/src/daemon/rpmostreed-transaction.c b/src/daemon/rpmostreed-transaction.c index 3e4c4900..a36634ec 100644 --- a/src/daemon/rpmostreed-transaction.c +++ b/src/daemon/rpmostreed-transaction.c @@ -326,7 +326,7 @@ transaction_execute_done_cb (GObject *source_object, success = g_task_propagate_boolean (G_TASK (result), &local_error); if (success) { - if (!rpmostreed_sysroot_reload (rpmostreed_sysroot_get (), &local_error)) + if (!rpmostreed_sysroot_reload (rpmostreed_sysroot_get (), NULL, &local_error)) success = FALSE; }