!1 Add Aodh of version 9.0.1 for OpenStack Train support

From: @sean-lau
Reviewed-by: @xiyuanwang
Signed-off-by: @xiyuanwang
This commit is contained in:
openeuler-ci-bot 2021-11-09 11:17:39 +00:00 committed by Gitee
commit 06efc44b5f
9 changed files with 461 additions and 0 deletions

BIN
aodh-9.0.1.tar.gz Normal file

Binary file not shown.

4
aodh-dist.conf Normal file
View File

@ -0,0 +1,4 @@
[DEFAULT]
log_dir = /var/log/aodh
use_stderr = False

10
aodh.logrotate Normal file
View File

@ -0,0 +1,10 @@
compress
/var/log/aodh/*.log {
weekly
rotate 4
size 10M
missingok
compress
minsize 100k
}

View File

@ -0,0 +1,13 @@
[Unit]
Description=OpenStack Alarm API service
After=syslog.target network.target
[Service]
Type=simple
User=aodh
ExecStart=/usr/bin/aodh-api -- --logfile /var/log/aodh/api.log
Restart=on-failure
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,13 @@
[Unit]
Description=OpenStack Alarm evaluator service
After=syslog.target network.target
[Service]
Type=simple
User=aodh
ExecStart=/usr/bin/aodh-evaluator --logfile /var/log/aodh/evaluator.log
Restart=on-failure
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,13 @@
[Unit]
Description=OpenStack Alarm expirer service
After=syslog.target network.target
[Service]
Type=simple
User=aodh
ExecStart=/usr/bin/aodh-expirer --logfile /var/log/aodh/expirer.log
Restart=on-failure
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,13 @@
[Unit]
Description=OpenStack Alarm listener service
After=syslog.target network.target
[Service]
Type=simple
User=aodh
ExecStart=/usr/bin/aodh-listener --logfile /var/log/aodh/listener.log
Restart=on-failure
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,13 @@
[Unit]
Description=OpenStack Alarm notifier service
After=syslog.target network.target
[Service]
Type=simple
User=aodh
ExecStart=/usr/bin/aodh-notifier --logfile /var/log/aodh/notifier.log
Restart=on-failure
[Install]
WantedBy=multi-user.target

382
openstack-aodh.spec Normal file
View File

@ -0,0 +1,382 @@
%global service aodh
%global common_desc OpenStack %{service} provides API and services for managing alarms.
Name: openstack-%{service}
Version: 9.0.1
Release: 1
Summary: OpenStack Telemetry Alarming
License: ASL 2.0
URL: https://github.com/openstack/%{service}.git
Source0: https://tarballs.openstack.org/%{service}/%{service}-%{upstream_version}.tar.gz
Source1: %{service}-dist.conf
Source2: %{service}.logrotate
Source10: %{name}-api.service
Source11: %{name}-evaluator.service
Source12: %{name}-notifier.service
Source13: %{name}-expirer.service
Source14: %{name}-listener.service
BuildArch: noarch
BuildRequires: openstack-macros
BuildRequires: python3-setuptools
BuildRequires: python3-devel
BuildRequires: systemd
BuildRequires: python3-pbr
BuildRequires: python3-sphinx
BuildRequires: python3-cotyledon
# Required to compile translation files
BuildRequires: python3-babel
Requires: %{name}-api
Requires: %{name}-evaluator
Requires: %{name}-notifier
Requires: %{name}-expirer
Requires: %{name}-listener
%description
Aodh is the alarm engine of the Ceilometer project.
%package compat
Summary: OpenStack %{service} compat
Provides: openstack-ceilometer-alarm = %{version}-%{release}
Obsoletes: openstack-ceilometer-alarm < 1:6.0.0
Requires: python3-aodh
Requires: %{name}-common
Requires: %{name}-api
Requires: %{name}-evaluator
Requires: %{name}-notifier
Requires: %{name}-expirer
Requires: %{name}-listener
%description compat
This package only exists to help transition openstack-ceilometer-alarm users
to the new package split. It will be removed after one distribution release
cycle, please do not reference it or depend on it in any way.
%package -n python3-%{service}
Summary: OpenStack %{service} python libraries
Requires: python3-pytz
Requires: python3-croniter
Requires: python3-jsonschema
Requires: python3-alembic >= 0.7.2
Requires: python3-cachetools >= 1.1.6
Requires: python3-cotyledon
Requires: python3-futurist >= 0.11.0
Requires: python3-oslo-config >= 2.6.0
Requires: python3-oslo-db >= 4.16.0
Requires: python3-oslo-i18n >= 1.5.0
Requires: python3-oslo-log >= 1.2.0
Requires: python3-oslo-policy >= 0.5.0
Requires: python3-oslo-messaging >= 5.2.0
Requires: python3-oslo-middleware >= 3.22.0
Requires: python3-oslo-serialization >= 1.4.0
Requires: python3-oslo-service >= 0.1.0
Requires: python3-oslo-upgradecheck >= 0.1.1
Requires: python3-keystonemiddleware >= 2.2.0
Requires: python3-pbr
Requires: python3-pecan >= 0.8.0
Requires: python3-six >= 1.9.0
Requires: python3-stevedore >= 1.5.0
Requires: python3-sqlalchemy
Requires: python3-requests >= 2.5.2
Requires: python3-tenacity >= 3.2.1
Requires: python3-tooz >= 1.28.0
Requires: python3-webob
Requires: python3-wsme >= 0.8
Requires: python3-dateutil
Requires: python3-gnocchiclient >= 3.1.0
Requires: python3-keystoneclient >= 1.6.0
Requires: python3-heatclient >= 1.17.0
Requires: python3-keystoneauth1 >= 2.1
Requires: python3-octaviaclient
Requires: python3-debtcollector
Requires: python3-voluptuous >= 0.8.10
Requires: python3-pysnmp
Requires: python3-lxml
Requires: python3-paste-deploy
%description -n python3-%{service}
%{common_desc}
This package contains the %{service} python library.
%package common
Summary: Components common to all OpenStack %{service} services
# Config file generation
BuildRequires: python3-oslo-config >= 2.6.0
BuildRequires: python3-oslo-db
BuildRequires: python3-oslo-log
BuildRequires: python3-oslo-messaging
BuildRequires: python3-oslo-policy
BuildRequires: python3-oslo-reports
BuildRequires: python3-oslo-service
BuildRequires: python3-oslo-upgradecheck >= 0.1.1
BuildRequires: python3-oslo-vmware >= 0.6.0
BuildRequires: python3-glanceclient >= 2.0.0
BuildRequires: python3-heatclient
BuildRequires: python3-keystonemiddleware
BuildRequires: python3-neutronclient
BuildRequires: python3-novaclient >= 2.29.0
BuildRequires: python3-swiftclient
BuildRequires: python3-croniter
BuildRequires: python3-jsonpath-rw-ext
BuildRequires: python3-pecan >= 1.0.0
BuildRequires: python3-tooz
BuildRequires: python3-wsme >= 0.7
BuildRequires: python3-dateutil
BuildRequires: python3-gnocchiclient >= 3.1.0
BuildRequires: python3-octaviaclient
BuildRequires: python3-jsonpath-rw
BuildRequires: python3-lxml
Requires: python3-aodh = %{version}-%{release}
Requires: python3-oslo-utils >= 3.5.0
%{?systemd_requires}
Requires(pre): shadow-utils
%description common
%{common_desc}
%package api
Summary: OpenStack %{service} API
Requires: %{name}-common = %{version}-%{release}
%description api
%{common_desc}
This package contains the %{service} API service.
%package evaluator
Summary: OpenStack %{service} evaluator
Requires: %{name}-common = %{version}-%{release}
%description evaluator
%{common_desc}
This package contains the %{service} evaluator service.
%package notifier
Summary: OpenStack %{service} notifier
Requires: %{name}-common = %{version}-%{release}
%description notifier
%{common_desc}
This package contains the %{service} notifier service.
%package listener
Summary: OpenStack %{service} listener
Requires: %{name}-common = %{version}-%{release}
%description listener
%{common_desc}
This package contains the %{service} listener service.
%package expirer
Summary: OpenStack %{service} expirer
Requires: %{name}-common = %{version}-%{release}
%description expirer
%{common_desc}
This package contains the %{service} expirer service.
%package -n python3-%{service}-tests
Summary: Aodh tests
Requires: python3-aodh = %{version}-%{release}
Requires: python3-gabbi >= 1.30.0
%description -n python3-%{service}-tests
%{common_desc}
This package contains the %{service} test files.
%prep
%setup -q -n %{service}-%{upstream_version}
find . \( -name .gitignore -o -name .placeholder \) -delete
find %{service} -name \*.py -exec sed -i '/\/usr\/bin\/env python/{d;q}' {} +
sed -i '/setup_requires/d; /install_requires/d; /dependency_links/d' setup.py
# FIXME (jpena): Remove buggy PO-Revision-Date lines in translation
# See https://bugs.launchpad.net/openstack-i18n/+bug/1586041 for details
sed -i '/^\"PO-Revision-Date: \\n\"/d' %{service}/locale/*/LC_MESSAGES/*.po
%py_req_cleanup
%build
# Generate config file
PYTHONPATH=. oslo-config-generator-3 --config-file=%{service}/cmd/%{service}-config-generator.conf --output-file=%{service}/%{service}.conf
%{py3_build}
# Generate i18n files
%{__python3} setup.py compile_catalog -d build/lib/%{service}/locale
# Programmatically update defaults in sample config
# which is installed at /etc/aodh/aodh.conf
# TODO: Make this more robust
# Note it only edits the first occurrence, so assumes a section ordering in sample
# and also doesn't support multi-valued variables.
while read name eq value; do
test "$name" && test "$value" || continue
sed -i "0,/^# *$name=/{s!^# *$name=.*!#$name=$value!}" %{service}/%{service}.conf
done < %{SOURCE1}
%install
%{py3_install}
# Install config files
install -d -m 755 %{buildroot}%{_sysconfdir}/%{service}
install -p -D -m 640 %{SOURCE1} %{buildroot}%{_datadir}/%{service}/%{service}-dist.conf
install -p -D -m 640 %{service}/%{service}.conf %{buildroot}%{_sysconfdir}/%{service}/%{service}.conf
# Setup directories
install -d -m 755 %{buildroot}%{_sharedstatedir}/%{service}
install -d -m 755 %{buildroot}%{_sharedstatedir}/%{service}/tmp
install -d -m 750 %{buildroot}%{_localstatedir}/log/%{service}
# Install logrotate
install -p -D -m 644 %{SOURCE2} %{buildroot}%{_sysconfdir}/logrotate.d/%{name}
# Install systemd unit services
install -p -D -m 644 %{SOURCE10} %{buildroot}%{_unitdir}/%{name}-api.service
install -p -D -m 644 %{SOURCE11} %{buildroot}%{_unitdir}/%{name}-evaluator.service
install -p -D -m 644 %{SOURCE12} %{buildroot}%{_unitdir}/%{name}-notifier.service
install -p -D -m 644 %{SOURCE13} %{buildroot}%{_unitdir}/%{name}-expirer.service
install -p -D -m 644 %{SOURCE14} %{buildroot}%{_unitdir}/%{name}-listener.service
# Install i18n .mo files (.po and .pot are not required)
install -d -m 755 %{buildroot}%{_datadir}
rm -f %{buildroot}%{python3_sitelib}/%{service}/locale/*/LC_*/%{service}*po
rm -f %{buildroot}%{python3_sitelib}/%{service}/locale/*pot
mv %{buildroot}%{python3_sitelib}/%{service}/locale %{buildroot}%{_datadir}/locale
# Find language files
%find_lang %{service} --all-name
# Remove unused files
rm -fr %{buildroot}/usr/etc
%pre common
getent group %{service} >/dev/null || groupadd -r %{service}
if ! getent passwd %{service} >/dev/null; then
useradd -r -g %{service} -G %{service} -d %{_sharedstatedir}/%{service} -s /sbin/nologin -c "OpenStack %{service} Daemons" %{service}
fi
exit 0
%post -n %{name}-api
%systemd_post %{name}-api.service
%preun -n %{name}-api
%systemd_preun %{name}-api.service
%post -n %{name}-evaluator
%systemd_post %{name}-evaluator.service
%preun -n %{name}-evaluator
%systemd_preun %{name}-evaluator.service
%post -n %{name}-notifier
%systemd_post %{name}-notifier.service
%preun -n %{name}-notifier
%systemd_preun %{name}-notifier.service
%post -n %{name}-listener
%systemd_post %{name}-listener.service
%preun -n %{name}-listener
%systemd_preun %{name}-listener.service
%post -n %{name}-expirer
%systemd_post %{name}-expirer.service
%preun -n %{name}-expirer
%systemd_preun %{name}-expirer.service
%files compat
# empty files`
%files -n python3-%{service}
%{python3_sitelib}/%{service}
%{python3_sitelib}/%{service}-*.egg-info
%license LICENSE
%exclude %{python3_sitelib}/%{service}/tests
%files -n python3-%{service}-tests
%license LICENSE
%{python3_sitelib}/%{service}/tests
%files common -f %{service}.lang
%doc README.rst
%dir %{_sysconfdir}/%{service}
%attr(-, root, %{service}) %{_datadir}/%{service}/%{service}-dist.conf
%config(noreplace) %attr(-, root, %{service}) %{_sysconfdir}/%{service}/%{service}.conf
%config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
%dir %attr(0750, %{service}, root) %{_localstatedir}/log/%{service}
%{_bindir}/%{service}-dbsync
%{_bindir}/%{service}-config-generator
%{_bindir}/%{service}-status
%defattr(-, %{service}, %{service}, -)
%dir %{_sharedstatedir}/%{service}
%dir %{_sharedstatedir}/%{service}/tmp
%files api
%{_bindir}/%{service}-api
%{_unitdir}/%{name}-api.service
%files evaluator
%{_bindir}/%{service}-evaluator
%{_unitdir}/%{name}-evaluator.service
%files notifier
%{_bindir}/%{service}-notifier
%{_unitdir}/%{name}-notifier.service
%files listener
%{_bindir}/%{service}-listener
%{_unitdir}/%{name}-listener.service
%files expirer
%{_bindir}/%{service}-expirer
%{_unitdir}/%{name}-expirer.service
%changelog
* Fri Nov 05 2021 liusheng <liusheng2048@gmail.com> - 9.0.1-1
- Add openstack-aodh package of version 9.0.1