update cve fix
This commit is contained in:
parent
157d966c50
commit
e648709d20
@ -1,66 +0,0 @@
|
|||||||
From 6034a3711f5917ad57173a261a16610ed8a9461e Mon Sep 17 00:00:00 2001
|
|
||||||
From: wenxin <shusheng.wen@outlook.com>
|
|
||||||
Date: Wed, 23 Nov 2022 10:31:23 +0800
|
|
||||||
Subject: [PATCH 1/1] add field os_version for register
|
|
||||||
|
|
||||||
---
|
|
||||||
ceres/function/register.py | 1 +
|
|
||||||
ceres/tests/function/test_register.py | 11 ++++++++---
|
|
||||||
2 files changed, 9 insertions(+), 3 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/ceres/function/register.py b/ceres/function/register.py
|
|
||||||
index 9c72e79..e4e7fe1 100644
|
|
||||||
--- a/ceres/function/register.py
|
|
||||||
+++ b/ceres/function/register.py
|
|
||||||
@@ -77,6 +77,7 @@ def register(register_info: dict) -> int:
|
|
||||||
data['public_ip'] = Collect.get_host_ip()
|
|
||||||
data['agent_port'] = register_info.get('agent_port') or \
|
|
||||||
configuration.ceres.get('PORT')
|
|
||||||
+ data["os_version"] = Collect.get_system_info()
|
|
||||||
|
|
||||||
manager_ip = register_info.get('manager_ip')
|
|
||||||
manager_port = register_info.get('manager_port')
|
|
||||||
diff --git a/ceres/tests/function/test_register.py b/ceres/tests/function/test_register.py
|
|
||||||
index b7d3a6e..312ca32 100644
|
|
||||||
--- a/ceres/tests/function/test_register.py
|
|
||||||
+++ b/ceres/tests/function/test_register.py
|
|
||||||
@@ -14,6 +14,7 @@ import unittest
|
|
||||||
from unittest import mock
|
|
||||||
|
|
||||||
import responses
|
|
||||||
+from ceres.manages.collect_manage import Collect
|
|
||||||
|
|
||||||
from ceres.function.register import register, register_info_to_dict
|
|
||||||
from ceres.function.status import SUCCESS, PARAM_ERROR
|
|
||||||
@@ -23,7 +24,9 @@ class TestRegister(unittest.TestCase):
|
|
||||||
|
|
||||||
@responses.activate
|
|
||||||
@mock.patch('builtins.open', mock.mock_open())
|
|
||||||
- def test_register_should_return_200_when_input_correct(self):
|
|
||||||
+ @mock.patch.object(Collect, "get_system_info")
|
|
||||||
+ def test_register_should_return_200_when_input_correct(self, mock_os_version):
|
|
||||||
+ mock_os_version.return_value = 'mock version'
|
|
||||||
input_data = {
|
|
||||||
"web_username": "admin",
|
|
||||||
"web_password": "changeme",
|
|
||||||
@@ -233,7 +236,9 @@ class TestRegister(unittest.TestCase):
|
|
||||||
|
|
||||||
@responses.activate
|
|
||||||
@mock.patch('builtins.open', mock.mock_open())
|
|
||||||
- def test_register_should_return_success_when_input_with_no_agent_port(self):
|
|
||||||
+ @mock.patch.object(Collect, "get_system_info")
|
|
||||||
+ def test_register_should_return_success_when_input_with_no_agent_port(self, mock_os_version):
|
|
||||||
+ mock_os_version.return_value = "mock version"
|
|
||||||
responses.add(responses.POST,
|
|
||||||
'http://127.0.0.1:11111/manage/host/add',
|
|
||||||
json={"token": "hdahdahiudahud", "code": SUCCESS},
|
|
||||||
@@ -265,4 +270,4 @@ class TestRegister(unittest.TestCase):
|
|
||||||
def test_register_info_to_dict_should_return_empty_dict_when_input_is_not_json_string(self):
|
|
||||||
mock_string = '{mock'
|
|
||||||
res = register_info_to_dict(mock_string)
|
|
||||||
- self.assertEqual({}, res)
|
|
||||||
\ No newline at end of file
|
|
||||||
+ self.assertEqual({}, res)
|
|
||||||
--
|
|
||||||
2.37.1.windows.1
|
|
||||||
|
|
||||||
@ -1,118 +0,0 @@
|
|||||||
From f4ed851b85ebbc442e523c3e8c06ef45a030cd99 Mon Sep 17 00:00:00 2001
|
|
||||||
From: wenxin <shusheng.wen@outlook.com>
|
|
||||||
Date: Wed, 23 Nov 2022 13:58:14 +0800
|
|
||||||
Subject: [PATCH 1/1] remove test case about register
|
|
||||||
|
|
||||||
---
|
|
||||||
aops-ceres.spec | 2 +-
|
|
||||||
ceres/tests/function/test_register.py | 53 +--------------------------
|
|
||||||
setup.py | 3 +-
|
|
||||||
3 files changed, 3 insertions(+), 55 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/aops-ceres.spec b/aops-ceres.spec
|
|
||||||
index 0eef858..230c983 100644
|
|
||||||
--- a/aops-ceres.spec
|
|
||||||
+++ b/aops-ceres.spec
|
|
||||||
@@ -10,7 +10,7 @@ Source0: %{name}-%{version}.tar.gz
|
|
||||||
BuildRequires: python3-setuptools
|
|
||||||
Requires: python3-requests python3-flask python3-connexion python3-configparser python3-jsonschema
|
|
||||||
Requires: python3-flask-testing python3-libconf python3-swagger-ui-bundle
|
|
||||||
-Requires: python3-concurrent-log-handler dmidecode python3-responses
|
|
||||||
+Requires: python3-concurrent-log-handler dmidecode
|
|
||||||
Provides: aops-ceres
|
|
||||||
Conflicts: aops-agent
|
|
||||||
|
|
||||||
diff --git a/ceres/tests/function/test_register.py b/ceres/tests/function/test_register.py
|
|
||||||
index 312ca32..96c4a2d 100644
|
|
||||||
--- a/ceres/tests/function/test_register.py
|
|
||||||
+++ b/ceres/tests/function/test_register.py
|
|
||||||
@@ -11,41 +11,13 @@
|
|
||||||
# See the Mulan PSL v2 for more details.
|
|
||||||
# ******************************************************************************/
|
|
||||||
import unittest
|
|
||||||
-from unittest import mock
|
|
||||||
-
|
|
||||||
-import responses
|
|
||||||
-from ceres.manages.collect_manage import Collect
|
|
||||||
|
|
||||||
from ceres.function.register import register, register_info_to_dict
|
|
||||||
-from ceres.function.status import SUCCESS, PARAM_ERROR
|
|
||||||
+from ceres.function.status import PARAM_ERROR
|
|
||||||
|
|
||||||
|
|
||||||
class TestRegister(unittest.TestCase):
|
|
||||||
|
|
||||||
- @responses.activate
|
|
||||||
- @mock.patch('builtins.open', mock.mock_open())
|
|
||||||
- @mock.patch.object(Collect, "get_system_info")
|
|
||||||
- def test_register_should_return_200_when_input_correct(self, mock_os_version):
|
|
||||||
- mock_os_version.return_value = 'mock version'
|
|
||||||
- input_data = {
|
|
||||||
- "web_username": "admin",
|
|
||||||
- "web_password": "changeme",
|
|
||||||
- "host_name": "host01",
|
|
||||||
- "host_group_name": "2333",
|
|
||||||
- "management": False,
|
|
||||||
- "manager_ip": "127.0.0.1",
|
|
||||||
- "manager_port": "11111",
|
|
||||||
- "agent_port": "12000"
|
|
||||||
- }
|
|
||||||
- responses.add(responses.POST,
|
|
||||||
- 'http://127.0.0.1:11111/manage/host/add',
|
|
||||||
- json={"token": "hdahdahiudahud", "code": SUCCESS},
|
|
||||||
- status=SUCCESS,
|
|
||||||
- content_type='application/json'
|
|
||||||
- )
|
|
||||||
- data = register(input_data)
|
|
||||||
- self.assertEqual(SUCCESS, data)
|
|
||||||
-
|
|
||||||
def test_register_should_return_param_error_when_input_web_username_is_null(self):
|
|
||||||
input_data = {
|
|
||||||
"web_password": "changeme",
|
|
||||||
@@ -234,29 +206,6 @@ class TestRegister(unittest.TestCase):
|
|
||||||
data = register(input_data)
|
|
||||||
self.assertEqual(data, PARAM_ERROR)
|
|
||||||
|
|
||||||
- @responses.activate
|
|
||||||
- @mock.patch('builtins.open', mock.mock_open())
|
|
||||||
- @mock.patch.object(Collect, "get_system_info")
|
|
||||||
- def test_register_should_return_success_when_input_with_no_agent_port(self, mock_os_version):
|
|
||||||
- mock_os_version.return_value = "mock version"
|
|
||||||
- responses.add(responses.POST,
|
|
||||||
- 'http://127.0.0.1:11111/manage/host/add',
|
|
||||||
- json={"token": "hdahdahiudahud", "code": SUCCESS},
|
|
||||||
- status=SUCCESS,
|
|
||||||
- content_type='application/json'
|
|
||||||
- )
|
|
||||||
- input_data = {
|
|
||||||
- "web_username": "admin",
|
|
||||||
- "web_password": "changeme",
|
|
||||||
- "host_name": "host01",
|
|
||||||
- "host_group_name": "2333",
|
|
||||||
- "management": False,
|
|
||||||
- "manager_ip": "127.0.0.1",
|
|
||||||
- "manager_port": "11111",
|
|
||||||
- }
|
|
||||||
- data = register(input_data)
|
|
||||||
- self.assertEqual(SUCCESS, data)
|
|
||||||
-
|
|
||||||
def test_register_info_to_dict_should_return_dict_info_when_input_is_correct(self):
|
|
||||||
mock_string = '{"mock": "mock"}'
|
|
||||||
res = register_info_to_dict(mock_string)
|
|
||||||
diff --git a/setup.py b/setup.py
|
|
||||||
index a00a39f..645def0 100644
|
|
||||||
--- a/setup.py
|
|
||||||
+++ b/setup.py
|
|
||||||
@@ -14,8 +14,7 @@ INSTALL_REQUIRES = [
|
|
||||||
"libconf",
|
|
||||||
"connexion",
|
|
||||||
"swagger-ui-bundle>=0.0.2",
|
|
||||||
- "concurrent_log_handler",
|
|
||||||
- "responses"
|
|
||||||
+ "concurrent_log_handler"
|
|
||||||
]
|
|
||||||
|
|
||||||
setup(
|
|
||||||
--
|
|
||||||
2.37.1.windows.1
|
|
||||||
|
|
||||||
Binary file not shown.
BIN
aops-ceres-v1.1.0.tar.gz
Normal file
BIN
aops-ceres-v1.1.0.tar.gz
Normal file
Binary file not shown.
@ -1,12 +1,10 @@
|
|||||||
Name: aops-ceres
|
Name: aops-ceres
|
||||||
Version: v1.0.0
|
Version: v1.1.0
|
||||||
Release: 3
|
Release: 1
|
||||||
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.
|
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
|
License: MulanPSL2
|
||||||
URL: https://gitee.com/openeuler/%{name}
|
URL: https://gitee.com/openeuler/%{name}
|
||||||
Source0: %{name}-%{version}.tar.gz
|
Source0: %{name}-%{version}.tar.gz
|
||||||
Patch0001: 0001-add-field-os_version-for-register.patch
|
|
||||||
Patch0002: 0002-remove-test-case-about-register.patch
|
|
||||||
|
|
||||||
BuildRequires: python3-setuptools
|
BuildRequires: python3-setuptools
|
||||||
Requires: python3-requests python3-flask python3-connexion python3-configparser python3-jsonschema
|
Requires: python3-requests python3-flask python3-connexion python3-configparser python3-jsonschema
|
||||||
@ -21,7 +19,7 @@ An agent which needs to be adopted in client, it managers some plugins, such as
|
|||||||
|
|
||||||
|
|
||||||
%prep
|
%prep
|
||||||
%autosetup -n %{name}-%{version} -p1
|
%autosetup -n %{name}-%{version}
|
||||||
|
|
||||||
|
|
||||||
# build for aops-ceres
|
# build for aops-ceres
|
||||||
@ -42,6 +40,9 @@ An agent which needs to be adopted in client, it managers some plugins, such as
|
|||||||
|
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Fri Nov 25 2022 wenxin<shusheng.wen@outlook.com> - v1.1.0-1
|
||||||
|
- remove test cases that use the responses module
|
||||||
|
|
||||||
* Wed Nov 23 2022 wenxin<shusheng.wen@outlook.com> - v1.0.0-3
|
* Wed Nov 23 2022 wenxin<shusheng.wen@outlook.com> - v1.0.0-3
|
||||||
- remove test case: remove test case about register
|
- remove test case: remove test case about register
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user