This is an automated email from the ASF dual-hosted git repository.

ioleksandr pushed a commit to branch DLAB-3
in repository https://gitbox.apache.org/repos/asf/incubator-dlab.git


The following commit(s) were added to refs/heads/DLAB-3 by this push:
     new 2ce65bf  final fixes
2ce65bf is described below

commit 2ce65bf74c7d10e68e78e99c72eeabcaa09b0169
Author: Oleksandr_Isniuk <i.oleksa...@gmail.com>
AuthorDate: Tue May 14 14:54:47 2019 +0300

    final fixes
---
 .../src/ssn/scripts/configure_docker.py              | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/infrastructure-provisioning/src/ssn/scripts/configure_docker.py 
b/infrastructure-provisioning/src/ssn/scripts/configure_docker.py
index 1e06116..f83c481 100644
--- a/infrastructure-provisioning/src/ssn/scripts/configure_docker.py
+++ b/infrastructure-provisioning/src/ssn/scripts/configure_docker.py
@@ -118,10 +118,16 @@ def configure_guacamole():
              '-v /opt/mysql:/var/lib/mysql -e MYSQL_ROOT_PASSWORD={} -d 
mysql:latest'.format(mysql_pass))
         time.sleep(180)
         sudo('touch /opt/mysql/dock-query.sql')
-        sudo("""echo "CREATE DATABASE guacamole; CREATE USER 'guacamole' 
IDENTIFIED BY '{}'; GRANT SELECT,INSERT,UPDATE,DELETE ON guacamole.* TO 
'guacamole';" > /opt/mysql/dock-query.sql""".format(mysql_pass))
-        sudo('docker exec -i guac-mysql /bin/bash -c "mysql -u root -p{} < 
/var/lib/mysql/dock-query.sql"'.format(mysql_pass))
-        sudo('docker exec -i guac-mysql /bin/bash -c "cat 
/tmp/scripts/initdb.sql | mysql -u root -p{} guacamole"'.format(mysql_pass))
-        sudo("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='guacamole' -d -p 8080:8080 
guacamole/guacamole")
+        sudo("""echo "CREATE DATABASE guacamole; CREATE USER 'guacamole' 
IDENTIFIED BY '{}';"""\
+             """GRANT SELECT,INSERT,UPDATE,DELETE ON guacamole.* TO 
'guacamole';" > /opt/mysql/dock-query.sql"""\
+             .format(mysql_pass))
+        sudo('docker exec -i guac-mysql /bin/bash -c "mysql -u root -p{} < 
/var/lib/mysql/dock-query.sql"'\
+             .format(mysql_pass))
+        sudo('docker exec -i guac-mysql /bin/bash -c "cat 
/tmp/scripts/initdb.sql | mysql -u root -p{} guacamole"'\
+             .format(mysql_pass))
+        sudo("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='guacamole'"\ "" \
+             "-d -p 8080:8080 guacamole/guacamole")
         #create cronjob for run containers on reboot
         sudo('mkdir /opt/dlab/cron')
         sudo('touch /opt/dlab/cron/mysql.sh')
@@ -129,8 +135,10 @@ def configure_guacamole():
         sudo('echo "docker start guacd" >> /opt/dlab/cron/mysql.sh')
         sudo('echo "docker start guac-mysql" >> /opt/dlab/cron/mysql.sh')
         sudo('echo "docker rm guacamole" >> /opt/dlab/cron/mysql.sh')
-        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" >> /opt/dlab/cron/mysql.sh""".format(mysql_pass))
-        sudo('crontab -l | { cat; echo "@reboot sh /opt/dlab/cron/mysql.sh"; } 
| crontab -')
+        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" >> 
/opt/dlab/cron/mysql.sh""".format(mysql_pass))
+        sudo('(crontab -l 2>/dev/null; echo "@reboot sh 
/opt/dlab/cron/mysql.sh") | crontab -')
         return True
     except Exception as err:
         traceback.print_exc()


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@dlab.apache.org
For additional commands, e-mail: commits-h...@dlab.apache.org

Reply via email to