937546
From 5badb4233cb59a6045e544576ebabff94c02131e Mon Sep 17 00:00:00 2001
937546
From: Florence Blanc-Renaud <flo@redhat.com>
937546
Date: Wed, 16 Oct 2019 17:02:38 +0200
937546
Subject: [PATCH] ipa-backup: fix python2 issue with os.mkdir
937546
937546
Python2 and python3 have different interfaces for os.mkdir:
937546
python2: os.mkdir(path[, mode])
937546
python3: os.mkdir(path, mode=0o777, *, dir_fd=None)
937546
937546
ipa-backup is using the python3 format, which breaks deployments using
937546
python2. The fix consists in using os.mkdir(path, 0o700) instead of
937546
os.mkdir(path, mode=0o700).
937546
937546
Fixes: https://pagure.io/freeipa/issue/8099
937546
Reviewed-By: Alexander Bokovoy <abbra@users.noreply.github.com>
937546
---
937546
 ipaserver/install/ipa_backup.py | 4 ++--
937546
 1 file changed, 2 insertions(+), 2 deletions(-)
937546
937546
diff --git a/ipaserver/install/ipa_backup.py b/ipaserver/install/ipa_backup.py
937546
index 96f3d7e1c6abdc6a4f3080810a8ea3bd8211d16b..496bbd8925972a6e1dbdd00c01b62f2e2c4398d6 100644
937546
--- a/ipaserver/install/ipa_backup.py
937546
+++ b/ipaserver/install/ipa_backup.py
937546
@@ -289,7 +289,7 @@ class Backup(admintool.AdminTool):
937546
         os.chown(self.top_dir, pent.pw_uid, pent.pw_gid)
937546
         os.chmod(self.top_dir, 0o750)
937546
         self.dir = os.path.join(self.top_dir, "ipa")
937546
-        os.mkdir(self.dir, mode=0o750)
937546
+        os.mkdir(self.dir, 0o750)
937546
         os.chown(self.dir, pent.pw_uid, pent.pw_gid)
937546
         self.tarfile = None
937546
 
937546
@@ -663,7 +663,7 @@ class Backup(admintool.AdminTool):
937546
             filename = os.path.join(backup_dir, "ipa-full.tar")
937546
 
937546
         try:
937546
-            os.mkdir(backup_dir, mode=0o700)
937546
+            os.mkdir(backup_dir, 0o700)
937546
         except (OSError, IOError) as e:
937546
             raise admintool.ScriptError(
937546
                 'Could not create backup directory: %s' % e
937546
-- 
937546
2.20.1
937546