From ab14ce4e37ae09ed0c08e4c69662d601d63cfdef Mon Sep 17 00:00:00 2001
From: Thomas Woerner <twoerner@redhat.com>
Date: Thu, 21 Jun 2018 12:00:24 +0200
Subject: [PATCH] ipaserver_setup_ds: Fix tasks.create_tmpfiles_dirs call
 (issue#19) (2nd try)

tasks.create_tmpfiles_dirs only needs IPAAPI_USER as an argument for
version 4.5.4. For 4.5 there is no support for arguments.

IPAAPI_USER is therefore only needed for 4.5.4 in
module_utils/ansible_ipa_server.py
---
 module_utils/ansible_ipa_server.py            | 2 +-
 roles/ipaserver/library/ipaserver_setup_ds.py | 6 ++++--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/module_utils/ansible_ipa_server.py b/module_utils/ansible_ipa_server.py
index 568291d2..8e8f9b5c 100644
--- a/module_utils/ansible_ipa_server.py
+++ b/module_utils/ansible_ipa_server.py
@@ -63,7 +63,7 @@ if NUM_VERSION >= 40500:
     from ipaplatform.tasks import tasks
     from ipalib import api, errors, x509
     from ipalib.constants import DOMAIN_LEVEL_0, MIN_DOMAIN_LEVEL, MAX_DOMAIN_LEVEL
-    if NUM_VERSION < 40600:
+    if NUM_VERSION == 40504:
         from ipalib.constants import IPAAPI_USER
     from ipalib.util import (
         validate_domain_name,
diff --git a/roles/ipaserver/library/ipaserver_setup_ds.py b/roles/ipaserver/library/ipaserver_setup_ds.py
index 5189c02c..062fd39c 100644
--- a/roles/ipaserver/library/ipaserver_setup_ds.py
+++ b/roles/ipaserver/library/ipaserver_setup_ds.py
@@ -124,8 +124,10 @@ def main():
 
     # setup DS ##############################################################
 
-    if NUM_VERSION < 40600:
-        # Make sure tmpfiles dir exist before installing components
+    # Make sure tmpfiles dir exist before installing components
+    if NUM_VERSION == 40504:
+        tasks.create_tmpfiles_dirs(IPAAPI_USER)
+    elif NUM_VERSION >= 40500 and NUM_VERSION <= 40503:
         tasks.create_tmpfiles_dirs()
 
     # Create a directory server instance
-- 
GitLab