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/24 11:40:47 UTC

[incubator-datalab] branch DATALAB-2091 updated: [DATALAB-2091]: removed temporary copy of mysql.sh file, added escape characters

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 589d06e  [DATALAB-2091]: removed temporary copy of  mysql.sh file, added escape characters
589d06e is described below

commit 589d06e5f767625411406e9d4eb44894da644da2
Author: leonidfrolov <fr...@gmail.com>
AuthorDate: Wed Feb 24 13:40:33 2021 +0200

    [DATALAB-2091]: removed temporary copy of  mysql.sh file, added escape characters
---
 .../src/ssn/scripts/configure_docker.py                 | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/infrastructure-provisioning/src/ssn/scripts/configure_docker.py b/infrastructure-provisioning/src/ssn/scripts/configure_docker.py
index 547337f..b9bb347 100644
--- a/infrastructure-provisioning/src/ssn/scripts/configure_docker.py
+++ b/infrastructure-provisioning/src/ssn/scripts/configure_docker.py
@@ -165,15 +165,14 @@ def configure_guacamole():
              " -d -p 8080:8080 guacamole/guacamole".format(mysql_pass))
         # create cronjob for run containers on reboot
         conn.sudo('mkdir /opt/datalab/cron')
-        conn.sudo('touch /tmp/mysql.sh')
-        conn.sudo('chmod 755 /tmp/mysql.sh')
-        conn.sudo('echo "docker start guacd" >> /tmp/mysql.sh')
-        conn.sudo('echo "docker start guac-mysql" >> /tmp/mysql.sh')
-        conn.sudo('echo "docker rm guacamole" >> /tmp/mysql.sh')
-        conn.sudo("""echo "docker run --name guacamole --restart unless-stopped --link guacd:guacd --link guac-mysql:mysql""" \
-             """ -e MYSQL_DATABASE='guacamole' -e MYSQL_USER='guacamole' -e MYSQL_PASSWORD='{}' -d""" \
-             """ -p 8080:8080 guacamole/guacamole" >> /tmp/mysql.sh""".format(mysql_pass))
-        conn.sudo('cp -p /tmp/mysql.sh /opt/datalab/cron/mysql.sh')
+        conn.sudo('touch /opt/datalab/cron/mysql.sh')
+        conn.sudo('chmod 755 /opt/datalab/cron/mysql.sh')
+        conn.sudo('bash -c "echo \"docker start guacd\" >> /opt/datalab/cron/mysql.sh"')
+        conn.sudo('bash -c "echo \"docker start guac-mysql\" >> /opt/datalab/cron/mysql.sh"')
+        conn.sudo('bash -c "echo \"docker rm guacamole\" >> /opt/datalab/cron/mysql.sh"')
+        conn.sudo('''bash -c "echo \\"docker run --name guacamole --restart unless-stopped --link guacd:guacd --link 
+        guac-mysql:mysql -e MYSQL_DATABASE='guacamole' -e MYSQL_USER='guacamole' -e MYSQL_PASSWORD='{}' -d -p 8080:8080 
+        guacamole/guacamole\\" >> /opt/datalab/cron/mysql.sh"'''.format(mysql_pass))
         conn.sudo('(crontab -l 2>/dev/null; echo "@reboot sh /opt/datalab/cron/mysql.sh") | crontab -')
         return True
     except Exception as err:


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