Sets correct permission for /etc/hosts

presently while genearting the hosts file and
replacing the original one , the file permission is
replaced  with no access for world and ownership
changes from root to centos.

Secondary nodes, in the cluster while trying to
resolve primary host address can't  read the host
name and ip from hosts file and fails to connect.

This fix restores the hosts file permission correctly

Change-Id: Ia9b7e609644c93d13108af88aa3dacf94fc19ceb
Task: #23261
Story: #2003139
(cherry picked from commit fee5d17988)
This commit is contained in:
bhujay 2018-07-29 12:42:25 +05:30 committed by Luigi Toscano
parent da199be1c1
commit ed03a8d540

View File

@ -171,8 +171,9 @@ class Engine(object):
r.write_file_to('etc-hosts', hosts_file)
r.write_file_to('etc-hostname', hostname)
r.execute_command('sudo hostname %s' % hostname)
r.execute_command('sudo mv etc-hosts /etc/hosts')
r.execute_command('sudo mv etc-hostname /etc/hostname')
r.execute_command('sudo cp etc-hosts /etc/hosts')
r.execute_command('sudo cp etc-hostname /etc/hostname')
r.execute_command('sudo rm etc-hosts etc-hostname')
r.execute_command('sudo usermod -s /bin/bash $USER')
def _configure_instance_resolve_conf(self, instance):