diff options
author | Petr Viktorin <pviktori@redhat.com> | 2015-07-15 16:38:06 +0200 |
---|---|---|
committer | Jan Cholasta <jcholast@redhat.com> | 2015-07-31 15:22:19 +0200 |
commit | b8c46f2a32d0d8c2dc6ef0867f85f63cf076a004 (patch) | |
tree | 28e52d8fe2e3531e226d8c2249d6b7216f80bf48 /ipaserver/install/ipa_restore.py | |
parent | a908be2785d4388e3c97c7cd543c817c527d73c9 (diff) | |
download | freeipa-b8c46f2a32d0d8c2dc6ef0867f85f63cf076a004.tar.gz freeipa-b8c46f2a32d0d8c2dc6ef0867f85f63cf076a004.tar.xz freeipa-b8c46f2a32d0d8c2dc6ef0867f85f63cf076a004.zip |
Modernize number literals
Use Python-3 compatible syntax, without breaking compatibility with py 2.7
- Octals literals start with 0o to prevent confusion
- The "L" at the end of large int literals is not required as they use
long on Python 2 automatically.
- Using 'int' instead of 'long' for small numbers is OK in all cases except
strict type checking checking, e.g. type(0).
https://fedorahosted.org/freeipa/ticket/4985
Reviewed-By: Jan Cholasta <jcholast@redhat.com>
Diffstat (limited to 'ipaserver/install/ipa_restore.py')
-rw-r--r-- | ipaserver/install/ipa_restore.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/ipaserver/install/ipa_restore.py b/ipaserver/install/ipa_restore.py index 528a6daf0..62b31c580 100644 --- a/ipaserver/install/ipa_restore.py +++ b/ipaserver/install/ipa_restore.py @@ -57,10 +57,10 @@ def recursive_chown(path, uid, gid): for root, dirs, files in os.walk(path): for dir in dirs: os.chown(os.path.join(root, dir), uid, gid) - os.chmod(os.path.join(root, dir), 0750) + os.chmod(os.path.join(root, dir), 0o750) for file in files: os.chown(os.path.join(root, file), uid, gid) - os.chmod(os.path.join(root, file), 0640) + os.chmod(os.path.join(root, file), 0o640) def decrypt_file(tmpdir, filename, keyring): @@ -290,9 +290,9 @@ class Restore(admintool.AdminTool): # Temporary directory for decrypting files before restoring self.top_dir = tempfile.mkdtemp("ipa") os.chown(self.top_dir, pent.pw_uid, pent.pw_gid) - os.chmod(self.top_dir, 0750) + os.chmod(self.top_dir, 0o750) self.dir = os.path.join(self.top_dir, "ipa") - os.mkdir(self.dir, 0750) + os.mkdir(self.dir, 0o750) os.chown(self.dir, pent.pw_uid, pent.pw_gid) @@ -512,7 +512,7 @@ class Restore(admintool.AdminTool): if not os.path.exists(ldifdir): pent = pwd.getpwnam(DS_USER) - os.mkdir(ldifdir, 0770) + os.mkdir(ldifdir, 0o770) os.chown(ldifdir, pent.pw_uid, pent.pw_gid) ipautil.backup_file(ldiffile) @@ -733,7 +733,7 @@ class Restore(admintool.AdminTool): if instance != 'PKI-IPA': return os.path.join(paths.VAR_LIB_DIRSRV, 'scripts-%s' % instance) else: - if sys.maxsize > 2**32L: + if sys.maxsize > 2**32: libpath = 'lib64' else: libpath = 'lib' @@ -770,7 +770,7 @@ class Restore(admintool.AdminTool): for dir in dirs: try: self.log.debug('Creating %s' % dir) - os.mkdir(dir, 0770) + os.mkdir(dir, 0o770) os.chown(dir, pent.pw_uid, pent.pw_gid) tasks.restore_context(dir) except Exception, e: |