Return zero when input version is same as target (#4535)

This commit is contained in:
Daniel Jiang 2018-03-30 14:17:07 +08:00 committed by Yan
parent 07d7d467e7
commit 24dfad4afe

View File

@ -5,6 +5,7 @@
from __future__ import print_function from __future__ import print_function
import argparse import argparse
import os import os
import sys
import utils import utils
import importlib import importlib
import glob import glob
@ -24,9 +25,12 @@ def main():
input_version = utils.get_conf_version(args.input_path) input_version = utils.get_conf_version(args.input_path)
curr_dir = os.path.dirname(__file__) curr_dir = os.path.dirname(__file__)
chain = [] chain = []
if input_version == target_version:
print ("Version of input harbor.cfg is identical to target %s, no need to upgrade" % input_version)
sys.exit(0)
if not search(curr_dir, input_version, target_version, chain): if not search(curr_dir, input_version, target_version, chain):
print ("No migrator for version: %s" % input_version) print ("No migrator for version: %s" % input_version)
os.exit(1) sys.exit(1)
else: else:
print ("input version: %s, migrator chain: %s" % (input_version, chain)) print ("input version: %s, migrator chain: %s" % (input_version, chain))
curr_input_path = args.input_path curr_input_path = args.input_path