From 5d01f64b2f753f6ac7ddce6c36d4c4bbcc15a6e7 Mon Sep 17 00:00:00 2001 From: Rongfeng Fu Date: Mon, 3 Jan 2022 16:27:10 +0800 Subject: [PATCH] fix #74 (#76) * update example * fix #74 --- core.py | 12 ++++++------ plugins/oceanbase/3.1.0/upgrade_route.py | 2 +- rpm/build.sh | 7 ++++--- rpm/ob-deploy.spec | 2 +- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/core.py b/core.py index 3a86668..2c335ab 100644 --- a/core.py +++ b/core.py @@ -1215,9 +1215,9 @@ class ObdHome(object): self._call_stdio('error', 'Deploy "%s" is %s. You could not reload an %s cluster.' % (name, deploy_info.status.value, deploy_info.status.value)) return False - # if deploy_info.config_status != DeployConfigStatus.NEED_RELOAD: - # self._call_stdio('error', 'Deploy config %s' % deploy_info.config_status.value) - # return False + if deploy_info.config_status == DeployConfigStatus.UNCHNAGE: + self._call_stdio('print', 'Deploy config is UNCHNAGE') + return True self._call_stdio('verbose', 'Get deploy config') deploy_config = deploy.deploy_config @@ -1542,9 +1542,9 @@ class ObdHome(object): self._call_stdio('error', 'Not found %s in Deploy "%s" ' % (component, name)) return False else: - if len(deploy_info.components) == 1: - component = deploy_info.components.keys()[0] - else: + for component in deploy_info.components: + break + if not component: self._call_stdio('error', 'Specify the components you want to upgrade.') return False diff --git a/plugins/oceanbase/3.1.0/upgrade_route.py b/plugins/oceanbase/3.1.0/upgrade_route.py index 82461c0..a187a05 100644 --- a/plugins/oceanbase/3.1.0/upgrade_route.py +++ b/plugins/oceanbase/3.1.0/upgrade_route.py @@ -186,7 +186,7 @@ def upgrade_route(plugin_context, current_repository, dest_repository, *args, ** yaml = YamlLoader(stdio) try: - with open(upgrade_dep_path) as f: + with open(upgrade_dep_path, encoding='utf-8') as f: data = yaml.load(f) graph = ObVersionGraph(data) route = graph.findShortestUpgradePath(current_repository, dest_repository) diff --git a/rpm/build.sh b/rpm/build.sh index 1938197..9c55212 100755 --- a/rpm/build.sh +++ b/rpm/build.sh @@ -108,15 +108,16 @@ function build() CID=`git log |head -n1 | awk -F' ' '{print $2}'` BRANCH=`git branch | grep -e "^\*" | awk -F' ' '{print $2}'` DATE=`date '+%b %d %Y %H:%M:%S'` + VERSION=$VERSION".`date +%s`"` BUILD_DIR="$DIR/.build" rm -fr $BUILD_DIR mkdir -p $BUILD_DIR/lib/site-packages mkdir -p $BUILD_DIR/mirror/remote wget https://mirrors.aliyun.com/oceanbase/OceanBase.repo -O $BUILD_DIR/mirror/remote/OceanBase.repo cat _cmd.py | sed "s//$CID/" | sed "s//$BRANCH/" | sed "s//$DATE/" | sed "s//$OBD_DUBUG/" | sed "s//$VERSION/" > obd.py - pip install -r $req_fn.txt - pip install -r plugins-$req_fn.txt --target=$BUILD_DIR/lib/site-packages - pyinstaller --hidden-import=decimal --hidden-import=configparser -F obd.py + pip install -r $req_fn.txt | exit 1 + pip install -r plugins-$req_fn.txt --target=$BUILD_DIR/lib/site-packages | exit 1 + pyinstaller --hidden-import=decimal --hidden-import=configparser -F obd.py | exit 1 rm -f obd.py obd.spec cp -r plugins $BUILD_DIR/plugins rm -fr /usr/obd /usr/bin/obd diff --git a/rpm/ob-deploy.spec b/rpm/ob-deploy.spec index 5e08e82..e5d877f 100644 --- a/rpm/ob-deploy.spec +++ b/rpm/ob-deploy.spec @@ -1,5 +1,5 @@ Name: ob-deploy -Version: 1.2.0 +Version: 1.2.1 Release: %(echo $RELEASE)%{?dist} # if you want use the parameter of rpm_create on build time, # uncomment below -- GitLab