TT#43700 Fix services handling

The previous logic had several issues that need to be addressed, when
doing an early exit:

 - The temporary file was not getting removed.
 - The services sync-state step was not being executed.

This makes the code more future-proof, and fixes the above problems,
by moving the sync-state into its own function, removing the early
exit, and making the service explicit state changes conditional on
the previous early exit conditional.

Change-Id: Ie420cbb94ea6d16a83c7ae3f546cd3eb38435dd8
changes/16/25616/1
Guillem Jover 8 years ago
parent 91cf7755ad
commit 203d60e9b5

@ -83,7 +83,9 @@ execute() {
log_info "Executing enqueued services actions"
ngcp-service queue-run
}
services_sync_state() {
log_info "Synchronizing current with expected services state"
ngcp-service sync-state
}
@ -202,19 +204,21 @@ for dir in ${CONFIG_POOL} ; do
generate_list_to_process "${dir}"
done
if [[ ! -s "${TMPFILE}" ]]; then
log_debug "No services file(s) reported - nothing to do."
exit 0
fi
if [[ -s "${TMPFILE}" ]]; then
log_debug "normalize_files function"
normalize_files
log_debug "normalize_files function"
normalize_files
log_debug "sort_service_list function"
sort_service_list
log_debug "sort_service_list function"
sort_service_list
log_debug "execute function"
execute
else
log_debug "No services file(s) reported - no explicit service state changed."
fi
log_debug "execute function"
execute
log_debug "services_sync_state function"
services_sync_state
if [[ -n "${DEBUG:-}" ]]; then
log_debug "Not removing temporary files"

Loading…
Cancel
Save