Repository: incubator-hawq Updated Branches: refs/heads/master 0675b4a4e -> b590ed9d4
HAWQ-1221. hawq register should error out when register a yml file doesn't exist Project: http://git-wip-us.apache.org/repos/asf/incubator-hawq/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-hawq/commit/b590ed9d Tree: http://git-wip-us.apache.org/repos/asf/incubator-hawq/tree/b590ed9d Diff: http://git-wip-us.apache.org/repos/asf/incubator-hawq/diff/b590ed9d Branch: refs/heads/master Commit: b590ed9d4959abe681c2c2b429f4685421c47171 Parents: 0675b4a Author: stanlyxiang <[email protected]> Authored: Wed Dec 14 17:07:24 2016 +0800 Committer: stanlyxiang <[email protected]> Committed: Wed Dec 14 19:28:18 2016 +0800 ---------------------------------------------------------------------- tools/bin/hawqregister | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/b590ed9d/tools/bin/hawqregister ---------------------------------------------------------------------- diff --git a/tools/bin/hawqregister b/tools/bin/hawqregister index 7240c1d..39d0c23 100755 --- a/tools/bin/hawqregister +++ b/tools/bin/hawqregister @@ -148,6 +148,14 @@ def tablename_handler(tablename): return tmp_lst[-2], tmp_lst[-1] return 'public', tablename +def check_file_exist(yml_file): + if yml_file: + if not os.path.exists(yml_file): + logger.error('Cannot find yaml file : %s' % yml_file) + sys.exit(1) + return True + return False + class FailureHandler(object): def __init__(self, conn): self.operations = [] @@ -1145,7 +1153,7 @@ def main(options, args): failure_handler = FailureHandler(conn) # register - if options.yml_config and ispartition(options.yml_config): + if check_file_exist(options.yml_config) and ispartition(options.yml_config): ins = HawqRegisterPartition(options, args[0], utility_conn, conn, failure_handler) else: ins = HawqRegister(options, args[0], utility_conn, conn, failure_handler)
