File openstack-masakari-monitors.spec of Package openstack-masakari-monitors

#
# spec file for package openstack-masakari-monitors
#
# Copyright (c) 2020 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#


Name:           openstack-masakari-monitors
Version:        10.1.0~dev2
Release:        0
Summary:        Monitors for Virtual Machine High Availability (VMHA) service in OpenStack
License:        Apache-2.0
Group:          Development/Libraries
URL:            https://launchpad.net/masakari-monitors
# basename filter prevents OBS from downloading the source itself which would
# fetch from a stale cache hashed by non-changing URL.
Source0:        masakari-monitors-master.tar.gz
Source1:        openstack-masakari-hostmonitor.service
Source2:        openstack-masakari-instancemonitor.service
Source3:        openstack-masakari-processmonitor.service
Source4:        openstack-masakari-monitors.tmpfiles
Source5:        openstack-masakari-introspectiveinstancemonitor.service
BuildRequires:  openstack-macros
BuildRequires:  python3-eventlet
BuildRequires:  python3-keystoneauth1
BuildRequires:  python3-libvirt-python
BuildRequires:  python3-openstackclient
BuildRequires:  python3-openstacksdk
BuildRequires:  python3-oslo.concurrency
BuildRequires:  python3-oslo.config
BuildRequires:  python3-oslo.db
BuildRequires:  python3-oslo.i18n
BuildRequires:  python3-oslo.log
BuildRequires:  python3-oslo.middleware
BuildRequires:  python3-oslo.policy
BuildRequires:  python3-oslo.privsep
BuildRequires:  python3-oslo.service
Requires:       python3-masakari-monitors = %{version}-%{release}
BuildArch:      noarch
%if 0%{?suse_version}
BuildRequires:  systemd-rpm-macros
%{?systemd_requires}
%else
BuildRequires:  systemd
Requires(post): systemd
Requires(postun): systemd
Requires(preun): systemd
%endif

%description
Monitors for the Masakari service for Virtual Machine
High Availability (VMHA) service in OpenStack.

System package - %{name}

%package        doc
Summary:        Documentation for OpenStack Masakari Service
Group:          Development/Libraries
BuildRequires:  python3-Sphinx
BuildRequires:  python3-openstackdocstheme
BuildRequires:  python3-sphinxcontrib-httpdomain
BuildRequires:  python3-sphinxcontrib-pecanwsme

%description    doc
Monitors for the Masakari service for Virtual Machine
High Availability (VMHA) service in OpenStack.

This package contains the documentation.

%package -n     python3-masakari-monitors
Summary:        masakari-monitors Python libraries
Group:          Development/Libraries
Requires:       python3-Babel
Requires:       python3-jsonschema
Requires:       python3-keystoneauth1
Requires:       python3-openstacksdk
Requires:       python3-oslo.config
Requires:       python3-oslo.i18n
Requires:       python3-oslo.log
Requires:       python3-oslo.middleware
Requires:       python3-oslo.privsep
Requires:       python3-oslo.service
Requires:       python3-oslo.utils
Requires:       python3-pbr
Requires:       python3-six
Requires:       python3-stevedore

%description -n python3-masakari-monitors
Masakari is a service providing high availability for VMs in OpenStack.

This package contains the Python libraries for the monitoring components.

%package -n openstack-masakari-hostmonitor
Summary:        Host monitoring component of OpenStack Masakari service
Group:          Development/Libraries
Requires:       %{name} = %{version}-%{release}

%description -n openstack-masakari-hostmonitor
This component of the Masakari service for VM HA in OpenStack is
responsible for monitoring the health of nova-compute hypervisors.

%package -n openstack-masakari-instancemonitor
Summary:        Instance monitoring component of OpenStack Masakari service
Group:          Development/Libraries
Requires:       %{name} = %{version}-%{release}

%description -n openstack-masakari-instancemonitor
This component of the Masakari service for VM HA in OpenStack is
responsible for monitoring the health of individual VM instances.

%package -n openstack-masakari-introspectiveinstancemonitor
Summary:        Instance monitoring component of OpenStack Masakari service
Group:          Development/Libraries
Requires:       %{name} = %{version}-%{release}

%description -n openstack-masakari-introspectiveinstancemonitor
This component of the Masakari service for VM HA in OpenStack is
responsible for monitoring the health of individual VM instances.

%package -n openstack-masakari-processmonitor
Summary:        Process monitoring component of OpenStack Masakari service
Group:          Development/Libraries
Requires:       %{name} = %{version}-%{release}

%description -n openstack-masakari-processmonitor
This component of the Masakari service for VM HA in OpenStack is
responsible for monitoring the health of processes which need to stay
running in order for the compute plane to be functional and highly
available.

%prep
%autosetup -p1 -n masakari-monitors-10.1.0.dev2
%py_req_cleanup

%build
%{py3_build}
PYTHONPATH=. oslo-config-generator --config-file etc/masakarimonitors/masakarimonitors-config-generator.conf

PBR_VERSION=10.1.0.dev2 %sphinx_build -b html doc/source doc/build/html
# remove the sphinx-build leftovers
rm -rf doc/build/html/.{doctrees,buildinfo}

%install
%{py3_install}

mkdir -p %{buildroot}%{_sysconfdir}/masakarimonitors/
mkdir -p %{buildroot}%{_localstatedir}/log/masakari-monitors

#systemd unitfiles
install -p -D -m 644 %SOURCE1 %{buildroot}%{_unitdir}/openstack-masakari-hostmonitor.service
install -p -D -m 644 %SOURCE2 %{buildroot}%{_unitdir}/openstack-masakari-instancemonitor.service
install -p -D -m 644 %SOURCE3 %{buildroot}%{_unitdir}/openstack-masakari-processmonitor.service
install -p -D -m 644 %SOURCE5 %{buildroot}%{_unitdir}/openstack-masakari-introspectiveinstancemonitor.service

install -p -D -m 644 %SOURCE4 %{buildroot}/%{_tmpfilesdir}/openstack-masakari-monitors.conf

install -p -D -m 640 etc/masakarimonitors/masakarimonitors.conf.sample %{buildroot}%{_sysconfdir}/masakarimonitors/masakarimonitors.conf
install -p -D -m 640 etc/masakarimonitors/hostmonitor.conf.sample %{buildroot}%{_sysconfdir}/masakarimonitors/hostmonitor.conf
install -p -D -m 640 etc/masakarimonitors/processmonitor.conf.sample %{buildroot}%{_sysconfdir}/masakarimonitors/processmonitor.conf
install -p -D -m 640 etc/masakarimonitors/process_list.yaml.sample %{buildroot}%{_sysconfdir}/masakarimonitors/process_list.yaml
install -p -D -m 640 etc/masakarimonitors/proc.list.sample %{buildroot}%{_sysconfdir}/masakarimonitors/proc.list
chmod +x %{buildroot}%{_bindir}/masakari-*

%pre
%openstack_pre_user_group_create masakari masakari

%post
%tmpfiles_create %{_tmpfilesdir}/openstack-masakari-monitors.conf

%post -n openstack-masakari-hostmonitor
%systemd_post openstack-masakari-hostmonitor.service

%preun -n openstack-masakari-hostmonitor
%systemd_preun openstack-masakari-hostmonitor.service

%postun -n openstack-masakari-hostmonitor
%systemd_postun_with_restart openstack-masakari-hostmonitor.service

%post -n openstack-masakari-instancemonitor
%systemd_post openstack-masakari-instancemonitor.service

%preun -n openstack-masakari-instancemonitor
%systemd_preun openstack-masakari-instancemonitor.service

%postun -n openstack-masakari-instancemonitor
%systemd_postun_with_restart openstack-masakari-instancemonitor.service

%post -n openstack-masakari-processmonitor
%systemd_post openstack-masakari-processmonitor.service

%preun -n openstack-masakari-processmonitor
%systemd_preun openstack-masakari-processmonitor.service

%postun -n openstack-masakari-processmonitor
%systemd_postun_with_restart openstack-masakari-processmonitor.service

%files
%license LICENSE
%dir %{_sysconfdir}/masakarimonitors
%config(noreplace) %attr(-, masakari, masakari) %{_sysconfdir}/masakarimonitors/masakarimonitors.conf
%dir %attr(750, masakari, masakari) %{_localstatedir}/log/masakari-monitors
%_tmpfilesdir/openstack-masakari-monitors.conf

%files -n openstack-masakari-hostmonitor
%config(noreplace) %attr(-, masakari, masakari) %{_sysconfdir}/masakarimonitors/hostmonitor.conf
%{_bindir}/masakari-hostmonitor
%{_unitdir}/openstack-masakari-hostmonitor.service

%files -n openstack-masakari-instancemonitor
%{_bindir}/masakari-instancemonitor
%{_unitdir}/openstack-masakari-instancemonitor.service

%files -n openstack-masakari-introspectiveinstancemonitor
%{_bindir}/masakari-introspectiveinstancemonitor
%{_unitdir}/openstack-masakari-introspectiveinstancemonitor.service

%files -n openstack-masakari-processmonitor
%{_bindir}/masakari-processmonitor
%{_unitdir}/openstack-masakari-processmonitor.service
%config(noreplace) %attr(-, masakari, masakari) %{_sysconfdir}/masakarimonitors/processmonitor.conf
%config(noreplace) %attr(-, masakari, masakari) %{_sysconfdir}/masakarimonitors/process_list.yaml
%config(noreplace) %attr(-, masakari, masakari) %{_sysconfdir}/masakarimonitors/proc.list

%files doc
%license LICENSE
%doc doc/build/html

%files -n python3-masakari-monitors
%license LICENSE
%{python3_sitelib}/masakari*

%changelog