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

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


The following commit(s) were added to refs/heads/DLAB-1748 by this push:
     new c2fe8f2  [DLAB-1748]: changed how list of available pip versions is 
returned
c2fe8f2 is described below

commit c2fe8f2e717c344845c99209a69e92604895da31
Author: leonidfrolov <frolovl...@gmail.com>
AuthorDate: Thu Jul 9 10:56:18 2020 +0300

    [DLAB-1748]: changed how list of available pip versions is returned
---
 infrastructure-provisioning/src/general/lib/os/fab.py | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/infrastructure-provisioning/src/general/lib/os/fab.py 
b/infrastructure-provisioning/src/general/lib/os/fab.py
index 9e58946..9414088 100644
--- a/infrastructure-provisioning/src/general/lib/os/fab.py
+++ b/infrastructure-provisioning/src/general/lib/os/fab.py
@@ -71,11 +71,6 @@ def install_pip_pkg(requisites, pip_version, lib_group):
             sudo('{0} freeze | if ! grep -w -i {1} > /tmp/{0}install_{1}.list; 
then  echo "" > /tmp/{0}install_{1}.list;fi'.format(pip_version, pip_pkg))
             res = sudo('cat /tmp/{0}install_{1}.list'.format(pip_version, 
pip_pkg))
             changed_pip_pkg = False
-            if "Could not find a version that satisfies the requirement" in 
err:
-                versions = [err[err.find("(from versions: ") + 
16:err.find(")\r\n")]]
-                status.append({"group": "{}".format(lib_group), "name": 
pip_pkg.split("=")[0], "status": "failed",
-                               "error_message": err, "available_versions": 
versions})
-                return status
             if res == '':
                 changed_pip_pkg = pip_pkg.split("=")[0].replace("_", 
"-").split('-')
                 changed_pip_pkg = changed_pip_pkg[0]
@@ -100,7 +95,12 @@ def install_pip_pkg(requisites, pip_version, lib_group):
                     dep = "none"
                 status.append({"group": "{}".format(lib_group), "name": 
pip_pkg.split("=")[0], "version": version, "status": "installed", "add_pkgs": 
dep})
             else:
-                status.append({"group": "{}".format(lib_group), "name": 
pip_pkg.split("=")[0], "status": "failed", "error_message": err})
+                if "Could not find a version that satisfies the requirement" 
in err:
+                    versions = [err[err.find("(from versions: ") + 16: 
err.find(")\r\n")]].split(' ')
+                    status.append({"group": "{}".format(lib_group), "name": 
pip_pkg.split("=")[0], "status": "failed",
+                                   "error_message": err, "available_versions": 
versions})
+                else:
+                    status.append({"group": "{}".format(lib_group), "name": 
pip_pkg.split("=")[0], "status": "failed", "error_message": err})
         return status
     except Exception as err:
         append_result("Failed to install {} packages".format(pip_version), 
str(err))


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

Reply via email to