optimize register func

(cherry picked from commit d90e37c22f8b2c73867e67b14d349f870e55ac3a)
This commit is contained in:
rabbitali 2023-05-11 12:24:38 +08:00 committed by openeuler-sync-bot
parent 66cec228a6
commit 098a7fd263
2 changed files with 38 additions and 1 deletions

View File

@ -0,0 +1,32 @@
From e627084922fdead376e16cfc05b555f2d2b114ea Mon Sep 17 00:00:00 2001
From: rabbitali <shusheng.wen@outlook.com>
Date: Mon, 8 May 2023 11:24:25 +0800
Subject: [PATCH] optimize register func
---
ceres/function/command.py | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/ceres/function/command.py b/ceres/function/command.py
index d84177e..e9bb25e 100644
--- a/ceres/function/command.py
+++ b/ceres/function/command.py
@@ -47,14 +47,12 @@ def register_on_manager(args: argparse.Namespace) -> NoReturn:
Returns:
NoReturn
"""
- if args.data:
+ if args.data is not None:
register_info = register_info_to_dict(args.data)
else:
register_info = get_dict_from_file(args.path)
- if register_info.get('ceres_host') is not None:
- update_ini_data_value(CERES_CONFIG_PATH,
- 'ceres', 'port', register_info.get('ceres_host'))
- if register(register_info) == SUCCESS:
+
+ if register_info and register(register_info) == SUCCESS:
print('Register Success')
else:
print('Register Fail')
--

View File

@ -1,12 +1,14 @@
Name: aops-ceres
Version: v1.2.0
Release: 3
Release: 4
Summary: An agent which needs to be adopted in client, it managers some plugins, such as gala-gopher(kpi collection), fluentd(log collection) and so on.
License: MulanPSL2
URL: https://gitee.com/openeuler/%{name}
Source0: %{name}-%{version}.tar.gz
Patch0001: 0001-fix-shell-command-return-error-and-update-register-function.patch
Patch0002: 0002-fix-hotpatch-fail-show-succeed-bug.patch
Patch0003: 0003-optimize-register-func.patch
BuildRequires: python3-setuptools
Requires: python3-requests python3-jsonschema python3-libconf
@ -41,6 +43,9 @@ An agent which needs to be adopted in client, it managers some plugins, such as
%changelog
* Thu May 11 2023 wenixn<shusheng.wen@outlook.com> - v1.2.0-4
- fix hotpatch fail show succeed bug
* Tue May 9 2023 ptyang<1475324955@qq.com> - v1.2.0-3
- fix hotpatch fail show succeed bug