From 462c498dcff57f2b8628a47d5fc4d25987930247 Mon Sep 17 00:00:00 2001 From: Gianluca Zuccarelli Date: Tue, 6 Feb 2024 14:06:05 +0000 Subject: [PATCH] util/mnt: add explicit rw option Under certain conditions a bind mount without a specified `rw` or `ro` option gets mounted read-only. We need a way to be explicit about needing a rw mount. We might want to change this in the future to be a single option (mode optional?) with valid values "rw", "ro". It's not entirely clear what the conditions are but it occurs when bind mounting the containers storage into the osbuild store, which we will need for the next few commits. --- osbuild/util/mnt.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/osbuild/util/mnt.py b/osbuild/util/mnt.py index 828659fb..b5fefb89 100644 --- a/osbuild/util/mnt.py +++ b/osbuild/util/mnt.py @@ -44,12 +44,14 @@ class MountGuard(contextlib.AbstractContextManager): def __init__(self): self.mounts = [] - def mount(self, source, target, bind=True, ro=False, mode="0755"): + def mount(self, source, target, bind=True, ro=False, rw=False, mode="0755"): options = [] if bind: options += ["bind"] if ro: options += ["ro"] + if rw: + options += ["rw"] if mode: options += [mode]