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/04/14 12:50:02 UTC

[incubator-datalab] 01/02: [DATALAB-2361]: added retries for luarocks install

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

lfrolov pushed a commit to branch DATALAB-2361
in repository https://gitbox.apache.org/repos/asf/incubator-datalab.git

commit b2c7b29dad964434eed4f0ce4030f85e5d03ff66
Author: leonidfrolov <fr...@gmail.com>
AuthorDate: Wed Apr 14 15:48:43 2021 +0300

    [DATALAB-2361]: added retries for luarocks install
---
 .../src/general/lib/os/debian/edge_lib.py          | 32 +++++++++++++++++++---
 1 file changed, 28 insertions(+), 4 deletions(-)

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 d00454a..2a4cb9f 100644
--- a/infrastructure-provisioning/src/general/lib/os/debian/edge_lib.py
+++ b/infrastructure-provisioning/src/general/lib/os/debian/edge_lib.py
@@ -128,11 +128,35 @@ def install_nginx_lua(edge_ip, nginx_version, keycloak_auth_server_url, keycloak
             with cd('/tmp/src/luarocks-3.3.1/'):
                 sudo('./configure')
                 sudo('make install')
-                sudo('luarocks install lua-resty-jwt 0.2.2 --tree /usr/local/openresty/lualib/resty/')
-                sudo('luarocks install lua-resty-openidc --tree /usr/local/openresty/lualib/resty/')
+                try:
+                    allow = False
+                    counter = 0
+                    while not allow:
+                        if counter > 5:
+                            sys.exit(1)
+                        else:
+                            if 'Could not fetch' in sudo('luarocks install lua-resty-jwt 0.2.2 --tree /usr/local/openresty/lualib/resty/ 2>&1') or 'Could not fetch' in sudo('luarocks install lua-resty-openidc --tree /usr/local/openresty/lualib/resty/ 2>&1'):
+                                counter += 1
+                                time.sleep(10)
+                            else:
+                                allow = True
+                except:
+                    sys.exit(1)
 
-            sudo('luarocks install lua-resty-jwt 0.2.2')
-            sudo('luarocks install lua-resty-openidc')
+            try:
+                allow = False
+                counter = 0
+                while not allow:
+                    if counter > 5:
+                        sys.exit(1)
+                    else:
+                        if 'Could not fetch' in sudo('luarocks install lua-resty-jwt 0.2.2 2>&1') or 'Could not fetch' in sudo('luarocks install lua-resty-openidc 2>&1'):
+                            counter += 1
+                            time.sleep(10)
+                        else:
+                            allow = True
+            except:
+                sys.exit(1)
 
             sudo('useradd -r nginx')
 

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