app/status: Display update driver info
Read from `/run/rpm-ostree/update-driver.gv` and display the update driver name (and systemd unit if verbose).
This commit is contained in:
parent
a63476d90f
commit
e7558c3dc9
@ -31,6 +31,7 @@
|
||||
#include "rpmostree-builtins.h"
|
||||
#include "rpmostree-ex-builtins.h"
|
||||
#include "rpmostree-libbuiltin.h"
|
||||
#include "rpmostreed-transaction-types.h"
|
||||
#include "rpmostree-dbus-helpers.h"
|
||||
#include "rpmostree-util.h"
|
||||
#include "rpmostree-core.h"
|
||||
@ -289,7 +290,20 @@ print_daemon_state (RPMOSTreeSysroot *sysroot_proxy,
|
||||
|
||||
rpmostreecxx::journal_print_staging_failure ();
|
||||
|
||||
if (g_str_equal (policy, "none"))
|
||||
g_autofree char *update_driver_sd_unit = NULL;
|
||||
g_autofree char *update_driver_name = NULL;
|
||||
if (!get_driver_info (&update_driver_name, &update_driver_sd_unit, error))
|
||||
return FALSE;
|
||||
|
||||
if (update_driver_name && update_driver_sd_unit)
|
||||
{
|
||||
if (opt_verbose)
|
||||
g_print ("AutomaticUpdates: driven by %s (%s)\n",
|
||||
update_driver_name, update_driver_sd_unit);
|
||||
else
|
||||
g_print ("AutomaticUpdates: driven by %s\n", update_driver_name);
|
||||
}
|
||||
else if (g_str_equal (policy, "none"))
|
||||
{
|
||||
/* https://github.com/coreos/fedora-coreos-tracker/issues/271
|
||||
* https://github.com/coreos/rpm-ostree/issues/1747
|
||||
@ -1061,6 +1075,9 @@ rpmostree_builtin_status (int argc,
|
||||
g_autoptr(GVariant) cached_update = NULL;
|
||||
if (rpmostree_os_get_has_cached_update_rpm_diff (os_proxy))
|
||||
cached_update = rpmostree_os_dup_cached_update (os_proxy);
|
||||
g_autoptr(GVariant) driver_info = NULL;
|
||||
if (!get_driver_g_variant (&driver_info, error))
|
||||
return FALSE;
|
||||
|
||||
if (opt_json || opt_jsonpath)
|
||||
{
|
||||
@ -1081,6 +1098,10 @@ rpmostree_builtin_status (int argc,
|
||||
else
|
||||
cached_update_node = json_node_new (JSON_NODE_NULL);
|
||||
json_builder_add_value (builder, cached_update_node);
|
||||
json_builder_set_member_name (builder, "update-driver");
|
||||
JsonNode *update_driver_node =
|
||||
driver_info ? json_gvariant_serialize (driver_info) : json_node_new (JSON_NODE_NULL);
|
||||
json_builder_add_value (builder, update_driver_node);
|
||||
json_builder_end_object (builder);
|
||||
|
||||
JsonNode *json_root = json_builder_get_root (builder);
|
||||
|
@ -49,7 +49,7 @@ gboolean rpmostreed_transaction_get_active (RpmostreedTransactio
|
||||
OstreeSysroot * rpmostreed_transaction_get_sysroot (RpmostreedTransaction *transaction);
|
||||
const char * rpmostreed_transaction_get_client (RpmostreedTransaction *transaction);
|
||||
const char * rpmostreed_transaction_get_agent_id (RpmostreedTransaction *transaction);
|
||||
const char * rpmostreed_transaction_get_sd_unit (RpmostreedTransaction *transaction);
|
||||
const char * rpmostreed_transaction_get_sd_unit (RpmostreedTransaction *transaction);
|
||||
GDBusMethodInvocation *
|
||||
rpmostreed_transaction_get_invocation (RpmostreedTransaction *transaction);
|
||||
const char * rpmostreed_transaction_get_client_address (RpmostreedTransaction *transaction);
|
||||
|
@ -44,9 +44,12 @@ assert_streq "$(vm_get_booted_csum)" "${booted_csum}"
|
||||
vm_assert_journal_has_content $cursor 'Not finalizing; found /run/ostree/staged-deployment-locked'
|
||||
echo "ok locked rebase staging"
|
||||
|
||||
# This also now tests custom client IDs in the journal
|
||||
# This also now tests custom client IDs in the journal and the `deploy --register-driver` option.
|
||||
cursor=$(vm_get_journal_cursor)
|
||||
vm_cmd env RPMOSTREE_CLIENT_ID=testing-agent-id rpm-ostree deploy revision="${commit}" --lock-finalization
|
||||
vm_cmd env RPMOSTREE_CLIENT_ID=testing-agent-id \
|
||||
rpm-ostree deploy revision="${commit}" \
|
||||
--lock-finalization --register-driver TestDriver
|
||||
vm_cmd test -f /run/rpm-ostree/update-driver.gv
|
||||
vm_cmd test -f /run/ostree/staged-deployment-locked
|
||||
if vm_rpmostree finalize-deployment; then
|
||||
assert_not_reached "finalized without expected checksum"
|
||||
@ -57,6 +60,12 @@ vm_cmd journalctl --after-cursor "'$cursor'" -u rpm-ostreed -o json | jq -r '.AG
|
||||
assert_file_has_content agent.txt testing-agent-id
|
||||
vm_cmd journalctl --after-cursor "'$cursor'" -u rpm-ostreed -o json | jq -r '.AGENT_SD_UNIT//""' > agent_sd_unit.txt
|
||||
assert_file_has_content agent_sd_unit.txt sshd.service
|
||||
vm_cmd rpm-ostree status > status.txt
|
||||
assert_file_has_content status.txt 'driven by TestDriver'
|
||||
vm_cmd rpm-ostree status -v > verbose_status.txt
|
||||
assert_file_has_content verbose_status.txt 'driven by TestDriver (sshd.service)'
|
||||
vm_assert_status_jq ".\"update-driver\"[\"driver-name\"] == \"TestDriver\"" \
|
||||
".\"update-driver\"[\"driver-sd-unit\"] == \"sshd.service\""
|
||||
vm_reboot_cmd rpm-ostree finalize-deployment "${commit}"
|
||||
assert_streq "$(vm_get_booted_csum)" "${commit}"
|
||||
vm_assert_journal_has_content $cursor "Finalized deployment; rebooting into ${commit}"
|
||||
|
Loading…
Reference in New Issue
Block a user