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.
This commit is contained in:
parent
92e75c375c
commit
462c498dcf
1 changed files with 3 additions and 1 deletions
|
|
@ -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]
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue