diff --git a/0001-fix-text-file-sync-bug.patch b/0001-fix-text-file-sync-bug.patch deleted file mode 100644 index 0ee7023..0000000 --- a/0001-fix-text-file-sync-bug.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 4f0811635664dcc34d8f556d17bb63b5c72ed1a9 Mon Sep 17 00:00:00 2001 -From: smjiao -Date: Tue, 7 Nov 2023 18:26:49 +0800 -Subject: [PATCH] fix text file sync bug - ---- - ragdoll/config_model/text_config.py | 6 ++++-- - 1 file changed, 4 insertions(+), 2 deletions(-) - -diff --git a/ragdoll/config_model/text_config.py b/ragdoll/config_model/text_config.py -index 98d8fd1..dadd915 100644 ---- a/ragdoll/config_model/text_config.py -+++ b/ragdoll/config_model/text_config.py -@@ -41,6 +41,8 @@ class TextConfig(BaseHandlerConfig): - - def write_conf(self): - content = "" -- for conf_list in self.conf: -- content += '\t'.join(conf_list) + '\n' -+ for value in self.conf: -+ if value is not None: -+ content = content + value + "\n" -+ content = content + '\n' - return content -\ No newline at end of file --- -2.38.1.windows.1 - diff --git a/0002-deal-request-connection-error.patch b/0002-deal-request-connection-error.patch deleted file mode 100644 index ffa2c59..0000000 --- a/0002-deal-request-connection-error.patch +++ /dev/null @@ -1,247 +0,0 @@ -From 8a9ec891ef23eef79766e2936a8ce5b1636b3f53 Mon Sep 17 00:00:00 2001 -From: smjiao -Date: Thu, 9 Nov 2023 09:33:23 +0800 -Subject: [PATCH] deal request connection error - ---- - ragdoll/controllers/format.py | 100 +++++++++++-------- - ragdoll/controllers/management_controller.py | 13 ++- - ragdoll/utils/object_parse.py | 13 ++- - 3 files changed, 78 insertions(+), 48 deletions(-) - -diff --git a/ragdoll/controllers/format.py b/ragdoll/controllers/format.py -index f0d2864..9676296 100644 ---- a/ragdoll/controllers/format.py -+++ b/ragdoll/controllers/format.py -@@ -28,7 +28,7 @@ class Format(object): - def domainCheck(domainName): - res = True - if not re.match(r"^[A-Za-z0-9_\.-]*$", domainName) or domainName == "" or len(domainName) > 255: -- res = False -+ res = False - return res - - @staticmethod -@@ -329,7 +329,14 @@ class Format(object): - get_real_conf_body["infos"] = get_real_conf_body_info - url = conf_tools.load_url_by_conf().get("collect_url") - headers = {"Content-Type": "application/json"} -- response = requests.post(url, data=json.dumps(get_real_conf_body), headers=headers) # post request -+ try: -+ response = requests.post(url, data=json.dumps(get_real_conf_body), headers=headers) # post request -+ except requests.exceptions.RequestException as connect_ex: -+ LOGGER.error(f"An error occurred: {connect_ex}") -+ codeNum = 500 -+ codeString = "Failed to obtain the actual configuration, please check the interface of config/collect." -+ base_rsp = BaseResponse(codeNum, codeString) -+ return base_rsp, codeNum - resp = json.loads(response.text).get("data") - resp_code = json.loads(response.text).get("code") - if (resp_code != "200") and (resp_code != "206"): -@@ -483,7 +490,6 @@ class Format(object): - sync_status = SyncStatus(domain_name=domain, - host_status=[]) - from ragdoll.utils.object_parse import ObjectParse -- directory_conf_is_synced = ConfIsSynced(file_path="", is_synced="", single_conf=[]) - - for d_real_conf in real_conf_res_text: - host_id = d_real_conf.host_id -@@ -491,6 +497,7 @@ class Format(object): - sync_status=[]) - d_real_conf_base = d_real_conf.conf_base_infos - for d_conf in d_real_conf_base: -+ directory_conf_is_synced = ConfIsSynced(file_path="", is_synced="", single_conf=[]) - d_conf_path = d_conf.file_path - - object_parse = ObjectParse() -@@ -500,15 +507,15 @@ class Format(object): - Format.deal_conf_sync_status(conf_model, d_conf, d_conf_path, directory_conf_is_synced, - host_sync_status, manage_confs) - -- if len(directory_conf_is_synced.single_conf) > 0: -- synced_flag = SYNCHRONIZED -- for single_config in directory_conf_is_synced.single_conf: -- if single_config.single_is_synced == SYNCHRONIZED: -- continue -- else: -- synced_flag = NOT_SYNCHRONIZE -- directory_conf_is_synced.is_synced = synced_flag -- host_sync_status.sync_status.append(directory_conf_is_synced) -+ if len(directory_conf_is_synced.single_conf) > 0: -+ synced_flag = SYNCHRONIZED -+ for single_config in directory_conf_is_synced.single_conf: -+ if single_config.single_is_synced == SYNCHRONIZED: -+ continue -+ else: -+ synced_flag = NOT_SYNCHRONIZE -+ directory_conf_is_synced.is_synced = synced_flag -+ host_sync_status.sync_status.append(directory_conf_is_synced) - sync_status.host_status.append(host_sync_status) - return sync_status - -@@ -516,37 +523,38 @@ class Format(object): - def deal_conf_sync_status(conf_model, d_conf, d_conf_path, directory_conf_is_synced, host_sync_status, - manage_confs): - comp_res = "" -- for dir_path in DIRECTORY_FILE_PATH_LIST: -- if str(d_conf_path).find(dir_path) == -1: -- for d_man_conf in manage_confs: -- if d_man_conf.get("file_path").split(":")[-1] != d_conf_path: -- continue -- comp_res = conf_model.conf_compare(d_man_conf.get("contents"), d_conf.conf_contens) -- conf_is_synced = ConfIsSynced(file_path=d_conf_path, -- is_synced=comp_res) -- host_sync_status.sync_status.append(conf_is_synced) -- else: -- directory_conf_is_synced.file_path = dir_path -- confContents = json.loads(d_conf.conf_contens) -- pam_conf_contents = "" -- for d_man_conf in manage_confs: -- d_man_conf_path = d_man_conf.get("file_path") -- if d_man_conf_path not in DIRECTORY_FILE_PATH_LIST: -- continue -- pam_conf_contents = d_man_conf.get("contents") -+ if d_conf_path in DIRECTORY_FILE_PATH_LIST: -+ confContents = json.loads(d_conf.conf_contens) -+ directory_conf_contents = "" -+ for d_man_conf in manage_confs: -+ d_man_conf_path = d_man_conf.get("file_path") -+ if d_man_conf_path != d_conf_path: -+ # if d_man_conf_path not in DIRECTORY_FILE_PATH_LIST: -+ continue -+ else: -+ directory_conf_is_synced.file_path = d_conf_path -+ directory_conf_contents = d_man_conf.get("contents") - -- pam_conf_contents_dict = json.loads(pam_conf_contents) -+ directory_conf_contents_dict = json.loads(directory_conf_contents) - -- for pam_conf_content_key, pam_conf_content_value in pam_conf_contents_dict.items(): -- if pam_conf_content_key not in confContents.keys(): -- single_conf = SingleConfig(single_file_path=pam_conf_content_key, -- single_is_synced=NOT_SYNCHRONIZE) -- directory_conf_is_synced.single_conf.append(single_conf) -- else: -- dst_conf = confContents.get(pam_conf_content_key) -- comp_res = conf_model.conf_compare(pam_conf_content_value, dst_conf) -- single_conf = SingleConfig(single_file_path=d_conf_path, single_is_synced=comp_res) -- directory_conf_is_synced.single_conf.append(single_conf) -+ for dir_conf_content_key, dir_conf_content_value in directory_conf_contents_dict.items(): -+ if dir_conf_content_key not in confContents.keys(): -+ single_conf = SingleConfig(single_file_path=dir_conf_content_key, -+ single_is_synced=NOT_SYNCHRONIZE) -+ directory_conf_is_synced.single_conf.append(single_conf) -+ else: -+ dst_conf = confContents.get(dir_conf_content_key) -+ comp_res = conf_model.conf_compare(dir_conf_content_value, dst_conf) -+ single_conf = SingleConfig(single_file_path=dir_conf_content_key, single_is_synced=comp_res) -+ directory_conf_is_synced.single_conf.append(single_conf) -+ else: -+ for d_man_conf in manage_confs: -+ if d_man_conf.get("file_path").split(":")[-1] != d_conf_path: -+ continue -+ comp_res = conf_model.conf_compare(d_man_conf.get("contents"), d_conf.conf_contens) -+ conf_is_synced = ConfIsSynced(file_path=d_conf_path, -+ is_synced=comp_res) -+ host_sync_status.sync_status.append(conf_is_synced) - - @staticmethod - def get_conf_type_model(d_conf_path, object_parse): -@@ -569,8 +577,14 @@ class Format(object): - content = object_parse.parse_json_to_conf(directory_file_path, directory_content) - # Configuration to the host - data = {"host_id": host_id, "file_path": directory_file_path, "content": content} -- sync_response = requests.put(sync_conf_url, data=json.dumps(data), headers=headers) -- -+ try: -+ sync_response = requests.put(sync_conf_url, data=json.dumps(data), headers=headers) -+ except requests.exceptions.RequestException as connect_ex: -+ LOGGER.error(f"An error occurred: {connect_ex}") -+ codeNum = 500 -+ codeString = "Failed to sync configuration, please check the interface of config/sync." -+ base_rsp = BaseResponse(codeNum, codeString) -+ return base_rsp, codeNum - resp_code = json.loads(sync_response.text).get('code') - resp = json.loads(sync_response.text).get('data').get('resp') - -diff --git a/ragdoll/controllers/management_controller.py b/ragdoll/controllers/management_controller.py -index 7ec6e50..101802a 100644 ---- a/ragdoll/controllers/management_controller.py -+++ b/ragdoll/controllers/management_controller.py -@@ -116,7 +116,7 @@ def add_management_confs_in_domain(body=None): # noqa: E501 - if d_conf.file_path not in DIRECTORY_FILE_PATH_LIST: - exist_host[host_id].append(d_conf.file_path) - else: -- codeNum, codeString, file_paths = object_parse.get_pam_files(d_conf, host_id) -+ codeNum, codeString, file_paths = object_parse.get_directory_files(d_conf, host_id) - if len(file_paths) == 0: - base_rsp = BaseResponse(codeNum, codeString) - return base_rsp, codeNum -@@ -129,7 +129,7 @@ def add_management_confs_in_domain(body=None): # noqa: E501 - conf_list.append(d_conf.file_path) - exist_host[host_id] = conf_list - else: -- codeNum, codeString, file_paths = object_parse.get_pam_files(d_conf, host_id) -+ codeNum, codeString, file_paths = object_parse.get_directory_files(d_conf, host_id) - if len(file_paths) == 0: - base_rsp = BaseResponse(codeNum, codeString) - return base_rsp, codeNum -@@ -146,7 +146,14 @@ def add_management_confs_in_domain(body=None): # noqa: E501 - - url = conf_tools.load_url_by_conf().get("collect_url") - headers = {"Content-Type": "application/json"} -- response = requests.post(url, data=json.dumps(get_real_conf_body), headers=headers) # post request -+ try: -+ response = requests.post(url, data=json.dumps(get_real_conf_body), headers=headers) # post request -+ except requests.exceptions.RequestException as connect_ex: -+ LOGGER.error(f"An error occurred: {connect_ex}") -+ codeNum = 500 -+ codeString = "Failed to obtain the actual configuration, please check the interface of config/collect." -+ base_rsp = BaseResponse(codeNum, codeString) -+ return base_rsp, codeNum - - response_code = json.loads(response.text).get("code") - if response_code == None: -diff --git a/ragdoll/utils/object_parse.py b/ragdoll/utils/object_parse.py -index d3c31ae..6cc4564 100644 ---- a/ragdoll/utils/object_parse.py -+++ b/ragdoll/utils/object_parse.py -@@ -14,8 +14,10 @@ import importlib - import requests - - from ragdoll.const.conf_handler_const import DIRECTORY_FILE_PATH_LIST -+from ragdoll.models import BaseResponse - from ragdoll.utils.conf_tools import ConfTools - from ragdoll.utils.yang_module import YangModule -+from ragdoll.log.log import LOGGER - - BASE_PATH = "ragdoll.config_model." - CONFIG_MODEL_NAME = "Config" -@@ -172,7 +174,7 @@ class ObjectParse(object): - - return conf_info - -- def get_pam_files(self, d_conf, host_id): -+ def get_directory_files(self, d_conf, host_id): - file_paths = list() - conf_tools = ConfTools() - file_directory = dict() -@@ -180,7 +182,14 @@ class ObjectParse(object): - file_directory['host_id'] = host_id - url = conf_tools.load_url_by_conf().get("object_file_url") - headers = {"Content-Type": "application/json"} -- response = requests.post(url, data=json.dumps(file_directory), headers=headers) -+ try: -+ response = requests.post(url, data=json.dumps(file_directory), headers=headers) -+ except requests.exceptions.RequestException as connect_ex: -+ LOGGER.error(f"An error occurred: {connect_ex}") -+ codeNum = 500 -+ codeString = "Failed to sync configuration, please check the interface of config/objectfile." -+ base_rsp = BaseResponse(codeNum, codeString) -+ return base_rsp, codeNum - response_code = json.loads(response.text).get("code") - if response_code == None: - codeNum = 500 --- -2.38.1.windows.1 - diff --git a/gala-ragdoll-v1.4.1.tar.gz b/gala-ragdoll-v1.4.1.tar.gz deleted file mode 100644 index 6d7a45b..0000000 Binary files a/gala-ragdoll-v1.4.1.tar.gz and /dev/null differ diff --git a/gala-ragdoll-v2.1.0.tar.gz b/gala-ragdoll-v2.1.0.tar.gz new file mode 100644 index 0000000..821f7c2 Binary files /dev/null and b/gala-ragdoll-v2.1.0.tar.gz differ diff --git a/gala-ragdoll.spec b/gala-ragdoll.spec index 5959e27..84e6f9d 100644 --- a/gala-ragdoll.spec +++ b/gala-ragdoll.spec @@ -1,75 +1,60 @@ Name: gala-ragdoll -Version: v1.4.1 -Release: 3 +Version: v2.1.0 +Release: 1 Summary: Configuration traceability License: MulanPSL2 URL: https://gitee.com/openeuler/%{name} Source0: %{name}-%{version}.tar.gz -Patch0001: 0001-fix-text-file-sync-bug.patch -Patch0002: 0002-deal-request-connection-error.patch %global debug_package %{nil} -BuildRequires: python3-setuptools python3-connexion python3-werkzeug python3-libyang +BuildRequires: python3-setuptools python3-werkzeug python3-libyang BuildRequires: git python3-devel systemd python3-concurrent-log-handler -Requires: python3-gala-ragdoll = %{version}-%{release} python3-concurrent-log-handler +Requires: aops-vulcanus >= v2.0.0 +Requires: python3-gala-ragdoll = %{version}-%{release} python3-concurrent-log-handler ansible +Provides: gala-ragdoll %description An os-level configuration management service - - %package -n python3-gala-ragdoll Summary: python3 pakcage of gala-ragdoll Requires: python3-flask-testing python3-libyang git -Requires: python3-werkzeug python3-connexion python3-swagger-ui-bundle +Requires: python3-werkzeug python3-swagger-ui-bundle %description -n python3-gala-ragdoll python3 pakcage of gala-ragdoll %prep -%autosetup -n %{name}-%{version} -p1 +%autosetup -n %{name}-%{version} -%build #build for gala-ragdoll %py3_build -%install #install for gala-ragdoll %py3_install install yang_modules/*.yang %{buildroot}/%{python3_sitelib}/yang_modules/ -mkdir -p %{buildroot}/%{_sysconfdir}/ragdoll -install config/*.conf %{buildroot}/%{_sysconfdir}/ragdoll/ -mkdir %{buildroot}/%{python3_sitelib}/ragdoll/config -install config/*.conf %{buildroot}/%{python3_sitelib}/ragdoll/config -mkdir -p %{buildroot}/%{_prefix}/lib/systemd/system -install service/gala-ragdoll.service %{buildroot}/%{_prefix}/lib/systemd/system +mkdir -p %{buildroot}/opt/aops/database/ +cp ragdoll/database/*.sql %{buildroot}/opt/aops/database/ +cp -r ansible_task %{buildroot}/opt/aops/ +mkdir -p %{buildroot}/etc/aops/conf.d +install ragdoll.yml %{buildroot}/etc/aops/conf.d +install ragdoll_crontab.yml %{buildroot}/etc/aops/ -%pre -if [ -f "%{systemd_dir}/gala-ragdoll.service" ] ; then - systemctl enable gala-ragdoll.service || : -fi - -%post -%systemd_post gala-ragdoll.service - -%preun -%systemd_preun gala-ragdoll.service - -%postun -%systemd_postun gala-ragdoll.service - - -%files +%files %doc doc/* %license LICENSE -/%{_sysconfdir}/ragdoll/gala-ragdoll.conf -%{_bindir}/ragdoll -%{_prefix}/lib/systemd/system/gala-ragdoll.service +%attr(0644,root,root) %{_sysconfdir}/aops/conf.d/ragdoll.yml +%attr(0755,root,root) %{_unitdir}/gala-ragdoll.service +%attr(0755, root, root) /opt/aops/ansible_task/* +%attr(0644,root,root) %{_sysconfdir}/aops/ragdoll_crontab.yml +%attr(0755, root, root) /opt/aops/database/* +%{python3_sitelib}/ragdoll-*.egg-info/* +%{python3_sitelib}/ragdoll/* %files -n python3-gala-ragdoll @@ -79,11 +64,142 @@ fi %changelog -* Thu Nov 9 2023 smjiao - v1.4.1-3 -- deal request connection error +* Tue Nov 19 2024 luxuexian - v2.1.0-1 +- init 24.03-lts-sp1 branch +- set uwsgi buffer-size -* Wed Nov 8 2023 smjiao - v1.4.1-2 -- fix text file sync bug +* Thu Sep 5 2024 smjiao - v2.0.0-2 +- update sync interface request method -* Wed Oct 25 2023 zhangdaolong - v1.4.1-1 -- gala-ragdoll src init +* Tue May 28 2024 smjiao - v2.0.0-1 +- support signature verification +- unified management and control of the configuration center + +* Mon Apr 17 2023 wenxin - v1.3.0-3 +- update the host id validate method for ragdoll + +* Tue Feb 28 2023 zhuyuncheng - v1.3.0-2 +- remove packages which have moved to new repositories. + +* Mon Sep 26 2022 zhuyuncheng - v1.3.0-1 +- update delete host return message +- update add domain return message + +* Wed Sep 14 2022 zhuyuncheng - v1.2.6-1 +- move aops-basedatabase to aops-tools +- rename default scene from 'unknown' to 'normal' + +* Tue Sep 13 2022 zhaoyuxing - v1.2.5-4 +- bug fix: start gala-ragdoll.service when install gala-ragdoll. + +* Fri Sep 9 2022 zhuyuncheng - v1.2.5-3 +- bug fix: add create time attribute of workflow, fix assign model bug of aops-check default mode +- update agent get host info interface and some test cases +- fix gala-ragdoll return code issue +- web fine-tuning for workflow and agent info. + +* Wed Sep 7 2022 zhaoyuxing - v1.2.5-2 +- bug fix: adjust dependent packages for gala-ragdoll. + +* Tue Sep 6 2022 zhuyuncheng - v1.2.5-1 +- bug fix: bugfix of aops-web and aops-check's interaction + +* Fri Sep 2 2022 zhuyuncheng - v1.2.4-1 +- add default mode of aops-check, which can run independently. + +* Mon Aug 29 2022 zhaoyuxing - v1.2.3-3 +- bug fix: gala-spider adapt to abnormal event format change. + +* Mon Aug 29 2022 zhaoyuxing - v1.2.3-2 +- bug fix: bugfix for gopher report metadata to kafka. + +* Sat Aug 27 2022 zhuyuncheng - v1.2.3-1 +- Add requires of aops-check for new features. + +* Tue Aug 23 2022 zhaoyuxing - v1.2.2-2 +- Set user modification of confs will not be overwrite for gala_spider. + +* Wed Aug 10 2022 zhuyuncheng - v1.2.2-1 +- New release 1.2.2, bug fix and add new module. +- add missed requirement python3-PyMySQL +- add new module, check and web + +* Wed Aug 10 2022 zhaoyuxing - v1.2.1-1 +- New release 1.2.1, bug fix. +- modify patch for gala-gopher and rm patch for gala-anteater. +- reduce the operating noise of gala-gopher. +- optimize the module of gala-anteater. + +* Tue Aug 2 2022 zhaoyuxing - v1.2.0-3 +- 1. add patch to modify install_requires of gala-anteater. +- 2. delete redundant dependent packages for gala-spider. + +* Mon Aug 1 2022 zhuyuncheng - v1.2.0-2 +- add base-database executable file into aops-manager to downlaod database. + +* Sun Jul 31 2022 zhaoyuxing - v1.2.0-1 +- modify spec for gala-gopher&gala-spider and add new features. +- 1. gala-gopher & gala-spider adapt to the latest code. +- 2. add new feature gala-anteater. +- add aops-agent module, delete aops-database, aops-cli, aops-web, + and four adoctor modules for new architecture. + +* Thu Sep 30 2021 chemingdao - v1.1.1-5 +- Using image source overwrite instead of patching image binaries. + +* Wed Sep 29 2021 chemingdao - v1.1.1-4 +- switch logo images and modify logo size. + +* Wed Sep 29 2021 orange-snn - v1.1.1-3 +- add permission control in ragdoll. + +* Wed Sep 29 2021 chemingdao - v1.1.1-2 +- fix log info of the task execution. + +* Sun Sep 26 2021 chemingdao - v1.1.1-1 +- New release 1.1.1, bug fix and new features. +- 1. Web issues fix: display fix and domain management modification. +- 2. Fix cli display issues and add loading bar of diag. +- 3. Fix return of gala-ragdoll. +- 4. Fix log level. +- 5. haproxy probe with vport info. + +* Sat Sep 18 2021 zhuyuncheng - v1.1.0-2 +- add missed file and better cli output + +* Fri Sep 17 2021 chemingdao - v1.1.0-1 +- New release 1.1.0, bug fix and UI beautify. +- 1. Simplify gala-spider UI display. +- 2. Beautify cli print with table and highlight json. +- 3. Bug fix: now support check with management host. +- 4. Modify elasticsearch and fluentd default config. + +* Thu Sep 16 2021 chemingdao - v1.0.3-1 +- NEW release 1.0.3. + +* Mon Sep 13 2021 chemingdao - v1.0.2-3 +- modify spec for aops-web build and fix some issues. + +* Sat Sep 11 2021 yangyunyi - v1.0.2-2 +- modify ansible playbook + +* Tue Sep 7 2021 zhaoyuxing - v1.0.2-1 +- add gala-spider in spec + +* Mon Sep 6 2021 Yiru Wang - v1.0.1-2 +- add web build modle of the aops + +* Mon Sep 6 2021 Lostwayzxc - v1.0.1-1 +- update src, add intelligent check and diagnosis module + +* Thu Sep 2 2021 zhaoyuxing - 1.0.0-4 +- add service file in gala-spider + +* Wed Sep 1 2021 orange-snn - 1.0.0-3 +- add service file in gala-ragdoll + +* Tue Aug 24 2021 zhu-yuncheng - 1.0.0-2 +- Update spec + +* Sat Jul 31 2021 orange-snn - 1.0.0-1 +- Package init