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

omartushevskyi pushed a commit to branch EPMCDLAB-1186
in repository https://gitbox.apache.org/repos/asf/incubator-dlab.git


The following commit(s) were added to refs/heads/EPMCDLAB-1186 by this push:
     new bf66da8  fixed issue with logging in npm repository
bf66da8 is described below

commit bf66da84a259b4251c8a3e142e757938067437c9
Author: Oleh Martushevskyi <oleh_martushevs...@epam.com>
AuthorDate: Thu Feb 28 13:18:04 2019 +0200

    fixed issue with logging in npm repository
---
 .../src/general/files/aws/deeplearning_Dockerfile  |  1 -
 .../src/general/files/aws/jupyter_Dockerfile       |  1 -
 .../src/general/files/aws/rstudio_Dockerfile       |  1 -
 .../src/general/files/aws/ssn_Dockerfile           |  1 -
 .../general/files/aws/tensor-rstudio_Dockerfile    |  1 -
 .../src/general/files/aws/tensor_Dockerfile        |  1 -
 .../src/general/files/aws/zeppelin_Dockerfile      |  1 -
 .../src/general/files/os/npm_login                 | 20 -------------
 .../src/general/lib/os/debian/notebook_lib.py      | 35 +++++++++++-----------
 .../src/general/lib/os/debian/ssn_lib.py           | 29 +++++++++---------
 .../src/general/scripts/aws/ssn_configure.py       |  1 -
 11 files changed, 33 insertions(+), 59 deletions(-)

diff --git 
a/infrastructure-provisioning/src/general/files/aws/deeplearning_Dockerfile 
b/infrastructure-provisioning/src/general/files/aws/deeplearning_Dockerfile
index 6e157ff..a2b7e17 100644
--- a/infrastructure-provisioning/src/general/files/aws/deeplearning_Dockerfile
+++ b/infrastructure-provisioning/src/general/files/aws/deeplearning_Dockerfile
@@ -36,7 +36,6 @@ COPY general/templates/os/run_template.sh /root/templates/
 COPY general/templates/os/tensorboard.service /root/templates/
 COPY general/files/os/toree-assembly-0.2.0.jar /root/files/
 COPY general/files/os/toree_kernel.tar.gz /root/files/
-COPY general/files/os/npm_login /root/files/
 COPY general/templates/os/pyspark_dataengine-service_template.json 
/root/templates/
 COPY general/templates/os/r_dataengine-service_template.json /root/templates/
 COPY general/templates/os/toree_dataengine-service_* /root/templates/
diff --git 
a/infrastructure-provisioning/src/general/files/aws/jupyter_Dockerfile 
b/infrastructure-provisioning/src/general/files/aws/jupyter_Dockerfile
index d4bf666..1a8409c 100644
--- a/infrastructure-provisioning/src/general/files/aws/jupyter_Dockerfile
+++ b/infrastructure-provisioning/src/general/files/aws/jupyter_Dockerfile
@@ -38,7 +38,6 @@ COPY general/templates/os/toree_dataengine-service_* 
/root/templates/
 COPY general/templates/aws/Rprofile.site /root/templates/
 COPY general/files/os/toree-assembly-0.2.0.jar /root/files/
 COPY general/files/os/toree_kernel.tar.gz /root/files/
-COPY general/files/os/npm_login /root/files/
 COPY general/templates/os/pyspark_dataengine_template.json /root/templates/
 COPY general/templates/os/r_dataengine_template.json /root/templates/
 COPY general/templates/os/toree_dataengine_template.json /root/templates/
diff --git 
a/infrastructure-provisioning/src/general/files/aws/rstudio_Dockerfile 
b/infrastructure-provisioning/src/general/files/aws/rstudio_Dockerfile
index e2e9853..d900272 100644
--- a/infrastructure-provisioning/src/general/files/aws/rstudio_Dockerfile
+++ b/infrastructure-provisioning/src/general/files/aws/rstudio_Dockerfile
@@ -28,7 +28,6 @@ COPY general/lib/os/${OS}/notebook_lib.py 
/usr/lib/python2.7/dlab/notebook_lib.p
 COPY general/templates/os/${OS}/ungit.service /root/templates/
 COPY general/templates/os/notebook_spark-defaults_local.conf /root/templates/
 COPY general/templates/aws/Rprofile.site /root/templates/
-COPY general/files/os/npm_login /root/files/
 
 RUN chmod a+x /root/fabfile.py; \
     chmod a+x /root/scripts/*
diff --git a/infrastructure-provisioning/src/general/files/aws/ssn_Dockerfile 
b/infrastructure-provisioning/src/general/files/aws/ssn_Dockerfile
index 07c7b7c..87e8da0 100644
--- a/infrastructure-provisioning/src/general/files/aws/ssn_Dockerfile
+++ b/infrastructure-provisioning/src/general/files/aws/ssn_Dockerfile
@@ -25,7 +25,6 @@ COPY 
infrastructure-provisioning/src/general/scripts/aws/ssn_* /root/scripts/
 COPY infrastructure-provisioning/src/general/lib/os/${OS}/ssn_lib.py 
/usr/lib/python2.7/dlab/ssn_lib.py
 COPY infrastructure-provisioning/src/general/files/aws/ssn_policy.json 
/root/files/
 COPY infrastructure-provisioning/src/general/templates/aws/jenkins_jobs 
/root/templates/jenkins_jobs
-COPY infrastructure-provisioning/src/general/files/os/npm_login /root/files/
 
 RUN chmod a+x /root/fabfile.py; \
     chmod a+x /root/scripts/*
diff --git 
a/infrastructure-provisioning/src/general/files/aws/tensor-rstudio_Dockerfile 
b/infrastructure-provisioning/src/general/files/aws/tensor-rstudio_Dockerfile
index 2bba6d4..04ea9dd 100644
--- 
a/infrastructure-provisioning/src/general/files/aws/tensor-rstudio_Dockerfile
+++ 
b/infrastructure-provisioning/src/general/files/aws/tensor-rstudio_Dockerfile
@@ -30,7 +30,6 @@ COPY general/templates/os/notebook_spark-defaults_local.conf 
/root/templates/
 COPY general/templates/os/${OS}/ungit.service /root/templates/
 COPY general/templates/os/tensorboard.service /root/templates/
 COPY general/templates/aws/Rprofile.site /root/templates/
-COPY general/files/os/npm_login /root/files/
 
 RUN chmod a+x /root/fabfile.py; \
     chmod a+x /root/scripts/*
diff --git 
a/infrastructure-provisioning/src/general/files/aws/tensor_Dockerfile 
b/infrastructure-provisioning/src/general/files/aws/tensor_Dockerfile
index f27d032..653e270 100644
--- a/infrastructure-provisioning/src/general/files/aws/tensor_Dockerfile
+++ b/infrastructure-provisioning/src/general/files/aws/tensor_Dockerfile
@@ -34,7 +34,6 @@ COPY general/templates/os/pyspark_dataengine_template.json 
/root/templates/
 COPY general/templates/os/${OS}/ungit.service /root/templates/
 COPY general/templates/os/tensorboard.service /root/templates/
 COPY general/templates/os/pyspark_dataengine-service_template.json 
/root/templates/
-COPY general/files/os/npm_login /root/files/
 
 RUN chmod a+x /root/fabfile.py; \
     chmod a+x /root/scripts/*
diff --git 
a/infrastructure-provisioning/src/general/files/aws/zeppelin_Dockerfile 
b/infrastructure-provisioning/src/general/files/aws/zeppelin_Dockerfile
index 2df37c3..d911775 100644
--- a/infrastructure-provisioning/src/general/files/aws/zeppelin_Dockerfile
+++ b/infrastructure-provisioning/src/general/files/aws/zeppelin_Dockerfile
@@ -33,7 +33,6 @@ COPY general/templates/os/dataengine_interpreter_spark.json 
/root/templates/
 COPY general/templates/os/${OS}/ungit.service /root/templates/
 COPY general/templates/os/notebook_spark-defaults_local.conf /root/templates/
 COPY general/templates/aws/Rprofile.site /root/templates/
-COPY general/files/os/npm_login /root/files/
 
 RUN chmod a+x /root/fabfile.py; \
     chmod a+x /root/scripts/*
diff --git a/infrastructure-provisioning/src/general/files/os/npm_login 
b/infrastructure-provisioning/src/general/files/os/npm_login
deleted file mode 100644
index abc395d..0000000
--- a/infrastructure-provisioning/src/general/files/os/npm_login
+++ /dev/null
@@ -1,20 +0,0 @@
-#!/usr/bin/expect -f
-
-set i 0; foreach n $argv {set "p[incr i]" $n}
-
-set timeout 60
-eval spawn $p1 login
-match_max 100000
-
-expect "Username"
-send "$p2\r"
-
-expect "Password"
-send "$p3\r"
-
-expect "Email"
-send "$p4\r"
-
-expect {
-   timeout      exit 1
-}
\ No newline at end of file
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 b116621..674bdbd 100644
--- a/infrastructure-provisioning/src/general/lib/os/debian/notebook_lib.py
+++ b/infrastructure-provisioning/src/general/lib/os/debian/notebook_lib.py
@@ -439,25 +439,26 @@ def install_nodejs(os_user):
                 sudo('./deps/npm/bin/npm-cli.js config set registry 
{0}/'.format(
                      os.environ['local_repository_npm_repo']))
                 if 'local_repository_user_name' in os.environ and 
'local_repository_user_password' in os.environ:
-                    put('/root/files/npm_login', '/tmp/npm_login')
-
-                    sudo('expect -f /tmp/npm_login {0} {1} {2} 
"{3}"'.format("./deps/npm/bin/npm-cli.js",
-                                                                             
os.environ['local_repository_user_name'],
-                                                                             
os.environ[
-                                                                               
  'local_repository_user_password'],
-                                                                             
'dlab-ne...@example.org'))
+                    auth_token = sudo('curl -s -H "Accept: application/json" 
-H "Content-Type:application/json" -X '
+                                      'PUT --data \'{"name": "{0}", 
"password": "{1}"}\' '
+                                      '{2}/-/user/org.couchdb.user:{0} | jq -r 
".token"'.format(
+                        os.environ['local_repository_user_name'],
+                        os.environ['local_repository_user_password'],
+                        os.environ['local_repository_npm_repo']))
+                    sudo('echo "{0}/:_authToken={1}" >> ~/.npmrc'.format(
+                        os.environ['local_repository_npm_repo'].split(':')[1], 
auth_token))
                 sudo('./deps/npm/bin/npm-cli.js install npm')
                 sudo('cp deps/npm/bin/npm /opt/node/')
-                sudo('npm config set strict-ssl false')
-                sudo('npm config set registry {0}/'.format(
-                     os.environ['local_repository_npm_repo']))
-                if 'local_repository_user_name' in os.environ and 
'local_repository_user_password' in os.environ:
-                    sudo('expect -f /tmp/npm_login {0} {1} {2} 
"{3}"'.format('npm',
-                                                                             
os.environ['local_repository_user_name'],
-                                                                             
os.environ[
-                                                                               
  'local_repository_user_password'],
-                                                                             
'dlab-ne...@example.org'))
-                sudo('npm config set sass_binary_path 
/opt/node/linux-x64-57_binding.node')
+                # sudo('npm config set strict-ssl false')
+                # sudo('npm config set registry {0}/'.format(
+                #      os.environ['local_repository_npm_repo']))
+                # if 'local_repository_user_name' in os.environ and 
'local_repository_user_password' in os.environ:
+                #     sudo('expect -f /tmp/npm_login {0} {1} {2} 
"{3}"'.format('npm',
+                #                                                              
os.environ['local_repository_user_name'],
+                #                                                              
os.environ[
+                #                                                              
    'local_repository_user_password'],
+                #                                                              
'dlab-ne...@example.org'))
+                # sudo('npm config set sass_binary_path 
/opt/node/linux-x64-57_binding.node')
         else:
             sudo('curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash 
-')
             sudo('apt-get install -y nodejs')
diff --git a/infrastructure-provisioning/src/general/lib/os/debian/ssn_lib.py 
b/infrastructure-provisioning/src/general/lib/os/debian/ssn_lib.py
index aec1040..9a22951 100644
--- a/infrastructure-provisioning/src/general/lib/os/debian/ssn_lib.py
+++ b/infrastructure-provisioning/src/general/lib/os/debian/ssn_lib.py
@@ -334,7 +334,7 @@ def install_build_dep():
     try:
         if not 
exists('{}tmp/build_dep_ensured'.format(os.environ['ssn_dlab_path'])):
             maven_version = '3.5.4'
-            sudo('apt-get install -y openjdk-8-jdk git wget unzip gcc g++ make 
expect')
+            sudo('apt-get install -y openjdk-8-jdk git wget unzip gcc g++ make 
jq')
             with cd('/opt/'):
                 if os.environ['local_repository_enabled'] == 'True':
                     sudo('wget {0}/apache-maven-{1}-bin.zip'.format(
@@ -367,21 +367,22 @@ def install_build_dep():
                     sudo('./deps/npm/bin/npm-cli.js config set registry 
{0}/'.format(
                          os.environ['local_repository_npm_repo']))
                     if 'local_repository_user_name' in os.environ and 
'local_repository_user_password' in os.environ:
-                        put('/root/files/npm_login', '/tmp/npm_login')
-
-                        sudo('expect -f /tmp/npm_login {0} {1} {2} 
"{3}"'.format("./deps/npm/bin/npm-cli.js",
-                             os.environ['local_repository_user_name'], 
os.environ['local_repository_user_password'],
-                             'dlab-ne...@example.org'))
+                        auth_token = sudo('curl -s -H "Accept: 
application/json" -H "Content-Type:application/json" -X '
+                                          'PUT --data \'{"name": "{0}", 
"password": "{1}"}\' '
+                                          '{2}/-/user/org.couchdb.user:{0} | 
jq -r ".token"'.format(
+                                           
os.environ['local_repository_user_name'],
+                                           
os.environ['local_repository_user_password'],
+                                           
os.environ['local_repository_npm_repo']))
+                        sudo('echo "{0}/:_authToken={1}" >> ~/.npmrc'.format(
+                            
os.environ['local_repository_npm_repo'].split(':')[1], auth_token))
                     sudo('./deps/npm/bin/npm-cli.js install npm')
                     sudo('cp deps/npm/bin/npm /opt/node/')
-                    sudo('npm config set strict-ssl false')
-                    sudo('npm config set registry {0}/'.format(
-                         os.environ['local_repository_npm_repo']))
-                    if 'local_repository_user_name' in os.environ and 
'local_repository_user_password' in os.environ:
-                        sudo('expect -f /tmp/npm_login {0} {1} {2} 
"{3}"'.format('npm',
-                             os.environ['local_repository_user_name'], 
os.environ['local_repository_user_password'],
-                            'dlab-ne...@example.org'))
-                    sudo('npm config set sass_binary_path 
/opt/node/linux-x64-57_binding.node')
+                    # sudo('npm config set strict-ssl false')
+                    # sudo('npm config set registry {0}/'.format(
+                    #      os.environ['local_repository_npm_repo']))
+                    # if 'local_repository_user_name' in os.environ and 
'local_repository_user_password' in os.environ:
+                    #
+                    # sudo('npm config set sass_binary_path 
/opt/node/linux-x64-57_binding.node')
             else:
                 sudo('bash -c "curl --silent --location 
https://deb.nodesource.com/setup_8.x | bash -"')
                 sudo('apt-get install -y nodejs')
diff --git 
a/infrastructure-provisioning/src/general/scripts/aws/ssn_configure.py 
b/infrastructure-provisioning/src/general/scripts/aws/ssn_configure.py
index d55236c..bf4d447 100644
--- a/infrastructure-provisioning/src/general/scripts/aws/ssn_configure.py
+++ b/infrastructure-provisioning/src/general/scripts/aws/ssn_configure.py
@@ -363,7 +363,6 @@ if __name__ == "__main__":
         try:
             local("~/scripts/{}.py {}".format('configure_ui', params))
         except:
-            time.sleep(14400)
             traceback.print_exc()
             raise Exception
     except Exception as err:


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

Reply via email to