ostree: set umask to be more permissive for ostree operations

We need to set the umask to be more permissive so directories get group
write permissions. See https://pagure.io/releng/issue/8811#comment-629051.

Signed-off-by: Dusty Mabe <dusty@dustymabe.com>
Merges: https://pagure.io/pungi/pull-request/1373
This commit is contained in:
Dusty Mabe 2020-04-09 17:59:04 -04:00 committed by Lubomír Sedlář
parent 477b43d4e9
commit 3509d7a36c

View File

@ -52,9 +52,19 @@ class Tree(OSTree):
cmd.append("--force-nocache")
cmd.append(self.treefile)
shortcuts.run(
cmd, show_cmd=True, stdout=True, logfile=log_file, universal_newlines=True
)
# Set the umask to be more permissive so directories get group write
# permissions. See https://pagure.io/releng/issue/8811#comment-629051
oldumask = os.umask(0o0002)
try:
shortcuts.run(
cmd,
show_cmd=True,
stdout=True,
logfile=log_file,
universal_newlines=True,
)
finally:
os.umask(oldumask)
def _update_summary(self):
"""Update summary metadata"""
@ -92,7 +102,13 @@ class Tree(OSTree):
raise RuntimeError("Refs/heads did not exist in ostree repo")
ref_path = os.path.join(heads_dir, ref)
makedirs(os.path.dirname(ref_path))
# Set the umask to be more permissive so directories get group write
# permissions. See https://pagure.io/releng/issue/8811#comment-629051
oldumask = os.umask(0o0002)
try:
makedirs(os.path.dirname(ref_path))
finally:
os.umask(oldumask)
with open(ref_path, "w") as f:
f.write(commitid + "\n")