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/23 10:12:26 UTC

[incubator-datalab] branch DATALAB-2091 updated: [DATALAB-2091]: removed use_sudo from part of fabric put()

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 a2014cf  [DATALAB-2091]: removed use_sudo from part of fabric put()
a2014cf is described below

commit a2014cf3937d21195b7c61f93e042bb2e2c9fa6f
Author: leonidfrolov <fr...@gmail.com>
AuthorDate: Tue Feb 23 12:12:12 2021 +0200

    [DATALAB-2091]: removed use_sudo from part of fabric put()
---
 .../scripts/deploy_repository/deploy_repository.py           |  6 ++++--
 .../src/general/lib/os/debian/edge_lib.py                    |  3 ++-
 infrastructure-provisioning/src/general/lib/os/fab.py        | 12 ++++++++----
 .../src/general/lib/os/redhat/edge_lib.py                    |  3 ++-
 .../scripts/os/deeplearning_install_dataengine_kernels.py    |  4 ++--
 .../src/general/scripts/os/reconfigure_spark.py              |  2 +-
 .../scripts/os/tensor-rstudio_install_dataengine_kernels.py  |  4 +++-
 .../scripts/os/zeppelin_install_dataengine_kernels.py        |  3 ++-
 .../src/ssn/scripts/configure_ssn_node.py                    |  7 ++++---
 9 files changed, 28 insertions(+), 16 deletions(-)

diff --git a/infrastructure-provisioning/scripts/deploy_repository/deploy_repository.py b/infrastructure-provisioning/scripts/deploy_repository/deploy_repository.py
index 97cb864..40601ac 100644
--- a/infrastructure-provisioning/scripts/deploy_repository/deploy_repository.py
+++ b/infrastructure-provisioning/scripts/deploy_repository/deploy_repository.py
@@ -1017,8 +1017,10 @@ def install_nexus():
             conn.sudo('echo "admin:{}" > /opt/nexus/credentials'.format(args.nexus_admin_password))
             conn.sudo('echo "{0}:{1}" >> /opt/nexus/credentials'.format(args.nexus_service_user_name,
                                                                    args.nexus_service_user_password))
-            conn.put('templates/updateRepositories.groovy', '/opt/nexus/updateRepositories.groovy', use_sudo=True)
-            conn.put('scripts/update_amazon_repositories.py', '/opt/nexus/update_amazon_repositories.py', use_sudo=True)
+            conn.put('templates/updateRepositories.groovy', '/tmp/updateRepositories.groovy')
+            conn.sudo('cp /tmp/updateRepositories.groovy /opt/nexus/updateRepositories.groovy')
+            conn.put('scripts/update_amazon_repositories.py', '/tmp/update_amazon_repositories.py')
+            conn.sudo('cp /tmp/update_amazon_repositories.py /opt/nexus/update_amazon_repositories.py')
             conn.sudo('sed -i "s|NEXUS_PASSWORD|{}|g" /opt/nexus/update_amazon_repositories.py'.format(
                  args.nexus_admin_password))
             conn.sudo('touch /var/log/amazon_repo_update.log')
diff --git a/infrastructure-provisioning/src/general/lib/os/debian/edge_lib.py b/infrastructure-provisioning/src/general/lib/os/debian/edge_lib.py
index fa63547..17a2996 100644
--- a/infrastructure-provisioning/src/general/lib/os/debian/edge_lib.py
+++ b/infrastructure-provisioning/src/general/lib/os/debian/edge_lib.py
@@ -90,7 +90,8 @@ def install_nginx_lua(edge_ip, nginx_version, keycloak_auth_server_url, keycloak
                      '--token "{1}" --kty=RSA --size 2048 --provisioner {2} '.format(cn, token,
                                                                                      os.environ['conf_stepcerts_kid']))
                 datalab.fab.conn.sudo('touch /var/log/renew_certificates.log')
-                datalab.fab.conn.put('/root/templates/manage_step_certs.sh', '/usr/local/bin/manage_step_certs.sh', use_sudo=True)
+                datalab.fab.conn.put('/root/templates/manage_step_certs.sh', '/tmp/manage_step_certs.sh')
+                datalab.fab.conn.sudo('cp /tmp/manage_step_certs.sh /usr/local/bin/manage_step_certs.sh')
                 datalab.fab.conn.sudo('chmod +x /usr/local/bin/manage_step_certs.sh')
                 datalab.fab.conn.sudo('sed -i "s|STEP_ROOT_CERT_PATH|/etc/ssl/certs/root_ca.crt|g" '
                      '/usr/local/bin/manage_step_certs.sh')
diff --git a/infrastructure-provisioning/src/general/lib/os/fab.py b/infrastructure-provisioning/src/general/lib/os/fab.py
index aa35270..7544502 100644
--- a/infrastructure-provisioning/src/general/lib/os/fab.py
+++ b/infrastructure-provisioning/src/general/lib/os/fab.py
@@ -652,12 +652,16 @@ def install_inactivity_checker(os_user, ip_address, rstudio=False):
         try:
             if not exists(conn,'/opt/inactivity'):
                 conn.sudo('mkdir /opt/inactivity')
-            conn.put('/root/templates/inactive.service', '/etc/systemd/system/inactive.service', use_sudo=True)
-            conn.put('/root/templates/inactive.timer', '/etc/systemd/system/inactive.timer', use_sudo=True)
+            conn.put('/root/templates/inactive.service', '/tmp/inactive.service')
+            conn.sudo('cp /tmp/inactive.service /etc/systemd/system/inactive.service')
+            conn.put('/root/templates/inactive.timer', '/tmp/inactive.timer')
+            conn.sudo('cp /tmp/inactive.timer /etc/systemd/system/inactive.timer')
             if rstudio:
-                conn.put('/root/templates/inactive_rs.sh', '/opt/inactivity/inactive.sh', use_sudo=True)
+                conn.put('/root/templates/inactive_rs.sh', '/tmp/inactive.sh')
+                conn.sudo('cp /tmp/inactive.sh /opt/inactivity/inactive.sh')
             else:
-                conn.put('/root/templates/inactive.sh', '/opt/inactivity/inactive.sh', use_sudo=True)
+                conn.put('/root/templates/inactive.sh', '/tmp/inactive.sh')
+                conn.sudo('cp /tmp/inactive.sh /opt/inactivity/inactive.sh')
             conn.sudo("sed -i 's|IP_ADRESS|{}|g' /opt/inactivity/inactive.sh".format(ip_address))
             conn.sudo("chmod 755 /opt/inactivity/inactive.sh")
             conn.sudo("chown root:root /etc/systemd/system/inactive.service")
diff --git a/infrastructure-provisioning/src/general/lib/os/redhat/edge_lib.py b/infrastructure-provisioning/src/general/lib/os/redhat/edge_lib.py
index 26152d6..182146b 100644
--- a/infrastructure-provisioning/src/general/lib/os/redhat/edge_lib.py
+++ b/infrastructure-provisioning/src/general/lib/os/redhat/edge_lib.py
@@ -89,7 +89,8 @@ def install_nginx_lua(edge_ip, nginx_version, keycloak_auth_server_url, keycloak
                      '--token "{1}" --kty=RSA --size 2048 --provisioner {2} '.format(cn, token,
                                                                                      os.environ['conf_stepcerts_kid']))
                 conn.sudo('touch /var/log/renew_certificates.log')
-                conn.put('/root/templates/manage_step_certs.sh', '/usr/local/bin/manage_step_certs.sh', use_sudo=True)
+                conn.put('/root/templates/manage_step_certs.sh', '/tmp/manage_step_certs.sh')
+                conn.sudo('cp /tmp/manage_step_certs.sh /usr/local/bin/manage_step_certs.sh')
                 conn.sudo('chmod +x /usr/local/bin/manage_step_certs.sh')
                 conn.sudo('sed -i "s|STEP_ROOT_CERT_PATH|/etc/ssl/certs/root_ca.crt|g" '
                      '/usr/local/bin/manage_step_certs.sh')
diff --git a/infrastructure-provisioning/src/general/scripts/os/deeplearning_install_dataengine_kernels.py b/infrastructure-provisioning/src/general/scripts/os/deeplearning_install_dataengine_kernels.py
index 0fa513e..f1ae2f4 100644
--- a/infrastructure-provisioning/src/general/scripts/os/deeplearning_install_dataengine_kernels.py
+++ b/infrastructure-provisioning/src/general/scripts/os/deeplearning_install_dataengine_kernels.py
@@ -55,8 +55,8 @@ def configure_notebook(keyfile, hoststring):
     # spark_memory = get_spark_memory(True, args.os_user, spark_master_ip, keyfile)
     # conn.run('echo "spark.executor.memory {0}m" >> /tmp/{1}/notebook_spark-defaults_local.conf'.format(spark_memory, args.cluster_name))
     if not exists(conn,'/usr/local/bin/deeplearning_dataengine_create_configs.py'):
-        conn.put(scripts_dir + 'deeplearning_dataengine_create_configs.py',
-            '/usr/local/bin/deeplearning_dataengine_create_configs.py', use_sudo=True)
+        conn.put(scripts_dir + 'deeplearning_dataengine_create_configs.py', '/tmp/deeplearning_dataengine_create_configs.py')
+        conn.sudo('cp /tmp/deeplearning_dataengine_create_configs.py /usr/local/bin/deeplearning_dataengine_create_configs.py')
         conn.sudo('chmod 755 /usr/local/bin/deeplearning_dataengine_create_configs.py')
     if not exists(conn,'/usr/lib/python3.8/datalab/'):
         conn.sudo('mkdir -p /usr/lib/python3.8/datalab/')
diff --git a/infrastructure-provisioning/src/general/scripts/os/reconfigure_spark.py b/infrastructure-provisioning/src/general/scripts/os/reconfigure_spark.py
index 3b222ab..dfa2157 100644
--- a/infrastructure-provisioning/src/general/scripts/os/reconfigure_spark.py
+++ b/infrastructure-provisioning/src/general/scripts/os/reconfigure_spark.py
@@ -58,7 +58,7 @@ if __name__ == "__main__":
                  '/usr/local/bin/notebook_reconfigure_dataengine_spark.py')
         conn.sudo('mkdir -p /tmp/{}'.format(args.cluster_name))
         conn.put('{}notebook_spark-defaults_local.conf'.format(templates_dir),
-            '/tmp/{}/notebook_spark-defaults_local.conf'.format(args.cluster_name), use_sudo=True)
+            '/tmp/{}/notebook_spark-defaults_local.conf'.format(args.cluster_name))
         cluster_dir = '/opt/' + args.cluster_name + '/'
         if 'azure_datalake_enable' in os.environ:
             datalake_enabled = os.environ['azure_datalake_enable']
diff --git a/infrastructure-provisioning/src/general/scripts/os/tensor-rstudio_install_dataengine_kernels.py b/infrastructure-provisioning/src/general/scripts/os/tensor-rstudio_install_dataengine_kernels.py
index fa7a27b..5e6be28 100644
--- a/infrastructure-provisioning/src/general/scripts/os/tensor-rstudio_install_dataengine_kernels.py
+++ b/infrastructure-provisioning/src/general/scripts/os/tensor-rstudio_install_dataengine_kernels.py
@@ -53,7 +53,9 @@ def configure_notebook(keyfile, hoststring):
                                                                                                   args.cluster_name))
     if not exists(conn,'/usr/local/bin/tensor-rstudio_dataengine_create_configs.py'):
         conn.put(scripts_dir + 'tensor-rstudio_dataengine_create_configs.py',
-            '/usr/local/bin/tensor-rstudio_dataengine_create_configs.py', use_sudo=True)
+            '/tmp/tensor-rstudio_dataengine_create_configs.py')
+        conn.sudo('cp /tmp/tensor-rstudio_dataengine_create_configs.py '
+                  '/usr/local/bin/tensor-rstudio_dataengine_create_configs.py')
         conn.sudo('chmod 755 /usr/local/bin/tensor-rstudio_dataengine_create_configs.py')
     if not exists(conn,'/usr/lib/python3.8/datalab/'):
         conn.sudo('mkdir -p /usr/lib/python3.8/datalab/')
diff --git a/infrastructure-provisioning/src/general/scripts/os/zeppelin_install_dataengine_kernels.py b/infrastructure-provisioning/src/general/scripts/os/zeppelin_install_dataengine_kernels.py
index 5fe1aa5..16712c8 100644
--- a/infrastructure-provisioning/src/general/scripts/os/zeppelin_install_dataengine_kernels.py
+++ b/infrastructure-provisioning/src/general/scripts/os/zeppelin_install_dataengine_kernels.py
@@ -59,7 +59,8 @@ def configure_notebook(keyfile, hoststring):
                                                                                                   args.cluster_name))
     if not exists(conn,'/usr/local/bin/zeppelin_dataengine_create_configs.py'):
         conn.put(scripts_dir + 'zeppelin_dataengine_create_configs.py',
-            '/usr/local/bin/zeppelin_dataengine_create_configs.py', use_sudo=True)
+            '/tmp/zeppelin_dataengine_create_configs.py')
+        conn.sudo('cp /tmp/zeppelin_dataengine_create_configs.py /usr/local/bin/zeppelin_dataengine_create_configs.py')
         conn.sudo('chmod 755 /usr/local/bin/zeppelin_dataengine_create_configs.py')
     if not exists(conn,'/usr/lib/python3.8/datalab/'):
         conn.sudo('mkdir -p /usr/lib/python3.8/datalab/')
diff --git a/infrastructure-provisioning/src/ssn/scripts/configure_ssn_node.py b/infrastructure-provisioning/src/ssn/scripts/configure_ssn_node.py
index f04c3b5..707071b 100644
--- a/infrastructure-provisioning/src/ssn/scripts/configure_ssn_node.py
+++ b/infrastructure-provisioning/src/ssn/scripts/configure_ssn_node.py
@@ -165,7 +165,8 @@ def configure_ssl_certs(hostname, custom_ssl_cert):
                 conn.sudo('sed -i "s|JAVA_HOME|{0}|g" /usr/local/bin/renew_certificates.sh'.format(find_java_path_remote()))
                 conn.sudo('sed -i "s|RESOURCE_TYPE|ssn|g" /usr/local/bin/renew_certificates.sh')
                 conn.sudo('sed -i "s|CONF_FILE|ssn|g" /usr/local/bin/renew_certificates.sh')
-                conn.put('/root/templates/manage_step_certs.sh', '/usr/local/bin/manage_step_certs.sh', use_sudo=True)
+                conn.put('/root/templates/manage_step_certs.sh', '/tmp/manage_step_certs.sh')
+                conn.sudo('cp /tmp/manage_step_certs.sh /usr/local/bin/manage_step_certs.sh')
                 conn.sudo('chmod +x /usr/local/bin/manage_step_certs.sh')
                 conn.sudo('sed -i "s|STEP_ROOT_CERT_PATH|/etc/ssl/certs/root_ca.crt|g" '
                      '/usr/local/bin/manage_step_certs.sh')
@@ -182,8 +183,8 @@ def configure_ssl_certs(hostname, custom_ssl_cert):
                      '/usr/local/bin/manage_step_certs.sh'.format(args.os_user))
                 conn.sudo('bash -c \'echo "0 * * * * root /usr/local/bin/manage_step_certs.sh >> '
                      '/var/log/renew_certificates.log 2>&1" >> /etc/crontab \'')
-                conn.put('/root/templates/step-cert-manager.service', '/etc/systemd/system/step-cert-manager.service',
-                    use_sudo=True)
+                conn.put('/root/templates/step-cert-manager.service', '/tmp/step-cert-manager.service')
+                conn.sudo('cp /tmp/step-cert-manager.service /etc/systemd/system/step-cert-manager.service')
                 conn.sudo('systemctl daemon-reload')
                 conn.sudo('systemctl enable step-cert-manager.service')
             else:


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