From 4ccad2f64b0ac4a30cf682092e863b8f98a28de8 Mon Sep 17 00:00:00 2001 From: Jonathan Lebon Date: Mon, 13 Aug 2018 15:38:01 -0400 Subject: [PATCH] app/status: Tweak output with --booted Fix `--booted` was printing an extra line after `Deployments:`. While we're there, also update the section name to `BootedDeployment:` in that case to be more correct. (We're not printing all the deployments, only the booted deployment.) Closes: #1503 Approved by: cgwalters --- src/app/rpmostree-builtin-status.c | 7 +++++-- tests/vmcheck/test-misc-1.sh | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/app/rpmostree-builtin-status.c b/src/app/rpmostree-builtin-status.c index a3b87b4d..8b478a26 100644 --- a/src/app/rpmostree-builtin-status.c +++ b/src/app/rpmostree-builtin-status.c @@ -476,7 +476,7 @@ print_one_deployment (RPMOSTreeSysroot *sysroot_proxy, g_autoptr(GVariant) signatures = g_variant_dict_lookup_value (dict, "signatures", G_VARIANT_TYPE ("av")); - if (!first) + if (!first && !opt_only_booted) g_print ("\n"); g_print ("%s ", is_booted ? libsd_special_glyph (BLACK_CIRCLE) : " "); @@ -890,7 +890,10 @@ print_deployments (RPMOSTreeSysroot *sysroot_proxy, booted_osname = osname; } - g_print ("Deployments:\n"); + if (opt_only_booted) + g_print ("BootedDeployment:\n"); + else + g_print ("Deployments:\n"); /* just unpack this so that each iteration doesn't have to dig for it */ const char *cached_update_deployment_id = NULL; diff --git a/tests/vmcheck/test-misc-1.sh b/tests/vmcheck/test-misc-1.sh index 06ad226b..e967b21a 100755 --- a/tests/vmcheck/test-misc-1.sh +++ b/tests/vmcheck/test-misc-1.sh @@ -117,6 +117,7 @@ echo "ok status doesn't require active PAM session" vm_rpmostree status -b > status.txt assert_streq $(grep -F -e 'ostree://' status.txt | wc -l) "1" +assert_file_has_content status.txt BootedDeployment: echo "ok status -b" # Reload as root https://github.com/projectatomic/rpm-ostree/issues/976