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 <yi.c.wang@intel.com>
This commit is contained in:
Yi Wang 2019-02-20 14:49:01 +08:00
parent 506ef3fd7f
commit ab3f2385e8
1 changed files with 2 additions and 2 deletions

View File

@ -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