Merge "Fixed /etc/hosts update for external hdfs"

This commit is contained in:
Jenkins 2014-06-15 18:21:51 +00:00 committed by Gerrit Code Review
commit ed27404bd7

View File

@ -90,12 +90,13 @@ def configure_cluster_for_hdfs(cluster, data_source):
# Ip address hasn't been resolved, the last chance is for VM itself
return
create_etc_host = 'sudo "cat /tmp/etc-hosts-update '
create_etc_host += '/etc/hosts > /tmp/etc-hosts"'
copy_etc_host = 'sudo "cat /tmp/etc-hosts > /etc/hosts"'
update_etc_hosts_cmd = (
'cat /tmp/etc-hosts-update /etc/hosts | '
'sort | uniq > /tmp/etc-hosts && '
'cat /tmp/etc-hosts > /etc/hosts && '
'rm -f /tmp/etc-hosts /tmp/etc-hosts-update')
for inst in u.get_instances(cluster):
with inst.remote() as r:
r.write_file_to('/tmp/etc-hosts-update', etc_hosts_information)
r.execute_command(create_etc_host)
r.execute_command(copy_etc_host)
r.execute_command(update_etc_hosts_cmd, run_as_root=True)