You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dlab.apache.org by my...@apache.org on 2020/02/18 13:43:36 UTC

[incubator-dlab] branch DLAB-1527 created (now 1fed9bd)

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

mykolabodnar pushed a change to branch DLAB-1527
in repository https://gitbox.apache.org/repos/asf/incubator-dlab.git.


      at 1fed9bd  [DLAB-1527]: function for apt-get/yum fixed

This branch includes the following new commits:

     new 5fe0f7c  [DLAB-1527]: function for apt-get/yum fixed
     new 1fed9bd  [DLAB-1527]: function for apt-get/yum fixed

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



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


[incubator-dlab] 01/02: [DLAB-1527]: function for apt-get/yum fixed

Posted by my...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 5fe0f7c604111ee6b9ffaf93d6894fd1064fbc1a
Author: Mykola_Bodnar1 <bo...@gmail.com>
AuthorDate: Tue Feb 18 15:41:44 2020 +0200

    [DLAB-1527]: function for apt-get/yum fixed
---
 .../src/general/conf/dlab.ini                      |  2 +-
 .../src/general/lib/os/debian/common_lib.py        | 34 +++++++++++++---------
 .../src/general/lib/os/redhat/common_lib.py        | 34 +++++++++++++---------
 3 files changed, 43 insertions(+), 27 deletions(-)

diff --git a/infrastructure-provisioning/src/general/conf/dlab.ini b/infrastructure-provisioning/src/general/conf/dlab.ini
index 9067abe..c37e0e3 100644
--- a/infrastructure-provisioning/src/general/conf/dlab.ini
+++ b/infrastructure-provisioning/src/general/conf/dlab.ini
@@ -356,4 +356,4 @@ expl_instance_memory = 8000
 #--- [reverse_proxy] reverse proxy settings ---#
 [reverse_proxy]
 ### Nginx version
-nginx_version = 1.15.1
+nginx_version = 1.15.1
\ No newline at end of file
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 0d94ecf..fe9d136 100644
--- a/infrastructure-provisioning/src/general/lib/os/debian/common_lib.py
+++ b/infrastructure-provisioning/src/general/lib/os/debian/common_lib.py
@@ -30,21 +30,29 @@ import time
 def manage_pkg(command, environment, requisites):
     try:
         allow = False
+        counter = 0
         while not allow:
-            if environment == 'remote':
-                if sudo('pgrep apt-get -a </dev/null &'):
-                    print('Package manager still working, pleae wait')
-                else:
-                    allow = True
-                    sudo('apt-get {0} {1}'.format(command, requisites))
-            elif environment == 'local':
-                if local('sudo pgrep apt-get -a </dev/null &'):
-                    print('Package manager still working, pleae wait')
-                else:
-                    allow = True
-                    local('sudo apt-get {0} {1}'.format(command, requisites))
+            if counter > 60:
+                print("Notebook is broken please recreate it.")
+                sys.exit(1)
             else:
-                print('Wrong environment')
+                print('Package manager is:')
+                if environment == 'remote':
+                    if sudo('pgrep apt-get -a && echo "busy" || echo "ready"') == 'busy':
+                        counter += 1
+                        time.sleep(10)
+                    else:
+                        allow = True
+                        sudo('apt-get {0} {1}'.format(command, requisites))
+                elif environment == 'local':
+                    if local('sudo pgrep apt-get -a && echo "busy" || echo "ready"', capture=True) == 'busy':
+                        counter += 1
+                        time.sleep(10)
+                    else:
+                        allow = True
+                        local('sudo apt-get {0} {1}'.format(command, requisites), capture=True)
+                else:
+                    print('Wrong environment')
     except:
         sys.exit(1)
 
diff --git a/infrastructure-provisioning/src/general/lib/os/redhat/common_lib.py b/infrastructure-provisioning/src/general/lib/os/redhat/common_lib.py
index d4209b8..ea5d4f2 100644
--- a/infrastructure-provisioning/src/general/lib/os/redhat/common_lib.py
+++ b/infrastructure-provisioning/src/general/lib/os/redhat/common_lib.py
@@ -29,21 +29,29 @@ import os
 def manage_pkg(command, environment, requisites):
     try:
         allow = False
+        counter = 0
         while not allow:
-            if environment == 'remote':
-                if sudo('pgrep yum -a </dev/null &'):
-                    print('Package manager still working, pleae wait')
-                else:
-                    allow = True
-                    sudo('yum {0} {1}'.format(command, requisites))
-            elif environment == 'local':
-                if local('sudo pgrep yum -a </dev/null &'):
-                    print('Package manager still working, pleae wait')
-                else:
-                    allow = True
-                    local('sudo yum {0} {1}'.format(command, requisites))
+            if counter > 60:
+                print("Notebook is broken please recreate it.")
+                sys.exit(1)
             else:
-                print('Wrong environment')
+                print('Package manager is:')
+                if environment == 'remote':
+                    if sudo('pgrep yum -a && echo "busy" || echo "ready"') == 'busy':
+                        counter += 1
+                        time.sleep(10)
+                    else:
+                        allow = True
+                        sudo('yum {0} {1}'.format(command, requisites))
+                elif environment == 'local':
+                    if local('sudo pgrep yum -a && echo "busy" || echo "ready"', capture=True) == 'busy':
+                        counter += 1
+                        time.sleep(10)
+                    else:
+                        allow = True
+                        local('sudo yum {0} {1}'.format(command, requisites), capture=True)
+                else:
+                    print('Wrong environment')
     except:
         sys.exit(1)
 


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


[incubator-dlab] 02/02: [DLAB-1527]: function for apt-get/yum fixed

Posted by my...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 1fed9bdb4418b26fd94741612e6c208d98b18d15
Author: Mykola_Bodnar1 <bo...@gmail.com>
AuthorDate: Tue Feb 18 15:42:52 2020 +0200

    [DLAB-1527]: function for apt-get/yum fixed
---
 infrastructure-provisioning/src/general/conf/dlab.ini | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/infrastructure-provisioning/src/general/conf/dlab.ini b/infrastructure-provisioning/src/general/conf/dlab.ini
index c37e0e3..9067abe 100644
--- a/infrastructure-provisioning/src/general/conf/dlab.ini
+++ b/infrastructure-provisioning/src/general/conf/dlab.ini
@@ -356,4 +356,4 @@ expl_instance_memory = 8000
 #--- [reverse_proxy] reverse proxy settings ---#
 [reverse_proxy]
 ### Nginx version
-nginx_version = 1.15.1
\ No newline at end of file
+nginx_version = 1.15.1


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