You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dlab.apache.org by ad...@apache.org on 2019/09/04 12:00:29 UTC

[incubator-dlab] branch fix_repo updated: fix-repo

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

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


The following commit(s) were added to refs/heads/fix_repo by this push:
     new 0998498  fix-repo
0998498 is described below

commit 09984989815e54db36d882f2e2ebdb87cd8f355f
Author: AdamsDisturber <ad...@gmail.com>
AuthorDate: Wed Sep 4 15:00:14 2019 +0300

    fix-repo
---
 .../src/general/lib/os/debian/common_lib.py        | 37 +++++++++++++---------
 1 file changed, 22 insertions(+), 15 deletions(-)

diff --git a/infrastructure-provisioning/src/general/lib/os/debian/common_lib.py b/infrastructure-provisioning/src/general/lib/os/debian/common_lib.py
index 2cc64a8..d7c172d 100644
--- a/infrastructure-provisioning/src/general/lib/os/debian/common_lib.py
+++ b/infrastructure-provisioning/src/general/lib/os/debian/common_lib.py
@@ -25,27 +25,34 @@ from fabric.api import *
 from fabric.contrib.files import exists
 import sys
 import os
+import time
 
 
 def ensure_pkg(user, requisites='linux-headers-generic python-pip python-dev '
                                 'groff gcc vim less git wget sysv-rc-conf '
                                 'libssl-dev unattended-upgrades nmap '
                                 'libffi-dev unzip libxml2-dev haveged'):
-    try:
-        if not exists('/home/{}/.ensure_dir/pkg_upgraded'.format(user)):
-            print("Updating repositories "
-                  "and installing requested tools: {}".format(requisites))
-            sudo('apt-get update')
-            sudo('apt-get -y install ' + requisites)
-            sudo('unattended-upgrades -v')
-            sudo('export LC_ALL=C')
-            sudo('touch /home/{}/.ensure_dir/pkg_upgraded'.format(user))
-            sudo('systemctl enable haveged')
-            sudo('systemctl start haveged')
-            if os.environ['conf_cloud_provider'] == 'aws':
-                sudo('apt-get -y install --install-recommends linux-aws-hwe')
-    except:
-        sys.exit(1)
+    count = 0
+    check = False
+    while check == False and count <= 60:
+        try:
+            if not exists('/home/{}/.ensure_dir/pkg_upgraded'.format(user)):
+                print("Updating repositories "
+                      "and installing requested tools: {}".format(requisites))
+                print("Attempt number " + str(count) + " to install requested tools. Max 60 tries.")
+                sudo('apt-get update')
+                sudo('apt-get -y install ' + requisites)
+                sudo('unattended-upgrades -v')
+                sudo('export LC_ALL=C')
+                sudo('touch /home/{}/.ensure_dir/pkg_upgraded'.format(user))
+                sudo('systemctl enable haveged')
+                sudo('systemctl start haveged')
+                if os.environ['conf_cloud_provider'] == 'aws':
+                    sudo('apt-get -y install --install-recommends linux-aws-hwe')
+                check = True
+        except:
+            count += 1
+            time.sleep(50)
 
 
 def renew_gpg_key():


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