From fee5d179880c50de62bcd8bb32c833d8cdc9c419 Mon Sep 17 00:00:00 2001 From: bhujay Date: Sun, 29 Jul 2018 12:42:25 +0530 Subject: [PATCH] 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 --- sahara/service/engine.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sahara/service/engine.py b/sahara/service/engine.py index 27cc21c5de..265c15da55 100644 --- a/sahara/service/engine.py +++ b/sahara/service/engine.py @@ -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):