summaryrefslogtreecommitdiff
path: root/tools/merge.py
diff options
context:
space:
mode:
authorLinus Nordberg <linus@nordberg.se>2015-04-23 23:23:36 +0200
committerLinus Nordberg <linus@nordberg.se>2015-04-23 23:23:36 +0200
commitf1630b6eb3dd525448aac8d722ccb9f8098e8593 (patch)
tree13aaaeb61018359bc760174c54e1f93b9ee075e8 /tools/merge.py
parent9a5583e983cab73fc0ae419dfd68442fc27c2c3e (diff)
parentcef3057325c7eba5d4a931a9814202eb9eb574eb (diff)
Merge branch 'mergesecondary' of https://git.nordu.net/user/map/catlfish into mergesecondary
Diffstat (limited to 'tools/merge.py')
-rwxr-xr-xtools/merge.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/tools/merge.py b/tools/merge.py
index ed1c162..b426039 100755
--- a/tools/merge.py
+++ b/tools/merge.py
@@ -38,7 +38,7 @@ localconfig = yaml.load(open(args.localconfig))
ctbaseurl = config["baseurl"]
frontendnodes = config["frontendnodes"]
storagenodes = config["storagenodes"]
-secondaries = localconfig["secondary"]
+secondaries = localconfig.get("secondary", [])
paths = localconfig["paths"]
mergedb = paths["mergedb"]
@@ -241,15 +241,18 @@ timestamp = int(time.time() * 1000)
for secondary in secondaries:
remotehost = secondary["host"]
remotedir = remotehost + ":" + secondary["mergedir"]
+ localdir = mergedb
+ if localdir[:-1] != '/':
+ localdir = localdir + "/"
print >>sys.stderr, "copying database to secondary:", remotehost
- rsyncstatus = subprocess.call(["rsync", "-r", "--append", "--rsh=ssh", mergedb, remotedir])
+ rsyncstatus = subprocess.call(["rsync", "-r", "--append", "--rsh=ssh", localdir, remotedir])
if rsyncstatus:
print >>sys.stderr, "rsync failed:", rsyncstatus
sys.exit(1)
print >>sys.stderr, "verifying database at secondary:", remotehost
- verifysecondary = subprocess.Popen(["ssh", remotehost, secondary["verifycommand"]],
+ verifysecondary = subprocess.Popen(["ssh", remotehost, secondary["verifycommand"], secondary["mergedir"]],
stdout=subprocess.PIPE)
(verifysecondaryresult, _) = verifysecondary.communicate()