From ab3f2385e84cf015760d34317a6085008563901c Mon Sep 17 00:00:00 2001 From: Yi Wang Date: Wed, 20 Feb 2019 14:49:01 +0800 Subject: [PATCH] fix a devstack plugin bug devstack default user stack may not have permission to modify system file /etc/hosts. use sudo to make sure the modification is done. Change-Id: Iabe47cae88da9d70a1f7788c1847d99856963713 Closes-Bug: 1816520 Signed-off-by: Yi Wang --- devstack/lib/stx-metal | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/devstack/lib/stx-metal b/devstack/lib/stx-metal index f140acac..31b02487 100644 --- a/devstack/lib/stx-metal +++ b/devstack/lib/stx-metal @@ -463,11 +463,11 @@ function configure_maintenance { # TODO: enable controllerconfig to do this # add floating ip hostname in hosts if ! cat /etc/hosts | grep controller$ > /dev/null; then - sudo echo "192.168.204.2 controller" >> /etc/hosts + echo "192.168.204.2 controller" | sudo tee -a /etc/hosts fi # add controller-0 if ! cat /etc/hosts | grep [0-9]$'\s'controller-0$ > /dev/null; then - sudo echo "192.168.204.3 controller-0" >> /etc/hosts + echo "192.168.204.3 controller-0" | sudo tee -a /etc/hosts fi # puppet configuration for mtce