From 3f8a3889d5379a98ec00ac974dd98d170043234d Mon Sep 17 00:00:00 2001 From: yhua Date: Wed, 24 Aug 2016 14:24:13 +0800 Subject: [PATCH] add flag [-conf] for specify harbor.cfg position in prepare --- Deploy/prepare | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Deploy/prepare b/Deploy/prepare index 27c6775ca..c77af01b4 100755 --- a/Deploy/prepare +++ b/Deploy/prepare @@ -6,6 +6,7 @@ import random import string import os import sys +import argparse from io import open if sys.version_info[:3][0] == 2: @@ -16,10 +17,14 @@ if sys.version_info[:3][0] == 3: import configparser as ConfigParser import io as StringIO +parser = argparse.ArgumentParser() +parser.add_argument('-conf', dest='cfgfile', default = 'harbor.cfg',type=str,help="the path of Harbor configuration file") +args = parser.parse_args() + #Read configurations conf = StringIO.StringIO() conf.write("[configuration]\n") -conf.write(open("harbor.cfg").read()) +conf.write(open(args.cfgfile).read()) conf.seek(0, os.SEEK_SET) rcp = ConfigParser.RawConfigParser() rcp.readfp(conf)