Skip to content
Snippets Groups Projects
Commit 71ec4d4e authored by Thomas Woerner's avatar Thomas Woerner
Browse files

Incorporate "Use os.path.isfile() and isdir()" from freeipa upstream

b29db07c3b3d8937f53684fdbba985fec525d69d by Christian Heimes

    Replace custom file_exists() and dir_exists() functions with proper
    functions from Python's stdlib.

    The change also gets rid of pylint's invalid bad-python3-import error,
    https://github.com/PyCQA/pylint/issues/1565
parent 50bbd823
Branches
Tags
No related merge requests found
...@@ -201,8 +201,8 @@ def main(): ...@@ -201,8 +201,8 @@ def main():
if on_master: if on_master:
sssd_enable_service(module, sssdconfig, 'ifp') sssd_enable_service(module, sssdconfig, 'ifp')
if (("ssh" in services and file_exists(paths.SSH_CONFIG)) or if (("ssh" in services and os.path.isfile(paths.SSH_CONFIG)) or
("sshd" in services and file_exists(paths.SSHD_CONFIG))): ("sshd" in services and os.path.isfile(paths.SSHD_CONFIG))):
sssd_enable_service(module, sssdconfig, 'ssh') sssd_enable_service(module, sssdconfig, 'ssh')
if "sudo" in services: if "sudo" in services:
......
...@@ -69,7 +69,7 @@ if NUM_VERSION >= 40400: ...@@ -69,7 +69,7 @@ if NUM_VERSION >= 40400:
if NUM_VERSION >= 40500 and NUM_VERSION < 40590: if NUM_VERSION >= 40500 and NUM_VERSION < 40590:
from cryptography.hazmat.primitives import serialization from cryptography.hazmat.primitives import serialization
from ipapython.ipautil import CalledProcessError, write_tmp_file, \ from ipapython.ipautil import CalledProcessError, write_tmp_file, \
ipa_generate_password, file_exists ipa_generate_password
from ipapython.dn import DN from ipapython.dn import DN
try: try:
from ipalib.install.kinit import kinit_keytab, kinit_password from ipalib.install.kinit import kinit_keytab, kinit_password
......
...@@ -68,7 +68,7 @@ def main(): ...@@ -68,7 +68,7 @@ def main():
# restore cache ######################################################### # restore cache #########################################################
if ipautil.file_exists(paths.ROOT_IPA_CACHE): if os.path.isfile(paths.ROOT_IPA_CACHE):
if options.dm_password is None: if options.dm_password is None:
ansible_module.fail_json(msg="Directory Manager password required") ansible_module.fail_json(msg="Directory Manager password required")
try: try:
......
...@@ -399,7 +399,7 @@ def main(): ...@@ -399,7 +399,7 @@ def main():
msg="servers cannot be used without providing domain") msg="servers cannot be used without providing domain")
else: else:
if not ipautil.file_exists(options.replica_file): if not os.path.isfile(options.replica_file):
ansible_module.fail_json( ansible_module.fail_json(
msg="Replica file %s does not exist" % options.replica_file) msg="Replica file %s does not exist" % options.replica_file)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment