diff --git a/0001-update-requirements-and-move-default-task-to-config.patch b/0001-update-requirements-and-move-default-task-to-config.patch deleted file mode 100644 index 96e7d687aa0f76e3e488bced41ef1e430742d90a..0000000000000000000000000000000000000000 --- a/0001-update-requirements-and-move-default-task-to-config.patch +++ /dev/null @@ -1,202 +0,0 @@ -From 0172c9670be9657f28bc13ebfde26cc689e52a23 Mon Sep 17 00:00:00 2001 -From: gitee-cmd -Date: Tue, 31 Aug 2021 22:58:46 +0800 -Subject: [PATCH] update requirements and move default task to config - ---- - A-Ops.spec | 1 + - aops-database/aops_database/conf/constant.py | 7 ------ - aops-database/aops_database/manage.py | 9 ++++++-- - aops-database/conf/default.json | 23 +++++++++++++++++++ - aops-database/setup.py | 3 ++- - .../ansible_runner/ansible_runner.py | 5 ++-- - aops-manager/setup.py | 2 +- - aops-utils/aops-utils | 6 ++--- - 8 files changed, 40 insertions(+), 16 deletions(-) - create mode 100644 aops-database/conf/default.json - -diff --git a/A-Ops.spec b/A-Ops.spec -index 42e14a7..5fc66f0 100644 ---- a/A-Ops.spec -+++ b/A-Ops.spec -@@ -188,6 +188,7 @@ popd - - %files -n aops-database - %attr(0644,root,root) %{_sysconfdir}/aops/database.ini -+%attr(0644,root,root) %{_sysconfdir}/aops/default.json - %attr(0755,root,root) %{_unitdir}/aops-database.service - %attr(0755,root,root) %{_bindir}/aops-database - %attr(0755,root,root) %{_bindir}/aops-basedatabase -diff --git a/aops-database/aops_database/conf/constant.py b/aops-database/aops_database/conf/constant.py -index e2e368d..08f78f9 100644 ---- a/aops-database/aops_database/conf/constant.py -+++ b/aops-database/aops_database/conf/constant.py -@@ -31,10 +31,3 @@ DIAG_TREE_INDEX = "diag_tree" - CHECK_RESULT_INDEX = "check_result" - CHECK_RULE_INDEX = "check_rule" - --DEFAULT_TASK_INFO = [{"task_id": "95c3e692ff3811ebbcd3a89d3a259eef", -- "task_name": "Default deployment", -- "username": "admin", -- "host_list": [{"host_name": "90.90.64.64", "host_id": "11111"}, -- {"host_name": "90.90.64.66", "host_id": "11111"}, -- {"host_name": "90.90.64.65", "host_id": "33333"}] -- }] -diff --git a/aops-database/aops_database/manage.py b/aops-database/aops_database/manage.py -index f097850..4873d03 100644 ---- a/aops-database/aops_database/manage.py -+++ b/aops-database/aops_database/manage.py -@@ -15,6 +15,7 @@ Time: - Author: - Description: Manager that start aops-database - """ -+import os - import sqlalchemy - - from aops_database.function.helper import create_tables, ENGINE, SESSION -@@ -22,12 +23,15 @@ from aops_database.factory.table import User - from aops_database.factory.mapping import MAPPINGS - from aops_database.proxy.deploy import DeployDatabase - from aops_database.proxy.account import UserDatabase --from aops_database.conf.constant import DEFAULT_TASK_INFO -+from aops_utils.conf.constant import BASE_CONFIG_PATH - from aops_utils.log.log import LOGGER - from aops_utils.restful.status import SUCCEED - from aops_utils.manage import init_app -+from aops_utils.readconfig import read_json_config_file - - -+DEFAULT_TASK_PATH = os.path.join(BASE_CONFIG_PATH, 'default.json') -+ - def init_user(): - """ - Initialize user, add a default user: admin -@@ -75,7 +79,8 @@ def init_es(): - "username": "", - "task_list": [""] - } -- for default_task in DEFAULT_TASK_INFO: -+ task_info = read_json_config_file(DEFAULT_TASK_PATH) -+ for default_task in task_info['tasks']: - data["username"] = default_task["username"] - data["task_list"][0] = default_task["task_id"] - task_name = default_task["task_name"] -diff --git a/aops-database/conf/default.json b/aops-database/conf/default.json -new file mode 100644 -index 0000000..3b53633 ---- /dev/null -+++ b/aops-database/conf/default.json -@@ -0,0 +1,23 @@ -+{ -+ "tasks": [ -+ { -+ "task_id": "95c3e692ff3811ebbcd3a89d3a259eef", -+ "task_name": "Default deployment", -+ "username": "admin", -+ "host_list": [ -+ { -+ "host_name": "90.90.64.64", -+ "host_id": "11111" -+ }, -+ { -+ "host_name": "90.90.64.66", -+ "host_id": "11111" -+ }, -+ { -+ "host_name": "90.90.64.65", -+ "host_id": "33333" -+ } -+ ] -+ } -+ ] -+} -\ No newline at end of file -diff --git a/aops-database/setup.py b/aops-database/setup.py -index 7104fca..1083ad7 100644 ---- a/aops-database/setup.py -+++ b/aops-database/setup.py -@@ -11,6 +11,7 @@ setup( - install_requires=[ - 'SQLAlchemy', - 'elasticsearch>=7', -+ 'PyMySQL', - 'Werkzeug', - 'urllib3', - 'Flask', -@@ -20,7 +21,7 @@ setup( - ], - author='cmd-lsw-yyy-zyc', - data_files=[ -- ('/etc/aops', ['conf/database.ini']), -+ ('/etc/aops', ['conf/database.ini','conf/default.json']), - ('/usr/lib/systemd/system', ['aops-database.service']), - ], - scripts=['aops-basedatabase', 'aops-database'], -diff --git a/aops-manager/aops_manager/deploy_manager/ansible_runner/ansible_runner.py b/aops-manager/aops_manager/deploy_manager/ansible_runner/ansible_runner.py -index 254032b..7f93287 100644 ---- a/aops-manager/aops_manager/deploy_manager/ansible_runner/ansible_runner.py -+++ b/aops-manager/aops_manager/deploy_manager/ansible_runner/ansible_runner.py -@@ -258,8 +258,6 @@ class ResultCallback(CallbackBase): - """ - host_name = result._host.get_name() - result_info = result._result -- self.host_failed[host_name] = {"task_name": result.task_name, -- "result": result_info} - - LOGGER.debug('==============v2_runner_on_failed=========' - '[task:%s]=========[host:%s]==============', -@@ -274,6 +272,9 @@ class ResultCallback(CallbackBase): - LOGGER.debug("%s | FAILED! => %s", host_name, result_info) - if ignore_errors: - LOGGER.info("... ignoring") -+ else: -+ self.host_failed[host_name] = {"task_name": result.task_name, -+ "result": result_info} - - def v2_runner_on_unreachable(self, result): - """ -diff --git a/aops-manager/setup.py b/aops-manager/setup.py -index 50ff633..668a6a7 100644 ---- a/aops-manager/setup.py -+++ b/aops-manager/setup.py -@@ -11,7 +11,7 @@ setup( - version='1.0.0', - packages=find_packages(), - install_requires=[ -- 'ansible>=2.9.24', -+ 'ansible>=2.9.0', - 'PyYAML', - 'marshmallow>=3.13.0', - 'Flask', -diff --git a/aops-utils/aops-utils b/aops-utils/aops-utils -index 5bf1aae..e06e4c3 100644 ---- a/aops-utils/aops-utils -+++ b/aops-utils/aops-utils -@@ -37,7 +37,7 @@ function create_config_file() { - wsgi_file_name=$(get_config "${config_file}" "uwsgi" "wsgi-file") - wsgi_file=$(find /usr/lib -name "aops_"${service_type} | head -n 1) - daemonize=$(get_config "${config_file}" "uwsgi" "daemonize") -- http-timeout=$(get_config "${config_file}" "uwsgi" "http-timeout") -+ http_timeout=$(get_config "${config_file}" "uwsgi" "http-timeout") - harakiri=$(get_config "${config_file}" "uwsgi" "harakiri") - module_name="aops-"${service_type} - module="aops_"${service_type} -@@ -62,7 +62,7 @@ module=${module}.manage - uwsgi-file=${wsgi_file_name} - pidfile=$OUT_PATH/${module_name}.pid - callable=app --http-timeout=${http-timeout} -+http-timeout=${http_timeout} - harakiri=${harakiri} - daemonize=$daemonize" >"$OUT_PATH"/"${module_name}".ini - chown root: $OUT_PATH/"${module_name}".ini -@@ -108,4 +108,4 @@ function start_or_stop_service() { - elif [ "${OPERATION}" = "stop" ]; then - stop_service $1 - fi --} -\ No newline at end of file -+} --- -2.30.0 - diff --git a/a-ops-1.0.0.tar.gz b/A-Ops-v1.0.1.tar.gz similarity index 45% rename from a-ops-1.0.0.tar.gz rename to A-Ops-v1.0.1.tar.gz index 507d31d1c8b1f96f2562612fbd88231546dba3a7..94b929c221442e57d4299aa44ac6027f07eb1bee 100644 Binary files a/a-ops-1.0.0.tar.gz and b/A-Ops-v1.0.1.tar.gz differ diff --git a/A-Ops.spec b/A-Ops.spec index 48ffa40dedd9356edeea64a229527ecfb677724e..30a9bf3d574eee93649d418b4f0f249ecc1d3305 100644 --- a/A-Ops.spec +++ b/A-Ops.spec @@ -1,24 +1,26 @@ Name: A-Ops -Version: 1.0.0 -Release: 2 +Version: 1.0.1 +Release: 1 Summary: The intelligent ops toolkit for openEuler -License: MulanPSL-2.0 +License: MulanPSL2 URL: https://gitee.com/openeuler/A-Ops -Source0: a-ops-%{version}.tar.gz -patch0001: 0001-update-requirements-and-move-default-task-to-config.patch +Source0: %{name}-v%{version}.tar.gz -# build for aops basic module -BuildRequires: python3-setuptools -BuildRequires: python3-devel +# build for gopher +BuildRequires: cmake gcc-c++ yum elfutils-devel clang >= 10.0.1 llvm libconfig-devel +BuildRequires: librdkafka-devel libmicrohttpd-devel +# build for ragdoll & aops basic module +BuildRequires: python3-setuptools python3-connexion python3-werkzeug python3-libyang +BuildRequires: git python3-devel systemd %description The intelligent ops toolkit for openEuler %package -n aops-utils -Summary: utils for A-Ops +Summary: utils for A-Ops Requires: python3-concurrent-log-handler python3-xmltodict python3-pyyaml python3-marshmallow >= 3.13.0 Requires: python3-requests python3-xlrd @@ -36,10 +38,10 @@ host group management, task and template management of ansible. %package -n aops-manager -Summary: manager of A-ops -Requires: aops-utils = %{version}-%{release} ansible >= 2.9.0 +Summary: manager of A-ops +Requires: aops-utils = %{version}-%{release} ansible >= 2.9.0 Requires: python3-pyyaml python3-marshmallow >= 3.13.0 python3-flask python3-flask-restful -Requires: python3-requests sshpass +Requires: python3-requests sshpass python3-uWSGI %description -n aops-manager manager of A-ops, support software deployment and installation, account management, host management, @@ -47,19 +49,93 @@ host group management, task and template management of ansible. %package -n aops-database -Summary: database center of A-ops +Summary: database center of A-ops Requires: aops-utils = %{version}-%{release} python3-pyyaml Requires: python3-elasticsearch >= 7 python3-requests python3-werkzeug python3-urllib3 Requires: python3-flask python3-flask-restful python3-PyMySQL python3-sqlalchemy +Requires: python3-prometheus-api-client python3-uWSGI %description -n aops-database database center of A-ops, offer database proxy of mysql, elasticsearch and prometheus time series database. +%package -n adoctor-check-scheduler +Summary: scheduler of A-ops check module +Requires: aops-utils = %{version}-%{release} +Requires: python3-requests python3-flask python3-flask-restful python3-uWSGI python3-kafka-python +Requires: python3-marshmallow >= 3.13.0 python3-Flask-APScheduler >= 1.11.0 + +%description -n adoctor-check-scheduler +Exception detection and scheduling service. Provides an exception detection interface to +manage exception detection tasks. + + +%package -n adoctor-check-executor +Summary: executor of A-ops check module +Requires: aops-utils = %{version}-%{release} +Requires: python3-kafka-python python3-pyyaml python3-marshmallow >= 3.13.0 python3-requests +Requires: python3-ply >= 3.11 + +%description -n adoctor-check-executor +Performs an exception task based on the configured exception detection rule. + + +%package -n adoctor-diag-scheduler +Summary: scheduler of A-ops diag module +Requires: aops-utils = %{version}-%{release} +Requires: python3-requests python3-flask python3-flask-restful python3-uWSGI python3-kafka-python + +%description -n adoctor-diag-scheduler +Scheduler for diagnose module, provides restful interfaces to reply to requests about +importing/exporting diagnose tree, executing diagnose and so on. + + +%package -n adoctor-diag-executor +Summary: executor of A-ops check module +Requires: aops-utils = %{version}-%{release} +Requires: python3-kafka-python + +%description -n adoctor-diag-executor +Executor of diagnose module. Get messages from kafka and do the diagnose tasks. + + +%package -n adoctor-cli +Summary: command line tool of A-doctor +Requires: aops-utils = %{version}-%{release} + +%description -n adoctor-cli +commandline tool of adoctor, offer commands for executing diagnose, importing/exporting diagnose tree, +getting diagnose report, importing/exporting check rule, querying check result and so on. + + +%package -n gala-gopher +Summary: Intelligent ops toolkit for openEuler +Requires: bash glibc elfutils zlib iproute kernel >= 4.18.0-147.5.1.6 elfutils-devel + +%description -n gala-gopher +Intelligent ops toolkit for openEuler + + +%package -n gala-ragdoll +Summary: Configuration traceability + +%description -n gala-ragdoll +Configuration traceability + + +%package -n python3-gala-ragdoll +Summary: python3 pakcage of gala-ragdoll +Requires: gala-ragdoll = %{version}-%{release} python3-flask-testing python3-libyang git +Requires: python3-werkzeug python3-connexion python3-swagger-ui-bundle + +%description -n python3-gala-ragdoll +python3 pakcage of gala-ragdoll + + %define debug_package %{nil} %prep -%autosetup -n %{name}-v%{version}-1.oe1 -p1 +%autosetup -n %{name}-v%{version} %build @@ -83,6 +159,42 @@ pushd aops-database %py3_build popd +#build for adoctor-check-scheduler +pushd adoctor-check-scheduler +%py3_build +popd + +#build for adoctor-check-executor +pushd adoctor-check-executor +%py3_build +popd + +#build for adoctor-diag-scheduler +pushd adoctor-diag-scheduler +%py3_build +popd + +#build for adoctor-diag-executor +pushd adoctor-diag-executor +%py3_build +popd + +#build for adoctor-cli +pushd adoctor-cli +%py3_build +popd + + +#build for gala-gopher +pushd gala-gopher +sh build.sh package +popd + +#build for gala-ragdoll +pushd gala-ragdoll +%py3_build +popd + %install # install for utils @@ -109,9 +221,83 @@ pushd aops-database %py3_install popd +# install for adoctor-check-scheduler +pushd adoctor-check-scheduler +%py3_install +popd + +# install for adoctor-check-executor +pushd adoctor-check-executor +%py3_install +popd + +# install for adoctor-diag-scheduler +pushd adoctor-diag-scheduler +%py3_install +popd + +# install for adoctor-diag-executor +pushd adoctor-diag-executor +%py3_install +popd + +# install for adoctor-cli +pushd adoctor-cli +%py3_install +popd + + +#install for gala-gopher +pushd gala-gopher +install -d %{buildroot}/opt/gala-gopher +install -d %{buildroot}%{_bindir} +mkdir -p %{buildroot}/usr/lib/systemd/system +install -m 0600 service/gala-gopher.service %{buildroot}/usr/lib/systemd/system/gala-gopher.service +sh install.sh %{buildroot}%{_bindir} %{buildroot}/opt/gala-gopher +popd + +#install for gala-ragdoll +pushd 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 +popd + + +%post -n gala-gopher +%systemd_post gala-gopher.service + +%preun -n gala-gopher +%systemd_preun gala-gopher.service + +%postun -n gala-gopher +%systemd_postun_with_restart gala-gopher.service + + +%pre -n python3-gala-ragdoll +if [ -f "%{systemd_dir}/gala-ragdoll.service" ] ; then + systemctl enable gala-ragdoll.service || : +fi + +%post -n python3-gala-ragdoll +%systemd_post gala-ragdoll.service + +%preun -n python3-gala-ragdoll +%systemd_preun gala-ragdoll.service + +%postun -n python3-gala-ragdoll +%systemd_postun gala-ragdoll.service + + %files -n aops-utils %doc README.* +%attr(0644,root,root) %{_sysconfdir}/aops/system.ini %{python3_sitelib}/aops_utils*.egg-info %{python3_sitelib}/aops_utils/* %attr(0755,root,root) %{_bindir}/aops-utils @@ -119,7 +305,6 @@ popd %files -n aops-cli %attr(0755,root,root) %{_bindir}/aops -%attr(0644,root,root) %{_sysconfdir}/aops/system.ini %{python3_sitelib}/aops_cli*.egg-info %{python3_sitelib}/aops_cli/* @@ -142,9 +327,85 @@ popd %{python3_sitelib}/aops_database/* +%files -n adoctor-check-scheduler +%attr(0644,root,root) %{_sysconfdir}/aops/check_scheduler.ini +%attr(0755,root,root) %{_unitdir}/adoctor-check-scheduler.service +%attr(0755,root,root) %{_bindir}/adoctor-check-scheduler +%{python3_sitelib}/adoctor_check_scheduler*.egg-info +%{python3_sitelib}/adoctor_check_scheduler/* + + +%files -n adoctor-check-executor +%attr(0644,root,root) %{_sysconfdir}/aops/check_executor.ini +%attr(0644,root,root) %{_sysconfdir}/aops/check_rule_plugin.yml +%attr(0755,root,root) %{_unitdir}/adoctor-check-executor.service +%attr(0755,root,root) %{_bindir}/adoctor-check-executor +%{python3_sitelib}/adoctor_check_executor*.egg-info +%{python3_sitelib}/adoctor_check_executor/* + + +%files -n adoctor-diag-scheduler +%attr(0644,root,root) %{_sysconfdir}/aops/diag_scheduler.ini +%attr(0755,root,root) %{_unitdir}/adoctor-diag-scheduler.service +%attr(0755,root,root) %{_bindir}/adoctor-diag-scheduler +%{python3_sitelib}/adoctor_diag_scheduler*.egg-info +%{python3_sitelib}/adoctor_diag_scheduler/* + + +%files -n adoctor-diag-executor +%attr(0644,root,root) %{_sysconfdir}/aops/diag_executor.ini +%attr(0755,root,root) %{_unitdir}/adoctor-diag-executor.service +%attr(0755,root,root) %{_bindir}/adoctor-diag-executor +%{python3_sitelib}/adoctor_diag_executor*.egg-info +%{python3_sitelib}/adoctor_diag_executor/* + + +%files -n adoctor-cli +%attr(0755,root,root) %{_bindir}/adoctor +%{python3_sitelib}/adoctor_cli*.egg-info +%{python3_sitelib}/adoctor_cli/* + + +%files -n gala-gopher +%defattr(-,root,root) +%dir /opt/gala-gopher +%dir /opt/gala-gopher/extend_probes +%dir /opt/gala-gopher/meta +%{_bindir}/gala-gopher +%config(noreplace) /opt/gala-gopher/gala-gopher.conf +/opt/gala-gopher/extend_probes/* +/opt/gala-gopher/meta/* +/usr/lib/systemd/system/gala-gopher.service + + +%files -n gala-ragdoll +%doc gala-ragdoll/doc/* +%license gala-ragdoll/LICENSE +/%{_sysconfdir}/ragdoll/gala-ragdoll.conf +%{_bindir}/ragdoll +%{_prefix}/lib/systemd/system/gala-ragdoll.service + + +%files -n python3-gala-ragdoll +%{python3_sitelib}/ragdoll/* +%{python3_sitelib}/yang_modules +%{python3_sitelib}/ragdoll-*.egg-info + + + %changelog -* Tue 31 Aug 2021 che-mingdao - 1.0.0-2 -- Update requirements and move default task to config. - -* Fri 27 Aug 2021 zhu-yuncheng - 1.0.0-1 +* Mon Sep 6 2021 Lostwayzxc - 1.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 +