You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dlab.apache.org by lf...@apache.org on 2020/05/25 11:47:21 UTC

[incubator-dlab] branch DLAB-1835 updated: [DLAB-1835]: fixed argument

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

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


The following commit(s) were added to refs/heads/DLAB-1835 by this push:
     new 00b0a2f  [DLAB-1835]: fixed argument
     new 3f41059  Merge branch 'DLAB-1835' of https://github.com/apache/incubator-dlab into DLAB-1835
00b0a2f is described below

commit 00b0a2fe7b862f2a3992874b719132eb8bfc27d3
Author: leonidfrolov <fr...@gmail.com>
AuthorDate: Mon May 25 14:46:05 2020 +0300

    [DLAB-1835]: fixed argument
---
 .../scripts/deploy_keycloak/deploy_keycloak.py      | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/infrastructure-provisioning/scripts/deploy_keycloak/deploy_keycloak.py b/infrastructure-provisioning/scripts/deploy_keycloak/deploy_keycloak.py
index dce8a86..9081062 100644
--- a/infrastructure-provisioning/scripts/deploy_keycloak/deploy_keycloak.py
+++ b/infrastructure-provisioning/scripts/deploy_keycloak/deploy_keycloak.py
@@ -43,6 +43,14 @@ external_port = "80"
 internal_port = "8080"
 private_ip_address = "127.0.0.1"
 
+def resolving_hosts(os_user):
+    if not exists('/home/{}/.hosts_resolved'.format(os_user)):
+        host = sudo('curl http://169.254.169.254/latest/meta-data/local-hostname').split('\n')[1]
+        host_short = host.split('.')[0]
+        private_ip = sudo('curl http://169.254.169.254/latest/meta-data/local-ipv4').split('\n')[1]
+        sudo('echo "{} {} {}" >> /etc/hosts'.format(private_ip, host, host_short))
+        sudo('touch /home/{}/.hosts_resolved'.format(os_user))
+
 def ensure_jre_jdk(os_user):
     if not exists('/home/' + os_user + '/.ensure_dir/jre_jdk_ensured'):
         try:
@@ -110,8 +118,19 @@ if __name__ == "__main__":
             print("Failed establish connection. Excpeption: " + str(err))
             sys.exit(1)
 
+    print("Resolving hosts")
+    try:
+        resolving_hosts(args.os_user)
+    except Exception as err:
+        print('Failed to resolve hosts', str(err))
+        sys.exit(1)
+
     print("Install Java")
-    ensure_jre_jdk(args.os_user)
+    try:
+        ensure_jre_jdk(args.os_user)
+    except Exception as err:
+        print('Failed to Install Java', str(err))
+        sys.exit(1)
 
     try:
         print("installing Keycloak")


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