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 /ipa-client | |
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 'ipa-client')
-rwxr-xr-x | ipa-client/ipa-install/ipa-client-install | 8 | ||||
-rw-r--r-- | ipa-client/ipaclient/ipa_certupdate.py | 2 | ||||
-rw-r--r-- | ipa-client/ipaclient/ipachangeconf.py | 4 |
3 files changed, 7 insertions, 7 deletions
diff --git a/ipa-client/ipa-install/ipa-client-install b/ipa-client/ipa-install/ipa-client-install index 91323ae11..17cd2b687 100755 --- a/ipa-client/ipa-install/ipa-client-install +++ b/ipa-client/ipa-install/ipa-client-install @@ -847,7 +847,7 @@ def configure_ipa_conf(fstore, cli_basedn, cli_realm, cli_domain, cli_server, ho target_fname = paths.IPA_DEFAULT_CONF fstore.backup_file(target_fname) ipaconf.newConf(target_fname, opts) - os.chmod(target_fname, 0644) + os.chmod(target_fname, 0o644) return 0 @@ -1016,7 +1016,7 @@ def configure_openldap_conf(fstore, cli_basedn, cli_server): root_logger.debug(error_msg.format(path=target_fname, err=str(e))) return False - os.chmod(target_fname, 0644) + os.chmod(target_fname, 0o644) return True def hardcode_ldap_server(cli_server): @@ -1110,7 +1110,7 @@ def configure_krb5_conf(cli_realm, cli_domain, cli_server, cli_kdc, dnsok, root_logger.debug("%s", krbconf.dump(opts)) krbconf.newConf(filename, opts) - os.chmod(filename, 0644) + os.chmod(filename, 0o644) return 0 @@ -1981,7 +1981,7 @@ def get_ca_certs(fstore, options, server, basedn, realm): # Make sure the file permissions are correct try: - os.chmod(CACERT, 0644) + os.chmod(CACERT, 0o644) except Exception, e: raise errors.FileError(reason=u"Unable set permissions on ca " u"cert '%s': %s" % (CACERT, e)) diff --git a/ipa-client/ipaclient/ipa_certupdate.py b/ipa-client/ipaclient/ipa_certupdate.py index a9530674c..26e02ea33 100644 --- a/ipa-client/ipaclient/ipa_certupdate.py +++ b/ipa-client/ipaclient/ipa_certupdate.py @@ -164,7 +164,7 @@ class CertUpdate(admintool.AdminTool): self.update_file(paths.CA_CRT, certs) - def update_file(self, filename, certs, mode=0444): + def update_file(self, filename, certs, mode=0o444): certs = (c[0] for c in certs if c[2] is not False) try: x509.write_certificate_list(certs, filename) diff --git a/ipa-client/ipaclient/ipachangeconf.py b/ipa-client/ipaclient/ipachangeconf.py index edf34f5ae..2c3185716 100644 --- a/ipa-client/ipaclient/ipachangeconf.py +++ b/ipa-client/ipaclient/ipachangeconf.py @@ -481,7 +481,7 @@ class IPAChangeConf: # we want to fail in that case shutil.copy2(file, (file + ".ipabkp")) - f = openLocked(file, 0644) + f = openLocked(file, 0o644) oldopts = self.parse(f) @@ -520,7 +520,7 @@ class IPAChangeConf: # The orign file did not exist pass - f = openLocked(file, 0644) + f = openLocked(file, 0o644) # Trunkate f.seek(0) |