URL: https://github.com/freeipa/freeipa/pull/164
Author: mirielka
 Title: #164: Trust AD cleanup
Action: synchronized

To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/164/head:pr164
git checkout pr164
From 3da23743777aece50c2dca3c4a29b1112a339b76 Mon Sep 17 00:00:00 2001
From: Lenka Doudova <ldoud...@redhat.com>
Date: Thu, 6 Oct 2016 07:44:47 +0200
Subject: [PATCH 1/3] Tests: Provide AD cleanup for trust tests

Providing cleanup of trust information from AD machines for trusts tests.

https://fedorahosted.org/freeipa/ticket/6396
---
 ipatests/test_integration/tasks.py      | 11 +++++++++++
 ipatests/test_integration/test_trust.py |  3 +++
 2 files changed, 14 insertions(+)

diff --git a/ipatests/test_integration/tasks.py b/ipatests/test_integration/tasks.py
index 6c26626..23ac426 100644
--- a/ipatests/test_integration/tasks.py
+++ b/ipatests/test_integration/tasks.py
@@ -517,6 +517,17 @@ def remove_trust_with_ad(master, ad_domain):
     range_name = ad_domain.upper() + '_id_range'
     master.run_command(['ipa', 'idrange-del', range_name])
 
+    remove_trust_info_from_ad(master, ad_domain)
+
+
+def remove_trust_info_from_ad(master, ad_domain):
+    # Remove record about trust from AD
+    master.run_command(['rpcclient', ad_domain,
+                        '-U\\Administrator%{}'.format(
+                            master.config.ad_admin_password),
+                        '-c', 'deletetrustdom {}'.format(master.domain.name)],
+                       raiseonerr=False)
+
 
 def configure_auth_to_local_rule(master, ad):
     """
diff --git a/ipatests/test_integration/test_trust.py b/ipatests/test_integration/test_trust.py
index 6b30338..27c0e56 100644
--- a/ipatests/test_integration/test_trust.py
+++ b/ipatests/test_integration/test_trust.py
@@ -35,6 +35,9 @@ class ADTrustBase(IntegrationTest):
 
     @classmethod
     def install(cls, mh):
+        if not cls.master.transport.file_exists('/usr/bin/rpcclient'):
+            raise nose.SkipTest("Package samba-client not available "
+                                "on {}".format(cls.master.hostname))
         super(ADTrustBase, cls).install(mh)
         cls.ad = cls.ad_domains[0].ads[0]
         cls.ad_domain = cls.ad.domain.name

From 663c6847fa864719d9f89c4b0603953f18539a12 Mon Sep 17 00:00:00 2001
From: Lenka Doudova <ldoud...@redhat.com>
Date: Fri, 14 Oct 2016 08:04:43 +0200
Subject: [PATCH 2/3] Tests: Provide AD cleanup for legacy client tests

Providing cleanup of trust information from AD machines for legacy client tests.

https://fedorahosted.org/freeipa/ticket/6396
---
 ipatests/test_integration/test_legacy_clients.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/ipatests/test_integration/test_legacy_clients.py b/ipatests/test_integration/test_legacy_clients.py
index 8380e50..33958a2 100644
--- a/ipatests/test_integration/test_legacy_clients.py
+++ b/ipatests/test_integration/test_legacy_clients.py
@@ -368,6 +368,10 @@ def uninstall(cls, mh):
         cls.master.run_command(['ipa', 'user-del', 'disabledipauser'],
                                 raiseonerr=False)
 
+        # Remove information about trust from AD, if domain was defined
+        if hasattr(cls, 'ad_domain'):
+            tasks.remove_trust_info_from_ad(cls.master, cls.ad_domain)
+
         # Also unapply fixes on the legacy client, if defined
         if hasattr(cls, 'legacy_client'):
             tasks.unapply_fixes(cls.legacy_client)

From bf61772e0814abe617d6ee6628f3296093180ba7 Mon Sep 17 00:00:00 2001
From: Lenka Doudova <ldoud...@redhat.com>
Date: Fri, 14 Oct 2016 10:06:27 +0200
Subject: [PATCH 3/3] Add file_exists method as a member of transport object

Method file_exists is reported by pylint as not being a member of transport
object, however it is used as such. Adding the method to object to avoid pylint
errors or unnecessary pylint disable.

https://fedorahosted.org/freeipa/ticket/6400
---
 pylint_plugins.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pylint_plugins.py b/pylint_plugins.py
index bf35773..fc2ce9b 100644
--- a/pylint_plugins.py
+++ b/pylint_plugins.py
@@ -237,7 +237,7 @@ def fake_class(name_or_class_obj, members=()):
                 'stderr_text',
                 'returncode',
             ]},
-            {'transport': ['put_file']},
+            {'transport': ['put_file', 'file_exists']},
             'put_file_contents',
             'get_file_contents',
             'ldap_connect',
-- 
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code

Reply via email to