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/02/22 09:48:59 UTC

[incubator-datalab] branch DATALAB-2091 updated (0b0146b -> 343dd20)

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

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


 discard 0b0146b  [DATALAB-2091]: removed unnecessary prints, changed error_parced variable, fixed while statement
 discard a007715  [DATALAB-2091]: fixed variable assignment from command output
 discard 6fad4f1  [DATALAB-2091]: added additional variable declaration
 discard 6bc285f  [DATALAB-2091]: removed arguments to command
 discard 7b52064  [DATALAB-2091]: added arguments to command
 discard 0855c48  [DATALAB-2091]: added some lines for testing
 discard 4c97af8  [DATALAB-2091]: changed error content check
 discard dd1f891  [DATALAB-2091]: fixed file path
 discard 9667bf9  [DATALAB-2091]: changed err variable assignment
 discard d4210aa  [DATALAB-2091]: added prints
 discard 55efafc  [DATALAB-2091]: removed prints
 discard 76772e8  [DATALAB-2091]: changed dpkg command
 discard 2f449fc  [DATALAB-2091]: changed dpkg command
 discard 4112697  [DATALAB-2091]: removed hostname output
 discard 60b0775  [DATALAB-2091]: added hostname output
 discard 754f120  [DATALAB-2091]: changed how dpkg error is used
 discard ba2ea8f  [DATALAB-2091]: changed how dpkg error is used
 discard 70d2b0c  [DATALAB-2091]: changed how dpkg error is used
 discard 87df9a2  [DATALAB-2091]: changed how dpkg error is used
 discard 6c5801b  [DATALAB-2091]: changed how dpkg error is used
 discard 27fc90d  [DATALAB-2091]: added some prints
 discard 50639a4  [DATALAB-2091]: added some prints
 discard 18df460  [DATALAB-2091]: reduced amount of retries
 discard 20c105e  [DATALAB-2091]: added some prints
 discard ee40c51  [DATALAB-2091]: changed error variable assignment in manage_pkg
 discard 04a3064  [DATALAB-2091]: changed error variable assignment in manage_pkg
 discard 24fc542  [DATALAB-2091]: changed error variable assignment in manage_pkg
 discard 15537bc  [DATALAB-2091]: added print for testing
 discard 07d3344  [DATALAB-2091]: added print for testing
 discard e2c7b33  [DATALAB-2091]: added print for testing
 discard 9c3b2e0  [DATALAB-2091]: added print for testing
 discard 7aaa371  [DATALAB-2091]: added print for testing
 discard 1b33254  [DATALAB-2091]: added print for testing
 discard c191035  [DATALAB-2091]: added hostname output
 discard 8b5df0b  [DATALAB-2091]: changed dpkg command during manage_pkg
 discard 937e882  [DATALAB-2091]: made conn accessible from common_lib module
 discard 0c6022c  [DATALAB-2091]: added some prints for testing
 discard baf02a7  [DATALAB-2091]: changed how conn is used by another modules
     new 343dd20  [DATALAB-2091]: fixed stdout capture to variable

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (0b0146b)
            \
             N -- N -- N   refs/heads/DATALAB-2091 (343dd20)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 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.


Summary of changes:
 .../src/general/lib/os/debian/common_lib.py                       | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)


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


[incubator-datalab] 01/01: [DATALAB-2091]: fixed stdout capture to variable

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

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

commit 343dd2029fb43eff584dba894ac407c7c144d77b
Author: leonidfrolov <fr...@gmail.com>
AuthorDate: Mon Feb 22 11:48:41 2021 +0200

    [DATALAB-2091]: fixed stdout capture to variable
---
 .../src/general/lib/os/debian/common_lib.py        | 32 +++++++++++-----------
 1 file changed, 16 insertions(+), 16 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 3b28cdc..3fb5a21 100644
--- a/infrastructure-provisioning/src/general/lib/os/debian/common_lib.py
+++ b/infrastructure-provisioning/src/general/lib/os/debian/common_lib.py
@@ -47,29 +47,29 @@ def manage_pkg(command, environment, requisites):
                         try:
                             error_parser = "frontend is locked|locked"
                             datalab.fab.conn.sudo('dpkg --configure -a 2>&1 | tee /tmp/tee.tmp; if ! grep -w -E "({0})" /tmp/tee.tmp > '
-                                     '/tmp/dpkg.log; then echo "" > /tmp/dpkg.log;fi'.format(error_parser))
-                            err = datalab.fab.conn.sudo('cat /tmp/dpkg.log')
+                                                  '/tmp/dpkg.log; then echo "no_error" > /tmp/dpkg.log;fi'.format(error_parser))
+                            err = datalab.fab.conn.sudo('cat /tmp/dpkg.log').stdout
                             count = 0
-                            while err != '' and count < 10:
-                                pid = datalab.fab.conn.sudo('lsof /var/lib/dpkg/lock-frontend | grep dpkg | awk \'{print $2}\'')
+                            while 'no_error' not in err and count < 10:
+                                pid = datalab.fab.conn.sudo('lsof /var/lib/dpkg/lock-frontend | grep dpkg | awk \'{print $2}\'').stdout
                                 if pid != '':
                                     datalab.fab.conn.sudo('kill -9 {}'.format(pid))
                                     datalab.fab.conn.sudo('rm -f /var/lib/dpkg/lock-frontend')
-                                    pid = datalab.fab.conn.sudo('lsof /var/lib/dpkg/lock | grep dpkg | awk \'{print $2}\'')
+                                    pid = datalab.fab.conn.sudo('lsof /var/lib/dpkg/lock | grep dpkg | awk \'{print $2}\'').stdout
                                 elif pid != '':
                                     datalab.fab.conn.sudo('kill -9 {}'.format(pid))
                                     datalab.fab.conn.sudo('rm -f /var/lib/dpkg/lock')
                                 datalab.fab.conn.sudo('dpkg --configure -a 2>&1 | tee /tmp/tee.tmp; if ! grep -w -E "({0})" /tmp/tee.tmp > '
-                                     '/tmp/dpkg.log; then echo "" > /tmp/dpkg.log;fi'.format(error_parser))
-                                err = datalab.fab.conn.sudo('cat /tmp/dpkg.log')
+                                     '/tmp/dpkg.log; then echo "no_error" > /tmp/dpkg.log;fi'.format(error_parser))
+                                err = datalab.fab.conn.sudo('cat /tmp/dpkg.log').stdout
                                 count = count + 1
                             datalab.fab.conn.sudo('apt update')
-
                             datalab.fab.conn.sudo('apt-get {0} {1} 2>&1 | tee /tmp/tee.tmp; if ! grep -w -E "({2})" /tmp/tee.tmp > '
-                                 '/tmp/apt.log; then echo "" > /tmp/apt.log;fi'.format(command, requisites, error_parser))
-                            err = datalab.fab.conn.sudo('cat /tmp/apt.log')
+                                 '/tmp/apt.log; then echo "no_error" > /tmp/apt.log;fi'.format(command, requisites, error_parser))
+                            datalab.fab.conn.sudo('ls -la /tmp/')
+                            err = datalab.fab.conn.sudo('cat /tmp/apt.log').stdout
                             count = 0
-                            while err != '' and count < 10:
+                            while 'no_error' not in err and count < 10:
                                 datalab.fab.conn.sudo('lsof /var/lib/dpkg/lock')
                                 datalab.fab.conn.sudo('lsof /var/lib/apt/lists/lock')
                                 datalab.fab.conn.sudo('lsof /var/cache/apt/archives/lock')
@@ -77,8 +77,8 @@ def manage_pkg(command, environment, requisites):
                                 datalab.fab.conn.sudo('rm -f /var/cache/apt/archives/lock')
                                 datalab.fab.conn.sudo('rm -f /var/lib/dpkg/lock')
                                 datalab.fab.conn.sudo('apt-get {0} {1} 2>&1 | tee /tmp/tee.tmp; if ! grep -w -E "({2})" /tmp/tee.tmp > '
-                                     '/tmp/apt.log; then echo "" > /tmp/apt.log;fi'.format(command, requisites, error_parser))
-                                err = datalab.fab.conn.sudo('cat /tmp/apt.log')
+                                     '/tmp/apt.log; then echo "no_error" > /tmp/apt.log;fi'.format(command, requisites, error_parser))
+                                err = datalab.fab.conn.sudo('cat /tmp/apt.log').stdout
                                 count = count + 1
                             allow = True
                         except Exception as err:
@@ -105,7 +105,7 @@ def ensure_pkg(user, requisites='linux-headers-generic python3-pip python3-dev p
             count = 0
             check = False
             while not check:
-                if count > 5:
+                if count > 60:
                     print("Repositories are not available. Please, try again later.")
                     sys.exit(1)
                 else:
@@ -118,7 +118,7 @@ def ensure_pkg(user, requisites='linux-headers-generic python3-pip python3-dev p
                         datalab.fab.conn.sudo('unattended-upgrades -v')
                         datalab.fab.conn.sudo(
                             'sed -i \'s|APT::Periodic::Unattended-Upgrade "1"|APT::Periodic::Unattended-Upgrade "0"|\' /etc/apt/apt.conf.d/20auto-upgrades')
-                        datalab.fab.conn.sudo('export LC_ALL=C')
+                        datalab.fab.conn.run('export LC_ALL=C')
                         datalab.fab.conn.sudo('touch /home/{}/.ensure_dir/pkg_upgraded'.format(user))
                         datalab.fab.conn.sudo('systemctl enable haveged')
                         datalab.fab.conn.sudo('systemctl start haveged')
@@ -150,7 +150,7 @@ def change_pkg_repos():
 
 
 def find_java_path_remote():
-    java_path = datalab.fab.conn.sudo("sh -c \"update-alternatives --query java | grep 'Value: ' | grep -o '/.*/jre'\"")
+    java_path = datalab.fab.conn.sudo("sh -c \"update-alternatives --query java | grep 'Value: ' | grep -o '/.*/jre'\"").stdout
     return java_path
 
 


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