From ccdd43f0b5b2fbf5c7e1e767fe13575ff65c686d Mon Sep 17 00:00:00 2001
From: Thomas Woerner <twoerner@redhat.com>
Date: Fri, 13 Oct 2017 16:13:57 +0200
Subject: [PATCH] Extended python3 test to do an additional client test

The additional client test is needed to make sure that the client is
installed for python3 usage. The ipalib test has not been sufficient.
---
 roles/ipaclient/files/py3test.py          | 9 +++++++++
 roles/ipaclient/tasks/python_2_3_test.yml | 2 +-
 2 files changed, 10 insertions(+), 1 deletion(-)
 create mode 100644 roles/ipaclient/files/py3test.py

diff --git a/roles/ipaclient/files/py3test.py b/roles/ipaclient/files/py3test.py
new file mode 100644
index 00000000..d370b687
--- /dev/null
+++ b/roles/ipaclient/files/py3test.py
@@ -0,0 +1,9 @@
+#!/usr/bin/python3
+
+# Test ipaclient python3 binding
+from ipaclient.install.client import SECURE_PATH
+
+# Check ipapython version to be >= 4.6
+from ipapython.version import NUM_VERSION, VERSION
+if NUM_VERSION < 40600:
+    raise Exception("ipa %s not usable with python3" % VERSION)
diff --git a/roles/ipaclient/tasks/python_2_3_test.yml b/roles/ipaclient/tasks/python_2_3_test.yml
index 04270496..08af2649 100644
--- a/roles/ipaclient/tasks/python_2_3_test.yml
+++ b/roles/ipaclient/tasks/python_2_3_test.yml
@@ -1,6 +1,6 @@
 - block:
   - name: Verify Python3 import
-    command: python3 -c "from ipapython.version import NUM_VERSION"
+    script: py3test.py
     register: py3test
     failed_when: False
 
-- 
GitLab