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/09/07 14:08:17 UTC

[incubator-datalab] 01/01: [DATALAB-1527]: changed check if dpkg or apt is busy

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

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

commit 6e04533ae382da8756b42862de25db3d59575e7a
Author: leonidfrolov <fr...@gmail.com>
AuthorDate: Tue Sep 7 17:08:07 2021 +0300

    [DATALAB-1527]: changed check if dpkg or apt is busy
---
 .../src/general/lib/os/debian/common_lib.py                       | 8 ++++----
 1 file changed, 4 insertions(+), 4 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 1263904..1b25d96 100644
--- a/infrastructure-provisioning/src/general/lib/os/debian/common_lib.py
+++ b/infrastructure-provisioning/src/general/lib/os/debian/common_lib.py
@@ -32,7 +32,7 @@ import datalab.fab
 def handle_dpkg_lock(error, rerun=False):
     try:
         count = 0
-        if 'E: Could not get lock ' and 'It is held by process ' in err:
+        if 'E: Could not get lock ' and 'It is held by process ' in error:
             log = datalab.fab.conn.sudo('cat /tmp/dpkg.log | grep "E: Could not get lock"').stdout
             lock_path = log.split('\n')[0][22:log.find('.')]
             pid = log.split('\n')[0][log.find('It is held by process ') + 22:].split(' ')[0]
@@ -70,7 +70,7 @@ def handle_dpkg_lock(error, rerun=False):
 def handle_apt_lock(error, rerun=False):
     try:
         count = 0
-        if 'E: Could not get lock ' and 'It is held by process ' in err:
+        if 'E: Could not get lock ' and 'It is held by process ' in error:
             log = datalab.fab.conn.sudo('cat /tmp/apt.log | grep "E: Could not get lock"').stdout
             lock_path = log.split('\n')[0][22:log.find('.')]
             pid = log.split('\n')[0][log.find('It is held by process ') + 22:].split(' ')[0]
@@ -103,7 +103,7 @@ def handle_apt_lock(error, rerun=False):
 def handle_apt_get_lock(error, rerun=False):
     try:
         count = 0
-        if 'E: Could not get lock ' and 'It is held by process ' in err:
+        if 'E: Could not get lock ' and 'It is held by process ' in error:
             log = datalab.fab.conn.sudo('cat /tmp/apt.log | grep "E: Could not get lock"').stdout
             lock_path = log.split('\n')[0][22:log.find('.')]
             pid = log.split('\n')[0][log.find('It is held by process ') + 22:].split(' ')[0]
@@ -148,7 +148,7 @@ def manage_pkg(command, environment, requisites):
             else:
                 print('Package manager is:')
                 if environment == 'remote':
-                    if datalab.fab.conn.sudo('pgrep "^apt" -a && echo "busy" || echo "ready"') == 'busy' or datalab.fab.conn.sudo('pgrep "^dpkg" -a && echo "busy" || echo "ready"') == 'busy':
+                    if 'busy' in datalab.fab.conn.sudo('pgrep "^apt" -a && echo "busy" || echo "ready"') or 'busy' in datalab.fab.conn.sudo('pgrep "^dpkg" -a && echo "busy" || echo "ready"'):
                         counter += 1
                         time.sleep(10)
                     else:

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