From 5e40c707931948029d725df5469ffff108509c19 Mon Sep 17 00:00:00 2001 From: Jose Luis Franco Arza Date: Mon, 17 Feb 2020 14:50:00 +0100 Subject: [PATCH] Remove extra whitespaces from getent. The UndercloudHostsEntries heat parameter gets its value set from the execution of getent hosts .ctrlplane. However, the execution of getent return extra 4 whitespaces between the IP and the hostname: (undercloud) [stack@undercloud-0 ~]$ getent hosts undercloud-0.ctlplane 192.168.24.1 undercloud-0.ctlplane.redhat.local undercloud-0.ctlplane This four spaces enter in conflict with the entries at /etc/hosts if we want to use lineinfile to update the content. As it /ect/hosts already includes an entry for the undercloud-0.ctlplane (with a single space only) the Ansible module will consider that the line isn't present and we will end up with two entries for the undercloud-0.ctlplane. Also, the process.communicate() output return is in bytes, so in order to handle a string for the replacement this patch casts the output into string. Change-Id: Ibb51d5970f993b13a9684173704f64b98d81aae2 Related-Bug: #1863598 (cherry picked from commit 70d9d309cec524f94aa4843e57b513ff1ab7012e) --- tripleoclient/v1/overcloud_deploy.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tripleoclient/v1/overcloud_deploy.py b/tripleoclient/v1/overcloud_deploy.py index d272c8293..ad23f6d6d 100644 --- a/tripleoclient/v1/overcloud_deploy.py +++ b/tripleoclient/v1/overcloud_deploy.py @@ -128,7 +128,7 @@ class DeployOvercloud(command.Command): raise exceptions.DeploymentError('No entry for %s in /etc/hosts' % ctlplane_hostname) - return out.rstrip() + return re.sub(' +', ' ', str(out).rstrip()) def _create_breakpoint_cleanup_env(self, tht_root, container_name): bp_env = {}