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/03/16 14:56:34 UTC
[incubator-datalab] 02/02: [DATALAB-2091]: added wrap into bash -c
for chpasswd
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 0937dd3f122bf9d7da16bb4cdbd39017407bcbcb
Author: leonidfrolov <fr...@gmail.com>
AuthorDate: Tue Mar 16 16:55:54 2021 +0200
[DATALAB-2091]: added wrap into bash -c for chpasswd
---
infrastructure-provisioning/src/general/lib/os/debian/notebook_lib.py | 4 ++--
infrastructure-provisioning/src/general/lib/os/redhat/notebook_lib.py | 4 ++--
.../src/general/scripts/azure/rstudio_change_pass.py | 2 +-
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/infrastructure-provisioning/src/general/lib/os/debian/notebook_lib.py b/infrastructure-provisioning/src/general/lib/os/debian/notebook_lib.py
index 1c3db55..ad44574 100644
--- a/infrastructure-provisioning/src/general/lib/os/debian/notebook_lib.py
+++ b/infrastructure-provisioning/src/general/lib/os/debian/notebook_lib.py
@@ -154,7 +154,7 @@ def install_rstudio(os_user, local_spark_path, rstudio_pass, rstudio_version):
datalab.fab.conn.sudo('''echo 'Sys.setenv(http_proxy = \"{}\")' >> /home/{}/.Rprofile'''.format(http_proxy, os_user))
datalab.fab.conn.sudo('''echo 'Sys.setenv(https_proxy = \"{}\")' >> /home/{}/.Rprofile'''.format(https_proxy, os_user))
datalab.fab.conn.sudo('rstudio-server start')
- datalab.fab.conn.sudo('echo "{0}:{1}" | chpasswd'.format(os_user, rstudio_pass))
+ datalab.fab.conn.sudo('''bash -c 'echo "{0}:{1}" | chpasswd' '''.format(os_user, rstudio_pass))
#sudo("sed -i '/exit 0/d' /etc/rc.local")
#sudo('''bash -c "echo \'sed -i 's/^#SPARK_HOME/SPARK_HOME/' /home/{}/.Renviron\' >> /etc/rc.local"'''.format(os_user))
#sudo("bash -c 'echo exit 0 >> /etc/rc.local'")
@@ -163,7 +163,7 @@ def install_rstudio(os_user, local_spark_path, rstudio_pass, rstudio_version):
sys.exit(1)
else:
try:
- datalab.fab.conn.sudo('echo "{0}:{1}" | chpasswd'.format(os_user, rstudio_pass))
+ datalab.fab.conn.sudo('''bash -c 'echo "{0}:{1}" | chpasswd' '''.format(os_user, rstudio_pass))
except:
sys.exit(1)
diff --git a/infrastructure-provisioning/src/general/lib/os/redhat/notebook_lib.py b/infrastructure-provisioning/src/general/lib/os/redhat/notebook_lib.py
index 2855ad8..ec49559 100644
--- a/infrastructure-provisioning/src/general/lib/os/redhat/notebook_lib.py
+++ b/infrastructure-provisioning/src/general/lib/os/redhat/notebook_lib.py
@@ -125,7 +125,7 @@ def install_rstudio(os_user, local_spark_path, rstudio_pass, rstudio_version):
conn.sudo('''echo 'Sys.setenv(http_proxy = \"{}\")' >> /home/{}/.Rprofile'''.format(http_proxy, os_user))
conn.sudo('''echo 'Sys.setenv(https_proxy = \"{}\")' >> /home/{}/.Rprofile'''.format(https_proxy, os_user))
conn.sudo('rstudio-server start')
- conn.sudo('echo "{0}:{1}" | chpasswd'.format(os_user, rstudio_pass))
+ conn.sudo('''bash -c 'echo "{0}:{1}" | chpasswd' '''.format(os_user, rstudio_pass))
conn.sudo("sed -i '/exit 0/d' /etc/rc.local")
conn.sudo('''bash -c "echo \'sed -i 's/^#SPARK_HOME/SPARK_HOME/' /home/{}/.Renviron\' >> /etc/rc.local"'''.format(os_user))
conn.sudo("bash -c 'echo exit 0 >> /etc/rc.local'")
@@ -134,7 +134,7 @@ def install_rstudio(os_user, local_spark_path, rstudio_pass, rstudio_version):
sys.exit(1)
else:
try:
- conn.sudo('echo "{0}:{1}" | chpasswd'.format(os_user, rstudio_pass))
+ conn.sudo('''bash -c 'echo "{0}:{1}" | chpasswd' '''.format(os_user, rstudio_pass))
except:
sys.exit(1)
diff --git a/infrastructure-provisioning/src/general/scripts/azure/rstudio_change_pass.py b/infrastructure-provisioning/src/general/scripts/azure/rstudio_change_pass.py
index 0886421..57a3aa5 100644
--- a/infrastructure-provisioning/src/general/scripts/azure/rstudio_change_pass.py
+++ b/infrastructure-provisioning/src/general/scripts/azure/rstudio_change_pass.py
@@ -40,7 +40,7 @@ if __name__ == "__main__":
print("Setting password for Rstudio user.")
try:
- conn.sudo('echo "{0}:{1}" | chpasswd'.format(args.os_user, args.rstudio_pass))
+ conn.sudo('''bash -c 'echo "{0}:{1}" | chpasswd' '''.format(args.os_user, args.rstudio_pass))
conn.close()
except Exception as err:
print('Error: {0}'.format(err))
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datalab.apache.org
For additional commands, e-mail: commits-help@datalab.apache.org