]> xenbits.xensource.com Git - people/iwj/colo-for-testing.git/commitdiff
transfer-flight-history: wip
authorIan Jackson <ian.jackson@eu.citrix.com>
Thu, 12 Mar 2015 15:59:12 +0000 (15:59 +0000)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Thu, 12 Mar 2015 15:59:12 +0000 (15:59 +0000)
transfer-flight-history [new file with mode: 0755]

diff --git a/transfer-flight-history b/transfer-flight-history
new file mode 100755 (executable)
index 0000000..e78f929
--- /dev/null
@@ -0,0 +1,40 @@
+#!/bin/bash
+
+set -ex
+
+of=cam101-history-load
+
+exec 3>$of
+
+echo >&3 "BEGIN;"
+
+for t in flights flights_harness_touched jobs runvars steps;
+do
+       echo >&3 "DELETE FROM $t WHERE flight < 50000;"
+
+       tf=cam101-history-$t.tmp
+       pg_dump \
+               -a -b -F plain -O \
+               --table=$t \
+               --no-security-labels \
+               --no-tablespaces \
+               -f $tf -h osstestdb.db.cam.xci-test.com osstestdb
+       sed -e 's/^SELECT pg_catalog\.setval/-- &/g' <$tf >&3
+done
+
+echo >&3 "COMMIT;"
+
+perl -ne '
+        print unless
+                $hide ||
+                m/^\-\-/ ||
+                !m/\S/;
+        $hide = 1 if m/ FROM stdin\;$/;
+        $hide = 0 if m/^\\\./;
+' $of
+
+rsync -vP $of osstest.test-lab:.
+
+ssh osstest.test-lab psql -h db -f $of
+
+echo ok.