From dcfc7521acaf21072032777b9683796ff710bdfe Mon Sep 17 00:00:00 2001 From: Chris Kyrouac Date: Tue, 11 Jun 2024 09:54:25 -0400 Subject: [PATCH] status: Use prepare_for_write instead of require_root This prevents /sysroot from switching to being persistently mounted as rw. Signed-off-by: Chris Kyrouac --- lib/src/status.rs | 2 +- tests/integration/playbooks/check-system.yaml | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/src/status.rs b/lib/src/status.rs index e8f1fa588..3311b355c 100644 --- a/lib/src/status.rs +++ b/lib/src/status.rs @@ -305,7 +305,7 @@ pub(crate) async fn status(opts: super::cli::StatusOpts) -> Result<()> { let host = if !Utf8Path::new("/run/ostree-booted").try_exists()? { Default::default() } else { - crate::cli::require_root()?; + crate::cli::prepare_for_write().await?; let sysroot = super::cli::get_locked_sysroot().await?; let booted_deployment = sysroot.booted_deployment(); let (_deployments, host) = get_status(&sysroot, booted_deployment.as_ref())?; diff --git a/tests/integration/playbooks/check-system.yaml b/tests/integration/playbooks/check-system.yaml index ede5a3ae2..00927b659 100644 --- a/tests/integration/playbooks/check-system.yaml +++ b/tests/integration/playbooks/check-system.yaml @@ -133,13 +133,13 @@ shell: findmnt -r -o OPTIONS -n /sysroot | awk -F "," '{print $1}' register: result_sysroot_mount_status - - name: /sysroot should be mount with rw permission + - name: /sysroot should be mount with ro permission block: - assert: that: - - result_sysroot_mount_status.stdout == "rw" - fail_msg: "/sysroot is not mounted with rw permission" - success_msg: "/sysroot is mounted with rw permission" + - result_sysroot_mount_status.stdout == "ro" + fail_msg: "/sysroot is not mounted with ro permission" + success_msg: "/sysroot is mounted with ro permission" always: - set_fact: total_counter: "{{ total_counter | int + 1 }}"