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

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

commit 2e3e05dc4809045e80882e6f22ffbd46395b9a95
Author: leonidfrolov <[email protected]>
AuthorDate: Tue Jun 15 13:17:17 2021 +0300

    [DATALAB-2420]: changed one of lib installation temporary files name
---
 infrastructure-provisioning/src/general/lib/os/fab.py | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/infrastructure-provisioning/src/general/lib/os/fab.py 
b/infrastructure-provisioning/src/general/lib/os/fab.py
index 484bcf2..e798c16 100644
--- a/infrastructure-provisioning/src/general/lib/os/fab.py
+++ b/infrastructure-provisioning/src/general/lib/os/fab.py
@@ -103,7 +103,8 @@ def install_pip_pkg(requisites, pip_version, lib_group):
     status = list()
     error_parser = "Could not|No 
matching|ImportError:|failed|EnvironmentError:|requires|FileNotFoundError:|RuntimeError:|error:"
     try:
-        venv_install_command = 'source /opt/python/python{0}/bin/activate && 
/opt/python/python{0}/bin/pip{1}'.format(os.environ['notebook_python_venv_version'],
 os.environ['notebook_python_venv_version'][:3])
+        venv_install_command = 'source /opt/python/python{0}/bin/activate && 
/opt/python/python{0}/bin/pip{1}'.format(
+            os.environ['notebook_python_venv_version'], 
os.environ['notebook_python_venv_version'][:3])
         #if pip_version == 'pip3' and not exists(conn, '/bin/pip3'):
         #    for v in range(4, 8):
         #        if exists(conn, '/bin/pip3.{}'.format(v)):
@@ -120,17 +121,21 @@ def install_pip_pkg(requisites, pip_version, lib_group):
                 version = pip_pkg[1]
                 pip_pkg = "{}=={}".format(pip_pkg[0], pip_pkg[1])
             conn.sudo(
-                '''bash -l -c '{0} install -U {1} 
--use-deprecated=legacy-resolver --no-cache-dir 2>&1 | tee /tmp/tee.tmp; if ! 
grep -w -i -E  "({2})" /tmp/tee.tmp > /tmp/{4}install_{3}.log; then  echo "" > 
/tmp/{4}install_{3}.log;fi' '''.format(
+                '''bash -l -c '{0} install -U {1} 
--use-deprecated=legacy-resolver --no-cache-dir 2>&1 | '''
+                '''tee /tmp/tee.tmp; if ! grep -w -i -E  "({2})" /tmp/tee.tmp 
> /tmp/{4}install_{3}.log; '''
+                '''then  echo "" > /tmp/{4}install_{3}.log;fi' '''.format(
                     venv_install_command, pip_pkg, error_parser, name, 
pip_version))
             err = conn.sudo('cat /tmp/{0}install_{1}.log'.format(pip_version, 
pip_pkg.split("==")[0])).stdout.replace(
                 '"', "'").replace('\n', ' ')
             conn.sudo(
-                '''bash -l -c '{0} freeze --all | if ! grep -w -i {1} > 
/tmp/{2}install_{1}.list; then  echo "not_found" > /tmp/{2}install_{1}.list;fi' 
'''.format(
+                '''bash -l -c '{0} freeze --all | if ! grep -w -i {1} > 
/tmp/{2}install_{1}.list; '''
+                '''then  echo "not_found" > /tmp/{2}install_{1}.list;fi' 
'''.format(
                     venv_install_command, name, pip_version))
             res = conn.sudo('''bash -l -c 'cat /tmp/{0}install_{1}.list' 
'''.format(pip_version, name)).stdout.replace(
                 '\n', '')
             conn.sudo(
-                '''bash -l -c 'cat /tmp/tee.tmp | if ! grep "Successfully 
installed" > /tmp/{0}install_{1}.list; then  echo "not_installed" > 
/tmp/{0}install_{1}.list;fi' '''.format(
+                '''bash -l -c 'cat /tmp/tee.tmp | if ! grep "Successfully 
installed" > /tmp/{0}install_{1}.list; then  '''
+                '''echo "not_installed" > /tmp/{0}install_{1}.list;fi' 
'''.format(
                     pip_version, name))
             installed_out = conn.sudo(
                 '''bash -l -c 'cat /tmp/{0}install_{1}.list' 
'''.format(pip_version, name)).stdout.replace('\n', '')
@@ -169,9 +174,10 @@ def install_pip_pkg(requisites, pip_version, lib_group):
                     versions = []
 
             conn.sudo(
-                '''bash -l -c 'cat /tmp/tee.tmp | if ! grep -w -i -E  
"Installing collected packages:" > /tmp/{0}install_{1}.log; then  echo "" > 
/tmp/{0}install_{1}.log;fi' '''.format(
+                '''bash -l -c 'cat /tmp/tee.tmp | if ! grep -w -i -E  
"Installing collected packages:" > '''
+                '''/tmp/{0}install_{1}.dep; then  echo "" > 
/tmp/{0}install_{1}.dep;fi' '''.format(
                     pip_version, name))
-            dep = conn.sudo('cat /tmp/{0}install_{1}.log'.format(pip_version, 
name)).stdout.replace('\n', '').strip()[31:]
+            dep = conn.sudo('cat /tmp/{0}install_{1}.dep'.format(pip_version, 
name)).stdout.replace('\n', '').strip()[31:]
             if dep == '':
                 dep = []
             else:

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to