From 9c20641f5c8e9d4f813d0ba3e80b7ccc9df0ed15 Mon Sep 17 00:00:00 2001 From: Rafael Guterres Jeffman Date: Wed, 18 Sep 2019 11:06:23 -0300 Subject: [PATCH] =?UTF-8?q?Re-add=20function=20fa=C3=A7ades=20removed=20by?= =?UTF-8?q?=20commit=202da9088.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ansible-freeipa breaks if this functions do not exist, so they will be added back and marked as deprecated. Related Tickets: https://pagure.io/freeipa/issue/8062 Signed-off-by: Rafael Guterres Jeffman Reviewed-By: Rob Crittenden --- ipaclient/install/client.py | 31 +++++++++++++++++++++++ ipaclient/install/ipa_client_automount.py | 16 ++++++++++++ 2 files changed, 47 insertions(+) diff --git a/ipaclient/install/client.py b/ipaclient/install/client.py index 37f31c8aa..e2e2e8f5b 100644 --- a/ipaclient/install/client.py +++ b/ipaclient/install/client.py @@ -28,6 +28,7 @@ import sys import tempfile import time import traceback +import warnings from configparser import RawConfigParser from urllib.parse import urlparse, urlunparse @@ -281,6 +282,36 @@ def is_ipa_client_installed(fstore, on_master=False): return installed +def configure_nsswitch_database(fstore, database, services, preserve=True, + append=True, default_value=()): + """ + This function was deprecated. Use ipaplatform.tasks. + + Edits the specified nsswitch.conf database (e.g. passwd, group, sudoers) + to use the specified service(s). + + Arguments: + fstore - FileStore to backup the nsswitch.conf + database - database configuration that should be ammended, + e.g. 'sudoers' + service - list of services that should be added, e.g. ['sss'] + preserve - if True, the already configured services will be preserved + + The next arguments modify the behaviour if preserve=True: + append - if True, the services will be appended, if False, prepended + default_value - list of services that are considered as default (if + the database is not mentioned in nsswitch.conf), e.g. + ['files'] + """ + warnings.warn( + "Use ipaplatform.tasks.tasks.configure_nsswitch_database", + DeprecationWarning, + stacklevel=2 + ) + return tasks.configure_nsswitch_database(fstore, database, services, + preserve, append, default_value) + + def configure_ipa_conf( fstore, cli_basedn, cli_realm, cli_domain, cli_server, hostname): ipaconf = IPAChangeConf("IPA Installer") diff --git a/ipaclient/install/ipa_client_automount.py b/ipaclient/install/ipa_client_automount.py index 3a0896be3..14f0b75af 100644 --- a/ipaclient/install/ipa_client_automount.py +++ b/ipaclient/install/ipa_client_automount.py @@ -29,6 +29,7 @@ import shutil import time import tempfile import gssapi +import warnings try: from xml.etree import cElementTree as etree @@ -178,6 +179,21 @@ def configure_xml(fstore): print("Configured %s" % authconf) +def configure_nsswitch(statestore, options): + """ + This function was deprecated. Use ipaplatform.tasks. + + Point automount to ldap in nsswitch.conf. + This function is for non-SSSD setups only. + """ + warnings.warn( + "Use ipaplatform.tasks.tasks.enable_ldap_automount", + DeprecationWarning, + stacklevel=2 + ) + return tasks.enable_ldap_automount(statestore) + + def configure_autofs_sssd(fstore, statestore, autodiscover, options): try: sssdconfig = SSSDConfig.SSSDConfig()