169 lines
5.2 KiB
Django/Jinja
169 lines
5.2 KiB
Django/Jinja
{% set pypi_name = 'monasca-notification' %}
|
|
{% set source = fetch_source('https://tarballs.openstack.org/monasca-notification/monasca-notification-master.tar.gz') %}
|
|
{% set upstream_version = upstream_version() %}
|
|
{% set rpm_release = '1' %}
|
|
|
|
%global sname monasca-notification
|
|
%define username monasca-notification
|
|
%define groupname monasca
|
|
%define notification_conf_dir %{_sysconfdir}/monasca/
|
|
%define notification_log_dir %{_localstatedir}/log/%{sname}
|
|
Name: {{ py2name() }}
|
|
Version: {{ py2rpmversion() }}
|
|
Release: {{ py2rpmrelease() }}
|
|
Summary: Notification engine sends notifications based on alarm transitions
|
|
License: {{ license('Apache-2.0') }}
|
|
Group: Development/Languages/Python
|
|
URL: https://wiki.openstack.org/wiki/Monasca
|
|
Source0: {{ source|basename }}
|
|
Source1: openstack-%{sname}.service
|
|
Source3: openstack-monasca-notification.logrotate
|
|
BuildRequires: fdupes
|
|
BuildRequires: openstack-macros
|
|
BuildRequires: {{ py2pkg('Jinja2') }}
|
|
BuildRequires: {{ py2pkg('SQLAlchemy') }}
|
|
BuildRequires: {{ py2pkg('keystoneauth1') }}
|
|
BuildRequires: {{ py2pkg('mock') }}
|
|
BuildRequires: {{ py2pkg('monasca-common') }}
|
|
BuildRequires: {{ py2pkg('monasca-statsd') }}
|
|
BuildRequires: {{ py2pkg('oslo.config') }}
|
|
BuildRequires: {{ py2pkg('oslo.log') }}
|
|
BuildRequires: {{ py2pkg('oslotest') }}
|
|
BuildRequires: {{ py2pkg('pbr') }}
|
|
BuildRequires: {{ py2pkg('requests') }}
|
|
BuildRequires: {{ py2pkg('six') }}
|
|
BuildRequires: {{ py2pkg('stestr') }}
|
|
Requires: logrotate
|
|
Requires: python-%{sname} = %{version}-%{release}
|
|
BuildArch: noarch
|
|
%if 0%{?suse_version}
|
|
BuildRequires: {{ py2pkg('jira') }}
|
|
BuildRequires: systemd-rpm-macros
|
|
Requires(pre): pwdutils
|
|
%else
|
|
BuildRequires: systemd
|
|
Requires(post): systemd
|
|
Requires(postun): systemd
|
|
Requires(preun): systemd
|
|
%endif
|
|
|
|
%description
|
|
This engine reads alarms from Kafka and then notifies the customer using
|
|
their configured notification method.
|
|
Multiple notification and retry engines can run in
|
|
parallel up to one per available Kafka partition. Zookeeper
|
|
is used to negotiate access to the Kafka partitions
|
|
whenever a new process joins or leaves the working set.
|
|
|
|
%package -n python-%{sname}
|
|
Summary: Python core module for monasca-notification
|
|
Group: Development/Languages/Python
|
|
Requires: {{ py2pkg('Jinja2') }}
|
|
Requires: {{ py2pkg('PyYAML') }}
|
|
Requires: {{ py2pkg('SQLAlchemy') }}
|
|
Requires: {{ py2pkg('debtcollector') }}
|
|
Requires: {{ py2pkg('keystoneauth1') }}
|
|
Requires: {{ py2pkg('monasca-common') }}
|
|
Requires: {{ py2pkg('monasca-statsd') }}
|
|
Requires: {{ py2pkg('oslo.config') }}
|
|
Requires: {{ py2pkg('oslo.log') }}
|
|
Requires: {{ py2pkg('requests') }}
|
|
Requires: {{ py2pkg('six') }}
|
|
|
|
%description -n python-%{sname}
|
|
This engine reads alarms from Kafka and then notifies the customer using
|
|
their configured notification method.
|
|
Multiple notification and retry engines can run in
|
|
parallel up to one per available Kafka partition. Zookeeper
|
|
is used to negotiate access to the Kafka partitions
|
|
whenever a new process joins or leaves the working set.
|
|
|
|
This package contains the core Python module of Monasca-notification
|
|
|
|
%prep
|
|
%autosetup -n %{sname}-{{ upstream_version }}
|
|
%py_req_cleanup
|
|
|
|
%build
|
|
%py2_build
|
|
# NOTE: RDO currenty does not have python-jira in the CI
|
|
%if 0%{?suse_version}
|
|
PYTHONPATH=. oslo-config-generator \
|
|
--config-file config-generator/notification.conf \
|
|
--output-file etc/monasca/notification.conf.sample
|
|
%endif
|
|
|
|
%install
|
|
%py2_install
|
|
|
|
## usr
|
|
install -d -m 755 %{buildroot}%{_sbindir}
|
|
|
|
## log dir
|
|
install -d -m 750 %{buildroot}%{notification_log_dir}
|
|
|
|
## logrotate
|
|
install -p -D -m 644 %{SOURCE3} %{buildroot}%{_sysconfdir}/logrotate.d/openstack-monasca-notification.logrotate
|
|
|
|
## etc
|
|
install -d -m 755 %{buildroot}%{notification_conf_dir}
|
|
%if 0%{?suse_version}
|
|
install -D -m 644 etc/monasca/notification.conf.sample %{buildroot}%{notification_conf_dir}/notification.conf
|
|
%endif
|
|
|
|
## system stuff
|
|
install -p -D -m 644 %{SOURCE1} %{buildroot}%{_unitdir}/%{name}.service
|
|
%if 0%{?suse_version}
|
|
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name}
|
|
%endif
|
|
|
|
%fdupes %{buildroot}%{python2_sitelib}
|
|
|
|
%check
|
|
# NOTE: RDO currenty does not have python-jira in the CI
|
|
%if 0%{?suse_version}
|
|
%{__python2} -m stestr.cli run
|
|
%endif
|
|
|
|
%pre
|
|
# create monasca group and monasca-notification user
|
|
%openstack_pre_user_group_create %{username} %{groupname}
|
|
|
|
%post
|
|
%systemd_post %{name}.service
|
|
|
|
%preun
|
|
%systemd_preun %{name}.service
|
|
|
|
%postun
|
|
%systemd_postun %{name}.service
|
|
|
|
if [ $1 -eq 0 ] ; then
|
|
getent passwd %{username} > /dev/null
|
|
if [ "$?" == "0" ] ; then
|
|
userdel %{username}
|
|
fi
|
|
fi
|
|
|
|
%files
|
|
%license LICENSE
|
|
%doc README.rst
|
|
%{_bindir}/monasca-notification
|
|
%{_unitdir}/%{name}.service
|
|
%dir %attr(-, root, %{groupname}) %{notification_conf_dir}
|
|
%if 0%{?suse_version}
|
|
%config(noreplace) %attr(640, root, %{groupname}) %{notification_conf_dir}/notification.conf
|
|
%endif
|
|
%config(noreplace) %{_sysconfdir}/logrotate.d/openstack-monasca-notification.logrotate
|
|
%dir %attr(750, %{username}, %{groupname}) %notification_log_dir
|
|
%if 0%{?suse_version}
|
|
%{_sbindir}/rc%{name}
|
|
%endif
|
|
|
|
%files -n python-monasca-notification
|
|
%license LICENSE
|
|
%{python2_sitelib}/monasca_notification
|
|
%{python2_sitelib}/*.egg-info
|
|
|
|
%changelog
|