From 91b73e9019080b276281cc69ce897fca4acea057 Mon Sep 17 00:00:00 2001 From: Michael Prokop Date: Thu, 14 Nov 2013 01:30:22 +0100 Subject: [PATCH] MT#4973 Check node specific execution of *_not_replicated.up scripts Scripts that need to be executed on all hosts (the ones with filename *_not_replicated.up) but have been executed on sp1 already are listed as "already executed" on sp2 if the ngcp-check-rev-applied call doesn't use the node specific check. So generate a list of *_not_replicated.up files and run node specific checks while generating the list of missing revision scripts. --- ngcp-update-db-schema | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/ngcp-update-db-schema b/ngcp-update-db-schema index d3403694..029342f1 100755 --- a/ngcp-update-db-schema +++ b/ngcp-update-db-schema @@ -112,7 +112,23 @@ apply_revs() { revs="$1" - for missing_revision in $(ngcp-check-rev-applied --schema db_schema --revision $revs | awk '/^No match for revision/ {print $5}') ; do + # generate list of rev scripts that are node specific, used inside + # missing_revision's ngcp-check-rev-applied ... --node $hostname + for rev in $revs ; do + revision_file="$(find /usr/share/ngcp-db-schema/ -name "$rev")" + + case "$revision_file" in + *_not_replicated.up) + node_revs="$node_revs $rev" + ;; + esac + done + + for missing_revision in \ + $( { + ngcp-check-rev-applied --schema db_schema --revision $revs | awk '/^No match for revision/ {print $5}' ; + ngcp-check-rev-applied --schema db_schema --revision $node_revs --node "$hostname" | awk '/^No match for revision/ {print $5}' ; + } | sort -z -n -u ) ; do revision_file="$(find /usr/share/ngcp-db-schema/ -name "$missing_revision")" # execute the rev script iff there's no entry for the *current* host yet