From 9f47e821a4bee59a93b45df0dc24f9760a4d143f Mon Sep 17 00:00:00 2001 From: Rene Peinthor Date: Thu, 13 Feb 2020 07:42:49 +0100 Subject: [PATCH] migrate: fix for maybe missing TEMPLATE arg in OpenNebula 5.10 --- tm/postmigrate | 4 ++-- tm/premigrate | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tm/postmigrate b/tm/postmigrate index 7bf8465..f047e88 100755 --- a/tm/postmigrate +++ b/tm/postmigrate @@ -34,15 +34,15 @@ DST_HOST = sys.argv[2] DST_PATH = sys.argv[3] VM_ID = sys.argv[4] DS_ID = sys.argv[5] -TEMPLATE = sys.argv[6] def main(): util.log_info("Entering tm/postmigrate, from='{f}' to='{t}'".format(f=SRC_HOST, t=DST_HOST)) try: + TEMPLATE = sys.argv[6] vmxml = base64.b64decode(TEMPLATE) - except base64.binascii.Error: + except (base64.binascii.Error, IndexError): # since opennebula 5.10 the template XML should be provided via STDIN outstr = io.BytesIO() base64.decode(sys.stdin, outstr) diff --git a/tm/premigrate b/tm/premigrate index fcaeef2..a435a28 100755 --- a/tm/premigrate +++ b/tm/premigrate @@ -34,15 +34,15 @@ DST_HOST = sys.argv[2] DST_PATH = sys.argv[3] VM_ID = int(sys.argv[4]) DS_ID = sys.argv[5] -TEMPLATE = sys.argv[6] def main(): util.log_info("Entering tm/premigrate from {s} to {t} in {tp}".format(s=SRC_HOST, t=DST_HOST, tp=DST_PATH)) try: + TEMPLATE = sys.argv[6] vmxml = base64.b64decode(TEMPLATE) - except base64.binascii.Error: + except (base64.binascii.Error, IndexError): # since opennebula 5.10 the template XML should be provided via STDIN outstr = io.BytesIO() base64.decode(sys.stdin, outstr)