URL: https://github.com/freeipa/freeipa/pull/2583
Author: tiran
 Title: #2583: [Backport][ipa-4-7] PR-CI: Restart rpcbind when it blocks kadmin 
port
Action: opened

PR body:
"""
This PR was opened automatically because PR #2581 was pushed to master and 
backport to ipa-4-7 is required.
"""

To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/2583/head:pr2583
git checkout pr2583
From c92928ee3964139167e3153cfac84f41e7ebcf56 Mon Sep 17 00:00:00 2001
From: Christian Heimes <chei...@redhat.com>
Date: Mon, 19 Nov 2018 14:54:04 +0100
Subject: [PATCH] PR-CI: Restart rpcbind when it blocks kadmin port

Every now and then, a PR-CI job fails because rpcbind blocks the kadmin
port 749/UDP and kadmin.service fails to start. When NFS secure port is
configured, rpcbind reserves a random low port.

A new workaround detects the blocked port and restarts rpcbind.service.

See: https://pagure.io/freeipa/issue/7769
Signed-off-by: Christian Heimes <chei...@redhat.com>
---
 ipatests/pytest_ipa/integration/tasks.py | 25 ++++++++++++++++++++----
 1 file changed, 21 insertions(+), 4 deletions(-)

diff --git a/ipatests/pytest_ipa/integration/tasks.py b/ipatests/pytest_ipa/integration/tasks.py
index a3acb71922..c94e07ebcc 100644
--- a/ipatests/pytest_ipa/integration/tasks.py
+++ b/ipatests/pytest_ipa/integration/tasks.py
@@ -160,15 +160,32 @@ def prepare_host(host):
         host.put_file_contents(env_filename, env_to_script(host.to_env()))
 
 
-def allow_sync_ptr(host):
-    kinit_admin(host)
-    host.run_command(["ipa", "dnsconfig-mod", "--allow-sync-ptr=true"],
-                     raiseonerr=False)
+def rpcbind_kadmin_workaround(host):
+    """Restart rpcbind in case it blocks 749/UDP
+
+    See https://pagure.io/freeipa/issue/7769
+    See https://bugzilla.redhat.com/show_bug.cgi?id=1592883
+    """
+    for _i in range(5):
+        result = host.run_command(['ss', '-ulnp', 'sport', '=', '749'])
+        if 'rpcbind' in result.stdout_text:
+            logger.error("rpcbind blocks 749/UDP, restarting service")
+            host.run_command(['systemctl', 'restart', 'rpcbind.service'])
+            time.sleep(2)
+        else:
+            break
 
 
 def apply_common_fixes(host):
     prepare_host(host)
     fix_hostname(host)
+    rpcbind_kadmin_workaround(host)
+
+
+def allow_sync_ptr(host):
+    kinit_admin(host)
+    host.run_command(["ipa", "dnsconfig-mod", "--allow-sync-ptr=true"],
+                     raiseonerr=False)
 
 
 def backup_file(host, filename):
_______________________________________________
FreeIPA-devel mailing list -- freeipa-devel@lists.fedorahosted.org
To unsubscribe send an email to freeipa-devel-le...@lists.fedorahosted.org
Fedora Code of Conduct: https://getfedora.org/code-of-conduct.html
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedorahosted.org/archives/list/freeipa-devel@lists.fedorahosted.org

Reply via email to