Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Eteri
slapos
Commits
7547be46
Commit
7547be46
authored
Nov 30, 2016
by
Nicolas Wavrant
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slaprunner: importer script should fail also when running the custom import scripts
parent
95c0c413
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
7 deletions
+8
-7
software/slaprunner/common.cfg
software/slaprunner/common.cfg
+1
-1
software/slaprunner/template/runner-import.sh.jinja2
software/slaprunner/template/runner-import.sh.jinja2
+7
-6
No files found.
software/slaprunner/common.cfg
View file @
7547be46
...
@@ -68,7 +68,7 @@ recipe = hexagonit.recipe.download
...
@@ -68,7 +68,7 @@ recipe = hexagonit.recipe.download
ignore-existing = true
ignore-existing = true
url = ${:_profile_base_location_}/template/runner-import.sh.jinja2
url = ${:_profile_base_location_}/template/runner-import.sh.jinja2
download-only = true
download-only = true
md5sum =
275ae222cd9a560c08748d7502824885
md5sum =
5db39d7f56fd1f96ce6466e9055841a1
filename = runner-import.sh.jinja2
filename = runner-import.sh.jinja2
mode = 0644
mode = 0644
...
...
software/slaprunner/template/runner-import.sh.jinja2
View file @
7547be46
...
@@ -15,6 +15,7 @@ ERROR_MESSAGE=""
...
@@ -15,6 +15,7 @@ ERROR_MESSAGE=""
fail_with_exit_code () {
fail_with_exit_code () {
echo 1 > $RESTORE_EXIT_CODE_FILE
echo 1 > $RESTORE_EXIT_CODE_FILE
echo -e "Failure during step : $ERROR_MESSAGE" > $RESTORE_ERROR_MESSAGE_FILE
echo -e "Failure during step : $ERROR_MESSAGE" > $RESTORE_ERROR_MESSAGE_FILE
exit 1
}
}
trap fail_with_exit_code ERR
trap fail_with_exit_code ERR
...
@@ -55,18 +56,18 @@ cp -r {{ directory['backup'] }}/etc/.??* {{ directory['etc'] }};
...
@@ -55,18 +56,18 @@ cp -r {{ directory['backup'] }}/etc/.??* {{ directory['etc'] }};
# Invoke arbitrary script to perform specific restoration
# Invoke arbitrary script to perform specific restoration
# procedure.
# procedure.
RESTORE_EXIT_CODE=0
runner_import_restore=$srv_directory/runner-import-restore
runner_import_restore=$srv_directory/runner-import-restore
if [ ! -e "$runner_import_restore" ]; then
if [ ! -e "$runner_import_restore" ]; then
touch $runner_import_restore
touch $runner_import_restore
chmod +x $runner_import_restore
chmod +x $runner_import_restore
fi
fi
log_message "Running $runner_import_restore..."
log_message "Running $runner_import_restore..."
$srv_directory/runner-import-restore
|| RESTORE_EXIT_CODE=$?
$srv_directory/runner-import-restore
# If no "etc/.project" neither "srv/runner/proxy.db", we can safely assume
# If no "etc/.project" neither "srv/runner/proxy.db", we can safely assume
# that there is no instnace deployed on runner0
# that there is no instnace deployed on runner0
if [ ! -f "directory['etc']/.project" ] && [ ! -f "$srv_directory/runner/proxy.db" ]; then
if [ ! -f "directory['etc']/.project" ] && [ ! -f "$srv_directory/runner/proxy.db" ]; then
log_message "No Software Requested... Writing status file... End"
echo 0 > $RESTORE_EXIT_CODE_FILE
echo 0 > $RESTORE_EXIT_CODE_FILE
exit 0
exit 0
fi
fi
...
@@ -121,8 +122,8 @@ for partition in $srv_directory/runner/instance/slappart*/
...
@@ -121,8 +122,8 @@ for partition in $srv_directory/runner/instance/slappart*/
do
do
script=$partition/srv/runner-import-restore
script=$partition/srv/runner-import-restore
if [ -e "$script" ]; then
if [ -e "$script" ]; then
log_message "Running $script..."
log_message "Running
custom instance script :
$script..."
$script
|| RESTORE_EXIT_CODE=$?
$script
fi
fi
done
done
...
@@ -132,5 +133,5 @@ $SQLITE3 $DATABASE "update partition11 set requested_state='started';"
...
@@ -132,5 +133,5 @@ $SQLITE3 $DATABASE "update partition11 set requested_state='started';"
# Write exit code to an arbitrary file that will be checked by promise/monitor
# Write exit code to an arbitrary file that will be checked by promise/monitor
log_message "Writing status file... End"
log_message "Writing status file... End"
echo
$RESTORE_EXIT_CODE
> $RESTORE_EXIT_CODE_FILE
echo
0
> $RESTORE_EXIT_CODE_FILE
exit
$RESTORE_EXIT_CODE
exit
0
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment