mirror of
https://github.com/freeipa/ansible-freeipa.git
synced 2026-07-30 03:14:42 +00:00
ipa[server,replica,client]: pylint fixes
This commit is contained in:
@@ -45,7 +45,7 @@ def run_cmd(args, stdin=None):
|
||||
|
||||
p = subprocess.Popen(args, stdin=p_in, stdout=p_out, stderr=p_err,
|
||||
close_fds=True)
|
||||
stdout, stderr = p.communicate(stdin)
|
||||
__temp, stderr = p.communicate(stdin)
|
||||
|
||||
if p.returncode != 0:
|
||||
raise RuntimeError(stderr)
|
||||
|
||||
@@ -97,9 +97,9 @@ def main():
|
||||
|
||||
host_principal = 'host/%s@%s' % (hostname, realm)
|
||||
os.environ['KRB5CCNAME'] = paths.IPA_DNS_CCACHE
|
||||
|
||||
|
||||
ca_certs = x509.load_certificate_list_from_file(paths.IPA_CA_CRT)
|
||||
if NUM_VERSION >= 40500 and NUM_VERSION < 40590:
|
||||
if 40500 <= NUM_VERSION < 40590:
|
||||
ca_certs = [ cert.public_bytes(serialization.Encoding.DER)
|
||||
for cert in ca_certs ]
|
||||
elif NUM_VERSION < 40500:
|
||||
|
||||
@@ -8,6 +8,7 @@ from six.moves.configparser import RawConfigParser
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
|
||||
# pylint: disable=unused-import
|
||||
try:
|
||||
from ipalib import api
|
||||
except ImportError:
|
||||
@@ -126,7 +127,7 @@ def get_ipa_version():
|
||||
version=version.VERSION,
|
||||
version_info=version_info
|
||||
)
|
||||
|
||||
|
||||
def main():
|
||||
module = AnsibleModule(
|
||||
argument_spec = dict(),
|
||||
|
||||
@@ -327,7 +327,7 @@ def main():
|
||||
except errors.NotFound:
|
||||
host = None
|
||||
|
||||
if state == 'present' or state == 'disabled':
|
||||
if state in ['present','disabled']:
|
||||
changed = ensure_host_present(module, api, host)
|
||||
elif state == 'absent':
|
||||
changed = ensure_host_absent(module, api, host)
|
||||
|
||||
@@ -137,7 +137,7 @@ def main():
|
||||
realm=dict(required=True),
|
||||
hostname=dict(required=True),
|
||||
kdc=dict(required=True),
|
||||
basedn=dict(required=True),
|
||||
basedn=dict(required=True),
|
||||
principal=dict(required=False),
|
||||
password=dict(required=False, no_log=True),
|
||||
keytab=dict(required=False),
|
||||
|
||||
@@ -77,5 +77,6 @@ def main():
|
||||
|
||||
module.exit_json(changed=True)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
@@ -139,7 +139,7 @@ def main():
|
||||
logger.info("Skipping chrony configuration")
|
||||
|
||||
else:
|
||||
ntp_srv_servers = [ ]
|
||||
ntp_srv_servers = []
|
||||
if not options.on_master and options.conf_ntp:
|
||||
# Attempt to sync time with IPA server.
|
||||
# If we're skipping NTP configuration, we also skip the time sync here.
|
||||
@@ -176,5 +176,6 @@ def main():
|
||||
# Done
|
||||
module.exit_json(changed=synced_ntp)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
@@ -461,7 +461,7 @@ def main():
|
||||
### client.install_check ###
|
||||
|
||||
logger.info("This program will set up FreeIPA client.")
|
||||
logger.info("Version {}".format(version.VERSION))
|
||||
logger.info("Version %s", version.VERSION)
|
||||
logger.info("")
|
||||
|
||||
cli_domain_source = 'Unknown source'
|
||||
@@ -494,7 +494,7 @@ def main():
|
||||
except timeconf.NTPConflictingService as e:
|
||||
logger.info(
|
||||
"WARNING: conflicting time&date synchronization service "
|
||||
"'%s' will be disabled in favor of chronyd" % \
|
||||
"'%s' will be disabled in favor of chronyd",
|
||||
e.conflicting_service)
|
||||
logger.info("")
|
||||
except timeconf.NTPConfigurationError:
|
||||
@@ -563,6 +563,7 @@ def main():
|
||||
rval=CLIENT_INSTALL_ERROR)
|
||||
|
||||
(nssldap_installed, nosssd_files) = nssldap_exists()
|
||||
(nssldap_installed, __temp) = nssldap_exists()
|
||||
if not nssldap_installed:
|
||||
raise ScriptError(
|
||||
"One of these packages must be installed: nss_ldap or "
|
||||
|
||||
@@ -159,7 +159,7 @@ def main():
|
||||
ping_test_ok = True
|
||||
except OSError:
|
||||
pass
|
||||
except GSSError as e:
|
||||
except GSSError:
|
||||
pass
|
||||
|
||||
# Second try: Validate krb5 keytab with temporary krb5
|
||||
@@ -197,7 +197,7 @@ def main():
|
||||
except OSError:
|
||||
pass
|
||||
|
||||
except GSSError as e:
|
||||
except GSSError:
|
||||
pass
|
||||
|
||||
finally:
|
||||
|
||||
Reference in New Issue
Block a user