#1373 ostree: set umask to be more permissive for ostree operations
Merged 3 years ago by lsedlar. Opened 3 years ago by dustymabe.
dustymabe/pungi dusty-umask-ostree  into  master

file modified
+17 -4
@@ -52,9 +52,16 @@ 

              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 +99,13 @@ 

                  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")

  

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.

In the main executable I would be worried about setting umask as it would affect all threads, but in the pungi-make-ostree executable it should be fine.

I'll rebase on latest master, fix the formatting and merge. Thanks for the patch!

Commit 3509d7a fixes this pull-request

Pull-Request has been merged by lsedlar

3 years ago