Commit c3727d8bbd1a735f3701a5bc7a96b16f53649b74
Exists in
dev
Merge branch 'dev' of https://gitlab.irap.omp.eu/pyros-irap/pyros into dev
Showing
3 changed files
with
76 additions
and
38 deletions
Show diff stats
docker/PYROS_DOCKER_UPDATE
1 | 1 | #!/usr/bin/env bash |
2 | 2 | |
3 | +# In docker/ folder | |
4 | +docker_folder=$(pwd 2>&1) | |
5 | + | |
3 | 6 | # PRE-CONDITION : pyros container must be running |
4 | -root_folder=$(pwd 2>&1) | |
5 | 7 | # If no container is running Start it |
6 | -if ! [ $(docker ps | grep 'pyros' | wc -l) -eq 4 ] | |
7 | -then | |
8 | +if ! [ $(docker ps | grep 'pyros' | wc -l) -eq 4 ] ; then | |
8 | 9 | echo "pyros-db or pyros weren't running, starting them..." |
9 | 10 | ./PYROS_DOCKER_START |
10 | 11 | #./PYROS_DOCKER_START.bat |
11 | 12 | fi |
12 | 13 | |
13 | -# 1) Update Guitastro | |
14 | -echo "Updating Guitastro source code" | |
15 | -cd ../vendor/guitastro/ | |
16 | -gitpull_output=$(git pull 2>&1) | |
17 | -echo $gitpull_output | |
18 | -check_files=("docker-compose.yml" "Dockerfile" "install/requirements.in") | |
19 | -for file in "${check_files[@]}" | |
20 | -do | |
21 | - if grep -q "$file" <<< "$gitpull_output"; then | |
22 | - echo "WARNING : One of docker related files has been changed. You should build again the PyROS Image" | |
23 | - return 1 | |
14 | +# Main function git pull & rebuild if necessary | |
15 | +already_uptodate="Déjà à jour." | |
16 | +check_files=("docker-compose.yml" "Dockerfile" "install/requirements.in" "install/requirements.txt" "doc_rst/requirements.in" "doc_rst/requirements.txt") | |
17 | +check_files="${check_files[@]}" | |
18 | +function git_pull { | |
19 | + dir=$1 | |
20 | + #echo $check_files | |
21 | + cd $dir | |
22 | + gitpull_output=$(git pull 2>&1) | |
23 | + # IF git pull error (other than $already_uptodate) => stop | |
24 | + if [[ $? -eq 1 && "$gitpull_output" != "$already_uptodate" ]]; then | |
25 | + echo "Git pull failed. Error message is:" | |
26 | + echo $gitpull_output | |
27 | + exit 1 | |
24 | 28 | fi |
25 | -done | |
29 | + echo $gitpull_output | |
30 | + # test only | |
31 | + #gitpull_output=$gitpull_output."Dockerfile " | |
32 | + # Check if exists file changed that requires rebuild | |
33 | + #for file in "${check_files[@]}" | |
34 | + for f in $check_files ; do | |
35 | + #echo "check $f" | |
36 | + #if [ $f == "doc_rst/requirements.txt" ] ; then | |
37 | + if grep -q "$f" <<< "$gitpull_output" ; then | |
38 | + echo "WARNING : One of docker related files ($f) has been changed. You should build again the PyROS Image before going on with the UPDATE..." | |
39 | + echo "=> Build & start again the PyROS image ? ([y]/n)" | |
40 | + read input ; [ -z ${input} ] && input="y" | |
41 | + [ $input != "y" ] && exit 1 | |
42 | + (cd $docker_folder && ./PYROS_DOCKER_BUILD && ./PYROS_DOCKER_START) | |
43 | + # BUILF only once !!! | |
44 | + break | |
45 | + fi | |
46 | + done | |
47 | + cd - > /dev/null | |
48 | +} | |
26 | 49 | |
27 | -# 2) Update PyROS | |
28 | -cd $root_folder | |
29 | -echo "Updating PyROS source code" | |
30 | -gitpull_output=$(git pull 2>&1) | |
31 | -echo $gitpull_output | |
32 | -check_files=("docker-compose.yml" "Dockerfile" "install/requirements.in") | |
33 | -for file in "${check_files[@]}" | |
34 | -do | |
35 | - if grep -q "$file" <<< "$gitpull_output"; then | |
36 | - echo "WARNING : One of docker related files has been changed. You should build again the PyROS Image" | |
37 | - return 1 | |
38 | - fi | |
39 | -done | |
40 | 50 | |
41 | -# TODO : test if git pull worked and if git pull changed dockerfile, requirements.in, docker-compose.yml | |
42 | -# Tell user to rebuild | |
51 | +# I - Update Guitastro | |
52 | +echo | |
53 | +echo "**********************************" | |
54 | +echo "I - Updating Guitastro source code" | |
55 | +echo "**********************************" | |
56 | +echo | |
57 | +git_pull ../vendor/guitastro/ | |
43 | 58 | |
44 | 59 | |
45 | -# 3) Update all observatories with git repo | |
46 | -for dir in ../../PYROS_OBSERVATORY/* ; do | |
47 | - if [ -d .git ] ; then | |
60 | +# II - Update PyROS | |
61 | +echo | |
62 | +echo "**********************************" | |
63 | +echo "II - Updating PyROS source code" | |
64 | +echo "**********************************" | |
65 | +echo | |
66 | +git_pull ../ | |
67 | + | |
68 | + | |
69 | +# III - Update all observatories with git repo | |
70 | +echo | |
71 | +echo "**********************************" | |
72 | +echo "III - Updating PyROS Observatory(ies)" | |
73 | +echo "**********************************" | |
74 | +echo | |
75 | +# Go to PYROS observatories folder | |
76 | +cd ../../PYROS_OBSERVATORY/ | |
77 | +for dir in * ; do | |
78 | + if [ -d $dir/.git ] ; then | |
48 | 79 | echo "Updating observatory $dir source code" |
49 | - git pull | |
80 | + git_pull $dir | |
50 | 81 | fi |
51 | 82 | done |
83 | +#cd ../PYROS/docker/ | |
84 | +cd $docker_folder | |
52 | 85 | |
53 | -# 3) pyros.py update => update BD + doc + Guitastro requirements | |
54 | -docker compose exec pyros python3 pyros.py update | |
55 | 86 | |
87 | +# IV - pyros.py update => update BD + doc | |
88 | +echo | |
89 | +echo "**********************************" | |
90 | +echo "IV - Updating PyROS Doc & Database" | |
91 | +echo "**********************************" | |
92 | +echo | |
93 | +docker compose exec pyros python3 pyros.py update | ... | ... |
pyros.py
... | ... | @@ -809,6 +809,7 @@ def initdb(): |
809 | 809 | return True |
810 | 810 | |
811 | 811 | |
812 | +# Install Observatory dependencies (from config DEPENDENCY/links section) : guitastro devices... | |
812 | 813 | @pyros_launcher.command(help="Install dependencies from Observatory config DEPENDENCY section") |
813 | 814 | # @global_test_options |
814 | 815 | @click.option('--observatory', '-o', help='the Observatory name to be used') | ... | ... |
src/core/pyros_django/user_mgmt/forms.py
... | ... | @@ -9,7 +9,6 @@ from django.contrib.auth.forms import PasswordResetForm |
9 | 9 | from user_mgmt.models import Country, Institute, PyrosUser, UserLevel |
10 | 10 | |
11 | 11 | |
12 | - | |
13 | 12 | class UserForm(forms.ModelForm): |
14 | 13 | class Meta: |
15 | 14 | model = PyrosUser |
... | ... | @@ -19,7 +18,7 @@ class UserForm(forms.ModelForm): |
19 | 18 | 'email', |
20 | 19 | 'country', |
21 | 20 | 'institute', |
22 | - #'user_level', | |
21 | + # user_level', | |
23 | 22 | 'desc', |
24 | 23 | 'tel', |
25 | 24 | 'address', | ... | ... |