From 9beb31bf5ca5d6039f1ec0b439ca9a128311b69f Mon Sep 17 00:00:00 2001
From: Thomas Woerner <twoerner@redhat.com>
Date: Fri, 9 Feb 2018 16:38:15 +0100
Subject: [PATCH] Client: Added version checks for save_state and
 configure_nisdomain calls

With FreeIPA 4.5 the functions save_state and configure_nisdomain have gotten
new options. A version check has been added to ipaextras and ipanss to make
sure that the modules are also working with FreeIPA 4.4.
---
 library/ipaextras.py |  7 +++++--
 library/ipanss.py    | 10 ++++++++--
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/library/ipaextras.py b/library/ipaextras.py
index b6792949..5b315312 100644
--- a/library/ipaextras.py
+++ b/library/ipaextras.py
@@ -191,8 +191,11 @@ def main():
         configure_firefox(options, statestore, domain)
 
     if not no_nisdomain:
-        configure_nisdomain(
-            options=options, domain=domain, statestore=statestore)
+        if NUM_VERSION < 40500:
+            configure_nisdomain(options=options, domain=domain)
+        else:
+            configure_nisdomain(options=options, domain=domain,
+                                statestore=statestore)
 
     # Cleanup: Remove CCACHE_FILE
     try:
diff --git a/library/ipanss.py b/library/ipanss.py
index 31fdf80e..09b37fe5 100644
--- a/library/ipanss.py
+++ b/library/ipanss.py
@@ -215,7 +215,10 @@ def main():
     # (if installed)
     nscd = services.knownservices.nscd
     if nscd.is_installed():
-        save_state(nscd, statestore)
+        if NUM_VERSION < 40500:
+            save_state(nscd)
+        else:
+            save_state(nscd, statestore)
 
         try:
             nscd_service_action = 'stop'
@@ -232,7 +235,10 @@ def main():
 
     nslcd = services.knownservices.nslcd
     if nslcd.is_installed():
-        save_state(nslcd, statestore)
+        if NUM_VERSION < 40500:
+            save_state(nslcd)
+        else:
+            save_state(nslcd, statestore)
 
     ##########################################################################
 
-- 
GitLab