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:07:21 UTC

[incubator-datalab] 02/02: [DATALAB-2091]: changed how conn is defined

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

commit 2aaaf989fd121f59a8499224ba01916e56ba9ba0
Author: leonidfrolov <fr...@gmail.com>
AuthorDate: Wed Feb 17 13:07:03 2021 +0200

    [DATALAB-2091]: changed how conn is defined
---
 .../src/base/scripts/install_prerequisites.py                | 12 ++++++------
 .../src/general/lib/os/debian/common_lib.py                  |  6 +++---
 infrastructure-provisioning/src/general/lib/os/fab.py        |  2 +-
 .../src/general/lib/os/redhat/common_lib.py                  |  6 +++---
 4 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/infrastructure-provisioning/src/base/scripts/install_prerequisites.py b/infrastructure-provisioning/src/base/scripts/install_prerequisites.py
index 53ae682..dd14b22 100644
--- a/infrastructure-provisioning/src/base/scripts/install_prerequisites.py
+++ b/infrastructure-provisioning/src/base/scripts/install_prerequisites.py
@@ -58,19 +58,19 @@ if __name__ == "__main__":
     deeper_config = json.loads(args.additional_config)
 
     if args.region == 'cn-north-1':
-        change_pkg_repos(conn)
-        create_china_pip_conf_file(conn)
+        change_pkg_repos()
+        create_china_pip_conf_file()
 
     print("Updating hosts file")
-    update_hosts_file(args.user, conn)
+    update_hosts_file(args.user)
 
     print("Updating repositories and installing requested tools.")
-    ensure_pkg(args.user, conn)
+    ensure_pkg(args.user)
 
     print("Installing python packages: {}".format(args.pip_packages))
-    ensure_pip(args.pip_packages, conn)
+    ensure_pip(args.pip_packages)
 
     print("Installing NTPd")
-    ensure_ntpd(args.user, conn, args.edge_private_ip)
+    ensure_ntpd(args.user, args.edge_private_ip)
 
     datalab.fab.close_connection()
diff --git a/infrastructure-provisioning/src/general/lib/os/debian/common_lib.py b/infrastructure-provisioning/src/general/lib/os/debian/common_lib.py
index 6adb49d..4452617 100644
--- a/infrastructure-provisioning/src/general/lib/os/debian/common_lib.py
+++ b/infrastructure-provisioning/src/general/lib/os/debian/common_lib.py
@@ -96,7 +96,7 @@ def manage_pkg(command, environment, requisites):
     except:
         sys.exit(1)
 
-def ensure_pkg(user, conn, requisites='linux-headers-generic python3-pip python3-dev python3-virtualenv '
+def ensure_pkg(user, requisites='linux-headers-generic python3-pip python3-dev python3-virtualenv '
                                 'groff gcc vim less git wget '
                                 'libssl-dev unattended-upgrades nmap '
                                 'libffi-dev unzip libxml2-dev haveged'):
@@ -141,7 +141,7 @@ def renew_gpg_key():
         sys.exit(1)
 
 
-def change_pkg_repos(conn):
+def change_pkg_repos():
     if not exists(conn,'/tmp/pkg_china_ensured'):
         conn.put('/root/files/sources.list', '/tmp/sources.list')
         conn.sudo('mv /tmp/sources.list /etc/apt/sources.list')
@@ -159,7 +159,7 @@ def find_java_path_local():
     return java_path
 
 
-def ensure_ntpd(user, conn, edge_private_ip=''):
+def ensure_ntpd(user, edge_private_ip=''):
     try:
         if not exists(conn,'/home/{}/.ensure_dir/ntpd_ensured'.format(user)):
             conn.sudo('timedatectl set-ntp no')
diff --git a/infrastructure-provisioning/src/general/lib/os/fab.py b/infrastructure-provisioning/src/general/lib/os/fab.py
index a429ed0..42fc6e5 100644
--- a/infrastructure-provisioning/src/general/lib/os/fab.py
+++ b/infrastructure-provisioning/src/general/lib/os/fab.py
@@ -38,7 +38,7 @@ from fabric import *
 from patchwork.files import exists
 
 
-def ensure_pip(requisites, conn):
+def ensure_pip(requisites):
     try:
         if not exists(conn,'/home/{}/.ensure_dir/pip_path_added'.format(os.environ['conf_os_user'])):
             conn.sudo('echo PATH=$PATH:/usr/local/bin/:/opt/spark/bin/ >> /etc/profile')
diff --git a/infrastructure-provisioning/src/general/lib/os/redhat/common_lib.py b/infrastructure-provisioning/src/general/lib/os/redhat/common_lib.py
index ec33387..a9fd236 100644
--- a/infrastructure-provisioning/src/general/lib/os/redhat/common_lib.py
+++ b/infrastructure-provisioning/src/general/lib/os/redhat/common_lib.py
@@ -56,7 +56,7 @@ def manage_pkg(command, environment, requisites):
     except:
         sys.exit(1)
 
-def ensure_pkg(user, conn, requisites='git vim gcc python-devel openssl-devel nmap libffi libffi-devel unzip libxml2-devel'):
+def ensure_pkg(user, requisites='git vim gcc python-devel openssl-devel nmap libffi libffi-devel unzip libxml2-devel'):
     try:
         if not exists(conn,'/home/{}/.ensure_dir/pkg_upgraded'.format(user)):
             print("Updating repositories and installing requested tools: {}".format(requisites))
@@ -88,7 +88,7 @@ def ensure_pkg(user, conn, requisites='git vim gcc python-devel openssl-devel nm
         sys.exit(1)
 
 
-def change_pkg_repos(conn):
+def change_pkg_repos():
     if not exists(conn,'/tmp/pkg_china_ensured'):
         conn.put('/root/files/sources.list', '/tmp/sources.list')
         conn.sudo('mv /tmp/sources.list  /etc/yum.repos.d/CentOS-Base-aliyun.repo')
@@ -105,7 +105,7 @@ def find_java_path_local():
     return java_path
 
 
-def ensure_ntpd(user, conn, edge_private_ip=''):
+def ensure_ntpd(user, edge_private_ip=''):
     try:
         if not exists(conn,'/home/{}/.ensure_dir/ntpd_ensured'.format(user)):
             conn.sudo('systemctl disable chronyd')


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datalab.apache.org
For additional commands, e-mail: commits-help@datalab.apache.org