ipaclient_setup_nss: Use proper nosssd_files list

ipaclient_setup_nss is using the nosssd_files dict if sssd is disabled
with no_sssd.

The nosssd_files dict is generated in ipaclient_test and used in
ipaclient_setup_nss. So far ipaclient_setup_nss was using nosssd_files
from ipaclient installer, which was always None.
This commit is contained in:
Thomas Woerner
2021-09-23 13:11:53 +02:00
parent ccb07cbef5
commit 60ff782a7e
4 changed files with 34 additions and 13 deletions

View File

@@ -111,6 +111,11 @@ options:
no_dns_sshfp:
description: Do not automatically create DNS SSHFP records
required: yes
nosssd_files:
description: >
The dist of nss_ldap or nss-pam-ldapd files if sssd is disabled
required: yes
type: dict
author:
- Thomas Woerner
'''
@@ -143,7 +148,7 @@ from ansible.module_utils.ansible_ipa_client import (
get_certs_from_ldap, DN, certstore, x509, logger, certdb,
CalledProcessError, tasks, client_dns, configure_certmonger, services,
update_ssh_keys, save_state, configure_ldap_conf, configure_nslcd_conf,
nosssd_files, configure_openldap_conf, hardcode_ldap_server
configure_openldap_conf, hardcode_ldap_server
)
@@ -174,6 +179,7 @@ def main():
permit=dict(required=False, type='bool'),
no_krb5_offline_passwords=dict(required=False, type='bool'),
no_dns_sshfp=dict(required=False, type='bool', default=False),
nosssd_files=dict(required=True, type='dict'),
),
supports_check_mode=True,
)
@@ -221,7 +227,9 @@ def main():
options.no_sssd = False
options.sssd = not options.no_sssd
options.no_ac = False
nosssd_files = module.params.get('nosssd_files')
# pylint: disable=invalid-name
CCACHE_FILE = paths.IPA_DNS_CCACHE
api.bootstrap(context='cli_installer',
@@ -311,6 +319,7 @@ def main():
except Exception:
pass
# pylint: disable=deprecated-method
argspec_save_state = inspect.getargspec(save_state)
# Name Server Caching Daemon. Disable for SSSD, use otherwise
@@ -374,6 +383,7 @@ def main():
if not options.no_ac:
# Modify nsswitch/pam stack
# pylint: disable=deprecated-method
argspec = inspect.getargspec(tasks.modify_nsswitch_pam_stack)
if "sudo" in argspec.args:
tasks.modify_nsswitch_pam_stack(

View File

@@ -186,6 +186,10 @@ ipa_python_version:
returned: always
type: int
sample: 040400
nosssd_files:
description: >
The dist of nss_ldap or nss-pam-ldapd files if sssd is disabled
type: list
'''
import os
@@ -248,7 +252,7 @@ def get_ipa_conf():
"""
parser = RawConfigParser()
parser.read(paths.IPA_DEFAULT_CONF)
result = dict()
result = {}
for item in ['basedn', 'realm', 'domain', 'server', 'host', 'xmlrpc_uri']:
if parser.has_option('global', item):
value = parser.get('global', item)
@@ -336,6 +340,7 @@ def main():
validate_domain_name(options.domain_name)
if options.realm_name:
# pylint: disable=deprecated-method
argspec = inspect.getargspec(validate_domain_name)
if "entity" in argspec.args:
# NUM_VERSION >= 40690:
@@ -457,7 +462,7 @@ def main():
# global variables
hostname = None
hostname_source = None
nosssd_files = None
nosssd_files = {}
dnsok = False
cli_domain = None
cli_server = None
@@ -573,7 +578,6 @@ 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 "
@@ -617,6 +621,7 @@ def main():
rval=CLIENT_INSTALL_ERROR)
# Create the discovery instance
# pylint: disable=invalid-name
ds = ipadiscovery.IPADiscovery()
ret = ds.search(
@@ -926,7 +931,8 @@ def main():
ntp_servers=options.ntp_servers,
ntp_pool=options.ntp_pool,
client_already_configured=client_already_configured,
ipa_python_version=IPA_PYTHON_VERSION)
ipa_python_version=IPA_PYTHON_VERSION,
nosssd_files=nosssd_files)
if __name__ == '__main__':