You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@datalab.apache.org by lf...@apache.org on 2021/02/17 11:51:40 UTC
[incubator-datalab] branch DATALAB-2091 updated: [DATALAB-2091]:
changed function placement
This is an automated email from the ASF dual-hosted git repository.
lfrolov pushed a commit to branch DATALAB-2091
in repository https://gitbox.apache.org/repos/asf/incubator-datalab.git
The following commit(s) were added to refs/heads/DATALAB-2091 by this push:
new 01c8676 [DATALAB-2091]: changed function placement
01c8676 is described below
commit 01c8676c9c3ac6b687b48342587ec42a34e743d0
Author: leonidfrolov <fr...@gmail.com>
AuthorDate: Wed Feb 17 13:51:27 2021 +0200
[DATALAB-2091]: changed function placement
---
.../src/base/scripts/install_prerequisites.py | 11 ++++++++++-
infrastructure-provisioning/src/general/lib/os/fab.py | 1 -
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/infrastructure-provisioning/src/base/scripts/install_prerequisites.py b/infrastructure-provisioning/src/base/scripts/install_prerequisites.py
index 6fbfe7a..3c1d4ae 100644
--- a/infrastructure-provisioning/src/base/scripts/install_prerequisites.py
+++ b/infrastructure-provisioning/src/base/scripts/install_prerequisites.py
@@ -50,6 +50,15 @@ def create_china_pip_conf_file(conn):
conn.sudo('echo "trusted-host = {}" >> /etc/pip.conf'.format(os.environ['conf_pypi_mirror']))
conn.sudo('touch /home/{}/pip_china_ensured'.format(args.user))
+def update_hosts_files(os_user):
+ try:
+ if not exists(conn,'/home/{}/.ensure_dir/hosts_file_updated'.format(os_user)):
+ conn.sudo('sed -i "s/^127.0.0.1 localhost/127.0.0.1 localhost localhost.localdomain/g" /etc/hosts')
+ conn.sudo('touch /home/{}/.ensure_dir/hosts_file_updated'.format(os_user))
+ except Exception as err:
+ traceback.print_exc()
+ print('Failed to update hosts file', str(err))
+ sys.exit(1)
if __name__ == "__main__":
print("Configure connections")
@@ -62,7 +71,7 @@ if __name__ == "__main__":
create_china_pip_conf_file()
print("Updating hosts file")
- update_hosts_file(args.user)
+ update_hosts_files(args.user)
print("Updating repositories and installing requested tools.")
ensure_pkg(args.user)
diff --git a/infrastructure-provisioning/src/general/lib/os/fab.py b/infrastructure-provisioning/src/general/lib/os/fab.py
index 90faf17..d14de45 100644
--- a/infrastructure-provisioning/src/general/lib/os/fab.py
+++ b/infrastructure-provisioning/src/general/lib/os/fab.py
@@ -913,7 +913,6 @@ def update_zeppelin_interpreters(multiple_clusters, r_enabled, interpreter_mode=
def update_hosts_file(os_user):
- global conn
try:
if not exists(conn,'/home/{}/.ensure_dir/hosts_file_updated'.format(os_user)):
conn.sudo('sed -i "s/^127.0.0.1 localhost/127.0.0.1 localhost localhost.localdomain/g" /etc/hosts')
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datalab.apache.org
For additional commands, e-mail: commits-help@datalab.apache.org