Commit 8ea72b12 authored by Maxime Hubert's avatar Maxime Hubert
Browse files

get-system: add a new parameter called name

parent 22ec5279
Pipeline #133758 passed with stage
in 31 seconds
......@@ -21,7 +21,7 @@ class ActevGetSystem(ActevCommand):
* user or U: username to access the url
* password or p: password to access the url
* token or t: token to access the url
* name or n: name to give to the system
"""
def __init__(self):
super(ActevGetSystem, self).__init__('get-system', entry_point)
......
......@@ -16,6 +16,7 @@ class ActevGetSystemArchive(ActevCommand):
* user or U: url to get the system
* password or p: password to access the url
* token or t: token to access the url
* name or n: name to give to the system once it is downloaded
"""
def __init__(self):
......@@ -36,5 +37,6 @@ class ActevGetSystemArchive(ActevCommand):
arg_parser.add_argument("-l", "--location", help="path to store the system")
arg_parser.add_argument("-t", "--token", help="token to access the url"
"Warning: if token starts with \'-\', use this: --token=<your token>")
arg_parser.add_argument("-n", "--name", help="name to give to the system once it is downloaded")
......@@ -17,7 +17,7 @@ class ActevGetSystemGit(ActevCommand):
* password or p: password to access the url
* token or t: token to access the url
* install-cli or i: install the cli to use it
* name or n: name to give to the system once it is downloaded
"""
def __init__(self):
super(ActevGetSystemGit, self).__init__('git', "get_git.sh")
......@@ -39,5 +39,6 @@ class ActevGetSystemGit(ActevCommand):
"Warning: if token starts with \'-\', use this: --token=<your token>",
type=str)
arg_parser.add_argument("-i", "--install-cli", help="install the cli to use it", action='store_true')
arg_parser.add_argument("-n", "--name", help="name to give to the system once it is downloaded")
......@@ -5,7 +5,7 @@ This file should not be modified.
import os
from diva_evaluation_cli.bin.private_src.implementation.get_system.system_types_definition import system_types
def entry_point(url, system_type, location=None, user=None, password=None, token=None, install_cli=False):
def entry_point(url, system_type, location=None, user=None, password=None, token=None, install_cli=False, name=False):
"""Private entry point.
Downloads a credentialed, web-accessible content into src
......@@ -37,6 +37,8 @@ def entry_point(url, system_type, location=None, user=None, password=None, token
install_cli = "True"
else:
install_cli = "False"
if not name:
name = ""
# go into the right directory to execute the script
path = os.path.dirname(__file__)
......@@ -46,7 +48,8 @@ def entry_point(url, system_type, location=None, user=None, password=None, token
" " + user + \
" " + password + \
" " + token + \
" " + install_cli
" " + install_cli + \
" " + name
# execute the script
# status is the exit status code returned by the program
......
......@@ -5,6 +5,8 @@ location=$2
user=$3
password=$4
token=$5
install_cli=$6
name=$7
if [ $location != "None" ];then
cd $location
......@@ -31,4 +33,9 @@ else
fi
archive=`ls`
python3.6 -c "import shutil; shutil.unpack_archive('${archive}'); print('Archive uncompressed')"
if [ $name != "" ]; then
python3.6 -c "import shutil; shutil.unpack_archive('${archive}'); print('Archive uncompressed')"
else
python3.6 -c "import shutil; shutil.unpack_archive('${archive}', '${name}'); print('Archive uncompressed')"
fi
......@@ -6,6 +6,7 @@ user=$3
password=$4
token=$5
cli=$6
name=$7
# If there are credentials
if [ $user != "None" ] && [ $password != "None" ]; then
......@@ -28,7 +29,7 @@ if [ $location != "None" ];then
cd $location
fi
git clone --recursive $url
git clone --recursive $url $name
if [ $? -eq 0 ];then
# If the system has to be installed
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment