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
commit 074687296b3b264927020e7122eff98e9332908c Author: leonidfrolov <frolovl...@gmail.com> AuthorDate: Wed Jul 15 13:33:01 2020 +0300 [DLAB-1748]: added new error status when invalid version for R and apt --- infrastructure-provisioning/src/general/lib/os/debian/notebook_lib.py | 4 +++- infrastructure-provisioning/src/general/lib/os/fab.py | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/infrastructure-provisioning/src/general/lib/os/debian/notebook_lib.py b/infrastructure-provisioning/src/general/lib/os/debian/notebook_lib.py index 1d3020c..0903c08 100644 --- a/infrastructure-provisioning/src/general/lib/os/debian/notebook_lib.py +++ b/infrastructure-provisioning/src/general/lib/os/debian/notebook_lib.py @@ -390,8 +390,10 @@ def install_os_pkg(requisites): dep = [] if 'E: Version' in err and 'was not found' in err: versions = sudo ('apt-cache policy {} | grep 500 | grep -v Packages'.format(os_pkg.split("=")[0])).replace('\r\n', '').replace(' 500', '').replace(' ', ' ').strip().split(' ') + status_msg = 'invalid version' else: versions = [] + status_msg = 'failed' sudo('apt list --installed | if ! grep {0}/ > /tmp/os_install_{1}.list; then echo "" > /tmp/os_install_{1}.list;fi'.format(os_pkg.split("=")[0], os_pkg)) res = sudo('cat /tmp/os_install_{}.list'.format(os_pkg)) if res: @@ -400,7 +402,7 @@ def install_os_pkg(requisites): version = [i for i in ver if os_pkg.split("=")[0] in i][0].split(' ')[1] status.append({"group": "os_pkg", "name": os_pkg.split("=")[0], "version": version, "status": "installed", "add_pkgs": dep}) else: - status.append({"group": "os_pkg", "name": os_pkg.split("=")[0], "status": "failed", "error_message": err, "available_versions": versions}) + status.append({"group": "os_pkg", "name": os_pkg.split("=")[0], "status": status_msg, "error_message": err, "available_versions": versions}) sudo('unattended-upgrades -v') sudo('export LC_ALL=C') return status diff --git a/infrastructure-provisioning/src/general/lib/os/fab.py b/infrastructure-provisioning/src/general/lib/os/fab.py index 7b40958..ba59eca 100644 --- a/infrastructure-provisioning/src/general/lib/os/fab.py +++ b/infrastructure-provisioning/src/general/lib/os/fab.py @@ -439,9 +439,11 @@ def install_r_pkg(requisites): sudo('R -e \'install.packages("versions", repos="https://cloud.r-project.org", dep=TRUE)\'') versions = sudo('R -e \'library(versions); available.versions("' + name + '")\' 2>&1 | grep -A 50 ' '\'date available\' | awk \'{print $2}\'').replace('\r\n', ' ')[5:].split(' ') + status_msg = 'invalid version' else: versions = [] - status.append({"group": "r_pkg", "name": name, "status": "failed", "error_message": err, "available_versions": versions}) + status_msg = 'failed' + status.append({"group": "r_pkg", "name": name, "status": status_msg, "error_message": err, "available_versions": versions}) return status except Exception as err: append_result("Failed to install R packages", str(err)) --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@dlab.apache.org For additional commands, e-mail: commits-h...@dlab.apache.org