On 04/09/2014 01:33 PM, Petr Viktorin wrote:
> On 04/09/2014 12:07 PM, Tomas Babej wrote:
>> Hi,
>>
>> the following batch deals with the following:
>>
>> * cleans up apache's semaphores prior to installing IPA (CA install can
>> get stuck when IPA is reinstalled many times)
>
> What happens if Apache is running for some reason? Should we also stop
> it before deleting the semaphores?

Agreed, if for any reason apache is running, we should stop it
beforehand. Fixed.

>
>> * allows to pass extra arguments to install_client task
>
> Please avoid mutable argument defaults; use `extra_args=()` and then
> `list(extra_args)`

Fixed.

>
>> * uses trailing dot in the hostname as fqdn which should not be
>> overridden by domain name
>
> ACK.
>
>> * fixes incorrect assert for UIDs/GIDs in legacy client tests
>
> ACK, this fixes a lot of failures (though not all of them yet).
>

Updated patches attached.

-- 
Tomas Babej
Associate Software Engineer | Red Hat | Identity Management
RHCE | Brno Site | IRC: tbabej | freeipa.org 

>From b066d30c5d34665ecc308edf4d53b60d012a4d1a Mon Sep 17 00:00:00 2001
From: Tomas Babej <[email protected]>
Date: Mon, 7 Apr 2014 12:40:52 +0200
Subject: [PATCH] ipatests: Fix apache semaphores prior to installing IPA
 server

---
 ipatests/test_integration/tasks.py | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/ipatests/test_integration/tasks.py b/ipatests/test_integration/tasks.py
index d03ee6021fb34f8292814b23ea4e8fdd4606a90b..7f738e3d02fda6254502acb5eb3b3bbafdec3671 100644
--- a/ipatests/test_integration/tasks.py
+++ b/ipatests/test_integration/tasks.py
@@ -111,6 +111,18 @@ def fix_resolv_conf(host):
     host.put_file_contents('/etc/resolv.conf', contents)
 
 
+def fix_apache_semaphores(master):
+    systemd_available = master.transport.file_exists('/bin/systemctl')
+
+    if systemd_available:
+        master.run_command(['systemctl', 'stop', 'httpd'], raiseonerr=False)
+    else:
+        master.run_command(['/sbin/service', 'httpd', 'stop'], raiseonerr=False)
+
+    master.run_command('for line in `ipcs -s | grep apache | cut -d " " -f 2`; '
+                       'do ipcrm -s $line; done', raiseonerr=False)
+
+
 def unapply_fixes(host):
     restore_files(host)
     restore_hostname(host)
@@ -179,6 +191,7 @@ def install_master(host):
     host.collect_log('/var/log/dirsrv/slapd-%s/access' % inst)
 
     apply_common_fixes(host)
+    fix_apache_semaphores(host)
 
     host.run_command(['ipa-server-install', '-U',
                       '-r', host.domain.name,
@@ -197,6 +210,7 @@ def install_replica(master, replica, setup_ca=True):
     replica.collect_log('/var/log/ipareplica-conncheck.log')
 
     apply_common_fixes(replica)
+    fix_apache_semaphores(replica)
 
     master.run_command(['ipa-replica-prepare',
                         '-p', replica.config.dirman_password,
-- 
1.8.5.3

>From 45352650c97b182354c00837b3d7de4bf0e0ad1c Mon Sep 17 00:00:00 2001
From: Tomas Babej <[email protected]>
Date: Mon, 7 Apr 2014 13:36:10 +0200
Subject: [PATCH] ipatests: tasks: Accept extra arguments when installing
 client

---
 ipatests/test_integration/tasks.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/ipatests/test_integration/tasks.py b/ipatests/test_integration/tasks.py
index 7f738e3d02fda6254502acb5eb3b3bbafdec3671..2334e254e7ddd00beeb83d8a317b5db12c06a29e 100644
--- a/ipatests/test_integration/tasks.py
+++ b/ipatests/test_integration/tasks.py
@@ -236,7 +236,7 @@ def install_replica(master, replica, setup_ca=True):
     kinit_admin(replica)
 
 
-def install_client(master, client):
+def install_client(master, client, extra_args=()):
     client.collect_log('/var/log/ipaclient-install.log')
 
     apply_common_fixes(client)
@@ -246,7 +246,8 @@ def install_client(master, client):
                         '--realm', client.domain.realm,
                         '-p', client.config.admin_name,
                         '-w', client.config.admin_password,
-                        '--server', master.hostname])
+                        '--server', master.hostname]
+                        + list(extra_args))
 
     kinit_admin(client)
 
-- 
1.8.5.3

>From 3ffa1732b77484612282d8e1598317f172221ff1 Mon Sep 17 00:00:00 2001
From: Tomas Babej <[email protected]>
Date: Mon, 7 Apr 2014 21:37:09 +0200
Subject: [PATCH] ipatests: Allow using FQDN with trailing dot as final
 hostname

When creating a BaseHost instance, the machine's hostname was
reconfigured to have the same shortname prepended the domain name
of the domain where it was defined.

However, it makes sense in certain use cases to define hosts
that have hostnames other than belonging directly in the domain
they were defined in.

Treat input hostnames with trailing dots as static FQDNs that
will not be changed by the name of the domain they were defined in.
---
 ipatests/test_integration/host.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/ipatests/test_integration/host.py b/ipatests/test_integration/host.py
index a57e3763c53f5e2c7262e019259293d509624d02..94440c1875654a6866e25f173b27b9fedd5d5945 100644
--- a/ipatests/test_integration/host.py
+++ b/ipatests/test_integration/host.py
@@ -41,7 +41,11 @@ class BaseHost(object):
 
         shortname, dot, ext_domain = hostname.partition('.')
         self.shortname = shortname
-        self.hostname = str(shortname + '.' + self.domain.name)
+
+        self.hostname = (hostname[:-1]
+                         if hostname.endswith('.')
+                         else shortname + '.' + self.domain.name)
+
         self.external_hostname = str(external_hostname or hostname)
 
         self.netbios = self.domain.name.split('.')[0].upper()
-- 
1.8.5.3

>From d2d4a1a9819e8b68ba59344b5c86fa89f780ffb5 Mon Sep 17 00:00:00 2001
From: Tomas Babej <[email protected]>
Date: Tue, 8 Apr 2014 08:31:58 +0200
Subject: [PATCH] ipatests: Fix incorrect UID/GID reference for subdomain users
 and groups

In legacy client integration test, the test cases that query information
from subdomain about subdomain users and group expected subdomain
users and groups to have the UIDs/GIDs as users and groups in the root
domain.
---
 ipatests/test_integration/test_legacy_clients.py | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/ipatests/test_integration/test_legacy_clients.py b/ipatests/test_integration/test_legacy_clients.py
index 170b0e2b0eeec8e7a70d2f60ec36660db9b60441..71b266a946bd1113710f3e4da9b4dd79cd051624 100644
--- a/ipatests/test_integration/test_legacy_clients.py
+++ b/ipatests/test_integration/test_legacy_clients.py
@@ -268,7 +268,8 @@ class BaseTestLegacyClient(object):
         testgroup = 'subdomaintestgroup@%s' % self.ad_subdomain
         result = self.legacy_client.run_command(['getent', 'group', testgroup])
 
-        testgroup_stdout = "%s:\*:%s:" % (testgroup, self.testuser_gid_regex)
+        testgroup_stdout = "%s:\*:%s:" % (testgroup,
+                                          self.subdomain_testuser_gid_regex)
         assert re.search(testgroup_stdout, result.stdout_text)
 
     def test_id_subdomain_ad_user(self):
@@ -285,9 +286,12 @@ class BaseTestLegacyClient(object):
         # testgroup
         group_name = '\(%s\)' % testgroup if self.posix_trust else ''
 
-        uid_regex = "uid=%s\(%s\)" % (self.testuser_uid_regex, testuser)
-        gid_regex = "gid=%s%s" % (self.testuser_gid_regex, group_name)
-        groups_regex = "groups=%s%s" % (self.testuser_gid_regex, group_name)
+        uid_regex = "uid=%s\(%s\)" % (self.subdomain_testuser_uid_regex,
+                                      testuser)
+        gid_regex = "gid=%s%s" % (self.subdomain_testuser_gid_regex,
+                                  group_name)
+        groups_regex = "groups=%s%s" % (self.subdomain_testuser_gid_regex,
+                                        group_name)
 
         assert re.search(uid_regex, result.stdout_text)
         assert re.search(gid_regex, result.stdout_text)
-- 
1.8.5.3

_______________________________________________
Freeipa-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/freeipa-devel

Reply via email to