summaryrefslogtreecommitdiffstats
path: root/roles/openshift_facts
diff options
context:
space:
mode:
authorSteve Milner <smilner@redhat.com>2017-01-10 14:52:59 -0500
committerSteve Milner <smilner@redhat.com>2017-01-10 15:03:37 -0500
commitcd933dd5488640ac1c05657e3fe6fe978377734c (patch)
tree8e0e72598ea0a650f0c6ab0664b8b3656e5ae528 /roles/openshift_facts
parent96fe76dad188610733c87cf80f4e22da34f11fb7 (diff)
downloadopenshift-cd933dd5488640ac1c05657e3fe6fe978377734c.tar.gz
openshift-cd933dd5488640ac1c05657e3fe6fe978377734c.tar.bz2
openshift-cd933dd5488640ac1c05657e3fe6fe978377734c.tar.xz
openshift-cd933dd5488640ac1c05657e3fe6fe978377734c.zip
Workaround for dnf+docker version race condition
In some versions of dnf the rpm database can require maintenance after usage. Unfortunately, this trips up get_version_output in the openshift_facts library as the maintenance may interrupt the STDOUT stream. This makes the resulting data returned from get_version_output malformed and unparsable. This change adds an rpm --rebuilddb command before requesting docker version output when the ansible package manager is dnf. This causes the STDOUT maintenance messages to no longer interrupt the expected yaml stream as well as releases locks in the rpm database.
Diffstat (limited to 'roles/openshift_facts')
-rwxr-xr-xroles/openshift_facts/library/openshift_facts.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/roles/openshift_facts/library/openshift_facts.py b/roles/openshift_facts/library/openshift_facts.py
index d7e3596fd..0222b664b 100755
--- a/roles/openshift_facts/library/openshift_facts.py
+++ b/roles/openshift_facts/library/openshift_facts.py
@@ -1256,6 +1256,13 @@ def is_service_running(service):
return service_running
+def rpm_rebuilddb():
+ """
+ Runs rpm --rebuilddb to ensure the db is in good shape.
+ """
+ module.run_command(['/usr/bin/rpm', '--rebuilddb']) # noqa: F405
+
+
def get_version_output(binary, version_cmd):
""" runs and returns the version output for a command """
cmd = []
@@ -1966,6 +1973,11 @@ class OpenShiftFacts(object):
if 'docker' in roles:
docker = dict(disable_push_dockerhub=False,
options='--log-driver=json-file --log-opt max-size=50m')
+ # NOTE: This is a workaround for a dnf output racecondition that can occur in
+ # some situations. See https://bugzilla.redhat.com/show_bug.cgi?id=918184
+ if self.system_facts['ansible_pkg_mgr'] == 'dnf':
+ rpm_rebuilddb()
+
version_info = get_docker_version_info()
if version_info is not None:
docker['api_version'] = version_info['api_version']