Commit 8b8edd0e authored by Alain Takoudjou's avatar Alain Takoudjou

slaprunner: exit runner importer if there is no deployed partition in slapproxy database

If Software release is selected but instance is not deployed, there will be no partition deployed
in slapproxy which will make current importer script fail.
parent ef8968eb
...@@ -22,7 +22,7 @@ md5sum = e12255a8c946b3eb8c6373fff481339f ...@@ -22,7 +22,7 @@ md5sum = e12255a8c946b3eb8c6373fff481339f
[template-runner-import-script] [template-runner-import-script]
filename = template/runner-import.sh.jinja2 filename = template/runner-import.sh.jinja2
md5sum = ed2e08c07a6727b2012f15da67c0705d md5sum = 646b165541317fa81e9b0ebca71671b3
[instance-runner-import] [instance-runner-import]
filename = instance-runner-import.cfg.in filename = instance-runner-import.cfg.in
......
...@@ -154,6 +154,12 @@ fi ...@@ -154,6 +154,12 @@ fi
# XXX hardcoded # XXX hardcoded
PARTITION=$(basename $HOME) PARTITION=$(basename $HOME)
OLD_SOFTWARE_RELEASE=$(db_query "select software_release from partition11 where reference='slappart0';") OLD_SOFTWARE_RELEASE=$(db_query "select software_release from partition11 where reference='slappart0';")
if [ -z "$OLD_SOFTWARE_RELEASE" ]; then
# if Software Release is selected but Instance was not ran
log_message "No instance deployed... Writing status file... End"
echo 0 > $RESTORE_EXIT_CODE_FILE
exit 0
fi
SOFTWARE_RELEASE=$({{ sys.executable }} - $OLD_SOFTWARE_RELEASE $PARTITION <<EOF SOFTWARE_RELEASE=$({{ sys.executable }} - $OLD_SOFTWARE_RELEASE $PARTITION <<EOF
if 1: if 1:
import os, re, sys import os, re, sys
......
  • @Nicolas I saw that you did a change on this topic on: f5eee79f We still have a problem is OLD_SOFTWARE_RELEASE is empty.

  • @alain.takoudjou : you are right, I will fix that

  • are you ok with this fix ?

  • I would prefer to use a more generic sql request to test this, for exemple :

    select slap_state from partition11 where slap_state != 'free';

    As otherwise we will have to update this code when slapos.toolbox!19 will be merged (as afterwards we may have an empty slappart0, but deployed instances in other slapparts).

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