mirror of
https://github.com/freeipa/ansible-freeipa.git
synced 2026-07-25 00:44:42 +00:00
Made code flake8 friendly
This commit is contained in:
@@ -97,11 +97,10 @@ RETURN = """
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
from ansible.module_utils._text import to_text
|
|
||||||
from ansible.module_utils.ansible_freeipa_module import temp_kinit, \
|
from ansible.module_utils.ansible_freeipa_module import temp_kinit, \
|
||||||
temp_kdestroy, valid_creds, api_connect, api_command, \
|
temp_kdestroy, valid_creds, api_connect, \
|
||||||
api_command_no_name, compare_args_ipa, module_params_get, \
|
api_command_no_name, compare_args_ipa, module_params_get, \
|
||||||
gen_add_del_lists, is_ipv4_addr, is_ipv6_addr, ipalib_errors
|
is_ipv4_addr, is_ipv6_addr
|
||||||
|
|
||||||
|
|
||||||
def find_dnsconfig(module):
|
def find_dnsconfig(module):
|
||||||
|
|||||||
@@ -221,7 +221,10 @@ def main():
|
|||||||
# Get parameters
|
# Get parameters
|
||||||
|
|
||||||
# general
|
# general
|
||||||
ipaadmin_principal = module_params_get(ansible_module, "ipaadmin_principal")
|
ipaadmin_principal = module_params_get(
|
||||||
|
ansible_module,
|
||||||
|
"ipaadmin_principal",
|
||||||
|
)
|
||||||
ipaadmin_password = module_params_get(ansible_module, "ipaadmin_password")
|
ipaadmin_password = module_params_get(ansible_module, "ipaadmin_password")
|
||||||
names = module_params_get(ansible_module, "name")
|
names = module_params_get(ansible_module, "name")
|
||||||
|
|
||||||
|
|||||||
@@ -875,9 +875,11 @@ def main():
|
|||||||
res_find_dnsrecord = find_dnsrecord(ansible_module, name)
|
res_find_dnsrecord = find_dnsrecord(ansible_module, name)
|
||||||
except ipalib_errors.NotFound as e:
|
except ipalib_errors.NotFound as e:
|
||||||
msg = str(e)
|
msg = str(e)
|
||||||
if ip_address is None and \
|
dns_not_configured = "DNS is not configured" in msg
|
||||||
("DNS is not configured" in msg or \
|
dns_zone_not_found = "DNS zone not found" in msg
|
||||||
"DNS zone not found" in msg):
|
if ip_address is None and (
|
||||||
|
dns_not_configured or dns_zone_not_found
|
||||||
|
):
|
||||||
# IP address(es) not given and no DNS support in IPA
|
# IP address(es) not given and no DNS support in IPA
|
||||||
# -> Ignore failure
|
# -> Ignore failure
|
||||||
# IP address(es) not given and DNS zone is not found
|
# IP address(es) not given and DNS zone is not found
|
||||||
|
|||||||
@@ -655,9 +655,9 @@ def check_parameters(module, state, action,
|
|||||||
|
|
||||||
def extend_emails(email, default_email_domain):
|
def extend_emails(email, default_email_domain):
|
||||||
if email is not None:
|
if email is not None:
|
||||||
return [ "%s@%s" % (_email, default_email_domain)
|
return ["%s@%s" % (_email, default_email_domain)
|
||||||
if "@" not in _email else _email
|
if "@" not in _email else _email
|
||||||
for _email in email]
|
for _email in email]
|
||||||
return email
|
return email
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#!/usr/bin/python3
|
#!/usr/bin/python3
|
||||||
|
|
||||||
# Test ipaclient python3 binding
|
# Test ipaclient python3 binding
|
||||||
from ipaclient.install.client import SECURE_PATH
|
from ipaclient.install.client import SECURE_PATH # noqa: F401
|
||||||
|
|
||||||
# Check ipapython version to be >= 4.6
|
# Check ipapython version to be >= 4.6
|
||||||
from ipapython.version import NUM_VERSION, VERSION
|
from ipapython.version import NUM_VERSION, VERSION
|
||||||
|
|||||||
@@ -100,7 +100,6 @@ def main():
|
|||||||
|
|
||||||
realm = module.params.get('realm')
|
realm = module.params.get('realm')
|
||||||
hostname = module.params.get('hostname')
|
hostname = module.params.get('hostname')
|
||||||
servers = module.params.get('servers')
|
|
||||||
debug = module.params.get('debug')
|
debug = module.params.get('debug')
|
||||||
|
|
||||||
host_principal = 'host/%s@%s' % (hostname, realm)
|
host_principal = 'host/%s@%s' % (hostname, realm)
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ from ansible.module_utils.basic import AnsibleModule
|
|||||||
|
|
||||||
# pylint: disable=unused-import
|
# pylint: disable=unused-import
|
||||||
try:
|
try:
|
||||||
from ipalib import api
|
from ipalib import api # noqa: F401
|
||||||
except ImportError:
|
except ImportError:
|
||||||
HAS_IPALIB = False
|
HAS_IPALIB = False
|
||||||
else:
|
else:
|
||||||
@@ -27,7 +27,7 @@ else:
|
|||||||
from ipapython import sysrestore
|
from ipapython import sysrestore
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import ipaserver
|
import ipaserver # noqa: F401
|
||||||
except ImportError:
|
except ImportError:
|
||||||
HAS_IPASERVER = False
|
HAS_IPASERVER = False
|
||||||
else:
|
else:
|
||||||
@@ -41,7 +41,7 @@ VAR_LIB_PKI_TOMCAT = "/var/lib/pki/pki-tomcat"
|
|||||||
def is_ntpd_configured():
|
def is_ntpd_configured():
|
||||||
# ntpd is configured when sysrestore.state contains the line
|
# ntpd is configured when sysrestore.state contains the line
|
||||||
# [ntpd]
|
# [ntpd]
|
||||||
ntpd_conf_section = re.compile('^\s*\[ntpd\]\s*$')
|
ntpd_conf_section = re.compile(r'^\s*\[ntpd\]\s*$')
|
||||||
|
|
||||||
try:
|
try:
|
||||||
with open(SERVER_SYSRESTORE_STATE) as f:
|
with open(SERVER_SYSRESTORE_STATE) as f:
|
||||||
@@ -56,7 +56,7 @@ def is_ntpd_configured():
|
|||||||
def is_dns_configured():
|
def is_dns_configured():
|
||||||
# dns is configured when /etc/named.conf contains the line
|
# dns is configured when /etc/named.conf contains the line
|
||||||
# dyndb "ipa" "/usr/lib64/bind/ldap.so" {
|
# dyndb "ipa" "/usr/lib64/bind/ldap.so" {
|
||||||
bind_conf_section = re.compile('^\s*dyndb\s+"ipa"\s+"[^"]+"\s+{$')
|
bind_conf_section = re.compile(r'^\s*dyndb\s+"ipa"\s+"[^"]+"\s+{$')
|
||||||
|
|
||||||
try:
|
try:
|
||||||
with open(NAMED_CONF) as f:
|
with open(NAMED_CONF) as f:
|
||||||
|
|||||||
@@ -288,7 +288,6 @@ def main():
|
|||||||
supports_check_mode=True,
|
supports_check_mode=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
principal = module.params.get('principal', 'admin')
|
|
||||||
ccache = module.params.get('ccache')
|
ccache = module.params.get('ccache')
|
||||||
fqdn = unicode(module.params.get('fqdn'))
|
fqdn = unicode(module.params.get('fqdn'))
|
||||||
state = module.params.get('state')
|
state = module.params.get('state')
|
||||||
|
|||||||
@@ -2,9 +2,13 @@
|
|||||||
|
|
||||||
# Test ipaerver python3 binding
|
# Test ipaerver python3 binding
|
||||||
try:
|
try:
|
||||||
from ipaserver.install.server.replicainstall import install_check
|
from ipaserver.install.server.replicainstall import ( # noqa: F401
|
||||||
|
install_check,
|
||||||
|
)
|
||||||
except ImportError:
|
except ImportError:
|
||||||
from ipaserver.install.server.replicainstall import promote_check
|
from ipaserver.install.server.replicainstall import ( # noqa: F401
|
||||||
|
promote_check,
|
||||||
|
)
|
||||||
|
|
||||||
# Check ipapython version to be >= 4.6
|
# Check ipapython version to be >= 4.6
|
||||||
from ipapython.version import NUM_VERSION, VERSION
|
from ipapython.version import NUM_VERSION, VERSION
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#!/usr/bin/python3
|
#!/usr/bin/python3
|
||||||
|
|
||||||
# Test ipaerver python3 binding
|
# Test ipaerver python3 binding
|
||||||
from ipaserver.install.server.install import install_check
|
from ipaserver.install.server.install import install_check # noqa: F401
|
||||||
|
|
||||||
# Check ipapython version to be >= 4.6
|
# Check ipapython version to be >= 4.6
|
||||||
from ipapython.version import NUM_VERSION, VERSION
|
from ipapython.version import NUM_VERSION, VERSION
|
||||||
|
|||||||
@@ -20,3 +20,9 @@ data_files =
|
|||||||
/usr/share/ansible/roles/ipaclient = roles/ipaclient/*
|
/usr/share/ansible/roles/ipaclient = roles/ipaclient/*
|
||||||
/usr/share/ansible/roles/ipaserver = roles/ipaserver/*
|
/usr/share/ansible/roles/ipaserver = roles/ipaserver/*
|
||||||
/usr/share/ansible/roles/ipareplica = roles/ipareplica/*
|
/usr/share/ansible/roles/ipareplica = roles/ipareplica/*
|
||||||
|
|
||||||
|
[flake8]
|
||||||
|
extend-ignore = E203
|
||||||
|
per-file-ignores =
|
||||||
|
plugins/*:E402
|
||||||
|
roles/*:E402
|
||||||
|
|||||||
Reference in New Issue
Block a user