ef63c6
%global project freeipa
ef63c6
%global shortname healthcheck
ef63c6
%global longname ipa%{shortname}
ef63c6
%global debug_package %{nil}
ef63c6
%global python3dir %{_builddir}/python3-%{name}-%{version}-%{release}
ef63c6
%{!?python3_sitelib: %global python3_sitelib %(%{__python3} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
ef63c6
ef63c6
ef63c6
Name:           ipa-healthcheck
ef63c6
Version:        0.4
ef63c6
Release:        6%{?dist}
ef63c6
Summary:        Health check tool for IdM
ef63c6
BuildArch:      noarch
ef63c6
License:        GPLv3
ef63c6
URL:            https://github.com/%{project}/freeipa-healthcheck
ef63c6
Source0:        https://github.com/%{project}/%{name}/archive/%{version}.tar.gz#/%{project}-%{shortname}-%{version}.tar.gz
ef63c6
Source1:        %{longname}.conf
ef63c6
ef63c6
Patch0001:      0001-Remove-requirement-for-pytest-runner-since-PyPI-isn-.patch
ef63c6
Patch0002:	0002-Move-main-to-run_healthcheck-for-abstraction-purpose.patch
ef63c6
Patch0003:	0003-Abstract-ServiceCheck-to-not-be-IPA-specific.patch
ef63c6
Patch0004:	0004-Move-the-abstracted-plugin-runner-code-into-a-separa.patch
ef63c6
Patch0005:	0005-Convert-running-healthchecks-into-a-class-and-add-pr.patch
ef63c6
Patch0006:	0006-Move-config-object-from-plugins-to-registry.patch
ef63c6
ef63c6
Requires:       %{name}-core = %{version}-%{release}
ef63c6
Requires:       ipa-server
ef63c6
Requires:       python3-ipalib
ef63c6
Requires:       python3-ipaserver
ef63c6
# cronie-anacron provides anacron
ef63c6
Requires:       anacron
ef63c6
Requires:       logrotate
ef63c6
Requires(post): systemd-units
ef63c6
Requires:       %{name}-core = %{version}-%{release}
ef63c6
BuildRequires:  python3-devel
ef63c6
BuildRequires:  systemd-devel
ef63c6
%{?systemd_requires}
ef63c6
ef63c6
ef63c6
%description
ef63c6
The FreeIPA health check tool provides a set of checks to
ef63c6
proactively detect defects in a FreeIPA cluster.
ef63c6
ef63c6
%package -n %{name}-core
ef63c6
Summary: Core plugin system for healthcheck
ef63c6
# No Requires on %%{name} = %%{version}-%%{release} since this can be
ef63c6
# installed standalone
ef63c6
Conflicts: %{name} < 0.4
ef63c6
ef63c6
%description -n %{name}-core
ef63c6
Core files
ef63c6
ef63c6
ef63c6
%prep
ef63c6
%autosetup -p1 -n %{project}-%{shortname}-%{version}
ef63c6
ef63c6
ef63c6
%build
ef63c6
%py3_build
ef63c6
ef63c6
ef63c6
%install
ef63c6
%py3_install
ef63c6
ef63c6
mkdir -p %{buildroot}%{_sysconfdir}/%{longname}
ef63c6
install -m644 %{SOURCE1} %{buildroot}%{_sysconfdir}/%{longname}
ef63c6
ef63c6
mkdir -p %{buildroot}/%{_unitdir}
ef63c6
install -p -m644 %{_builddir}/%{project}-%{shortname}-%{version}/systemd/ipa-%{shortname}.service %{buildroot}%{_unitdir}
ef63c6
install -p -m644 %{_builddir}/%{project}-%{shortname}-%{version}/systemd/ipa-%{shortname}.timer %{buildroot}%{_unitdir}
ef63c6
ef63c6
mkdir -p %{buildroot}/%{_libexecdir}/ipa
ef63c6
install -p -m755 %{_builddir}/%{project}-%{shortname}-%{version}/systemd/ipa-%{shortname}.sh %{buildroot}%{_libexecdir}/ipa/
ef63c6
ef63c6
mkdir -p %{buildroot}%{_sysconfdir}/logrotate.d
ef63c6
install -p -m644 %{_builddir}/%{project}-%{shortname}-%{version}/logrotate/%{longname} %{buildroot}%{_sysconfdir}/logrotate.d
ef63c6
ef63c6
mkdir -p %{buildroot}/%{_localstatedir}/log/ipa/%{shortname}
ef63c6
ef63c6
mkdir -p %{buildroot}/%{_mandir}/man1
ef63c6
mkdir -p %{buildroot}/%{_mandir}/man5
ef63c6
install -p -m644 %{_builddir}/%{project}-%{shortname}-%{version}/man/man1/ipa-%{shortname}.1  %{buildroot}%{_mandir}/man1/
ef63c6
install -p -m644 %{_builddir}/%{project}-%{shortname}-%{version}/man/man5/%{longname}.conf.5  %{buildroot}%{_mandir}/man5/
ef63c6
ef63c6
(cd %{buildroot}/%{python3_sitelib}/ipahealthcheck && find . -type f  | \
ef63c6
    grep -v '^./core' | \
ef63c6
    grep -v 'opt-1' | \
ef63c6
    sed -e 's,\.py.*$,.*,g' | sort -u | \
ef63c6
    sed -e 's,\./,%%{python3_sitelib}/ipahealthcheck/,g' ) >healthcheck.list
ef63c6
ef63c6
%post
ef63c6
%systemd_post ipa-%{shortname}.service
ef63c6
ef63c6
ef63c6
%preun
ef63c6
%systemd_preun ipa-%{shortname}.service
ef63c6
ef63c6
ef63c6
%postun
ef63c6
%systemd_postun_with_restart ipa-%{shortname}.service
ef63c6
ef63c6
ef63c6
%files -f healthcheck.list
ef63c6
%{!?_licensedir:%global license %%doc}
ef63c6
%license COPYING
ef63c6
%doc README.md
ef63c6
%{_bindir}/ipa-%{shortname}
ef63c6
%dir %{_sysconfdir}/%{longname}
ef63c6
%dir %{_localstatedir}/log/ipa/%{shortname}
ef63c6
%config(noreplace) %{_sysconfdir}/%{longname}/%{longname}.conf
ef63c6
%config(noreplace) %{_sysconfdir}/logrotate.d/%{longname}
ef63c6
%{python3_sitelib}/%{longname}-%{version}-*.egg-info/
ef63c6
%{python3_sitelib}/%{longname}-%{version}-*-nspkg.pth
ef63c6
%{_unitdir}/*
ef63c6
%{_libexecdir}/*
ef63c6
%{_mandir}/man1/*
ef63c6
%{_mandir}/man5/*
ef63c6
ef63c6
%files -n %{name}-core
ef63c6
%{!?_licensedir:%global license %%doc}
ef63c6
%license COPYING
ef63c6
%doc README.md
ef63c6
%{python3_sitelib}/%{longname}/core/
ef63c6
ef63c6
ef63c6
%changelog
ef63c6
* Wed Aug 19 2020 Rob Crittenden <rcritten@redhat.com> - 0.4-6
ef63c6
- The core subpackage can be installed standalone, drop the Requires
ef63c6
  on the base package. (#1852244)
ef63c6
- Add Conflicts < 0.4 to to core to allow downgrading with
ef63c6
  --allowerasing (#1852244)
ef63c6
ef63c6
* Tue Aug  4 2020 Rob Crittenden <rcritten@redhat.com> - 0.4-5
ef63c6
- Remove the Obsoletes < 0.4 and add same-version Requires to each
ef63c6
  subpackage so that upgrades from 0.3 will work (#1852244)
ef63c6
ef63c6
* Thu Jan 16 2020 Rob Crittenden <rcritten@redhat.com> - 0.4-4
ef63c6
- Allow plugins to read contents from config during initialization (#1784037)
ef63c6
ef63c6
* Thu Dec  5 2019 Rob Crittenden <rcritten@redhat.com> - 0.4-3
ef63c6
- Add Obsoletes to core subpackage (#1780121)
ef63c6
ef63c6
* Mon Dec  2 2019 Rob Crittenden <rcritten@redhat.com> - 0.4-2
ef63c6
- Abstract processing so core package is standalone (#1771710)
ef63c6
ef63c6
* Mon Dec  2 2019 Rob Crittenden <rcritten@redhat.com> - 0.4-1
ef63c6
- Rebase to upstream 0.4 (#1770346)
ef63c6
- Create subpackage to split out core processing (#1771710)
ef63c6
- Correct URL (#1773512)
ef63c6
- Errors not translated to strings (#1752849)
ef63c6
- JSON output not indented by default (#1729043)
ef63c6
- Add dependencies to checks to avoid false-positives (#1727900)
ef63c6
- Verify expected DNS records (#1695125)
ef63c6
ef63c6
* Mon Aug 12 2019 Rob Crittenden <rcritten@redhat.com> - 0.3-4
ef63c6
- Lookup AD user by SID and not by hardcoded username (#1739500)
ef63c6
ef63c6
* Thu Aug  8 2019 Rob Crittenden <rcritten@redhat.com> - 0.3-3
ef63c6
- The AD trust agent and controller are not being initialized (#1738314)
ef63c6
ef63c6
* Mon Aug  5 2019 Rob Crittenden <rcritten@redhat.com> - 0.3-2
ef63c6
- Change DNA plugin to return WARNING if no range is set (#1737492)
ef63c6
ef63c6
* Mon Jul 29 2019 François Cami <fcami@redhat.com> - 0.3-1
ef63c6
- Update to upstream 0.3 (#1701351)
ef63c6
- Add logrotate configs + depend on anacron and logrotate (#1729207)
ef63c6
ef63c6
* Thu Jul 11 2019 François Cami <fcami@redhat.com> - 0.2-4
ef63c6
- Fix ipa-healthcheck.sh installation path (rhbz#1729188)
ef63c6
- Create and own log directory (rhbz#1729188)
ef63c6
ef63c6
* Tue Apr 30 2019 François Cami <fcami@redhat.com> - 0.2-3
ef63c6
- Add python3-lib389 to BRs
ef63c6
ef63c6
* Tue Apr 30 2019 François Cami <fcami@redhat.com> - 0.2-2
ef63c6
- Fix changelog
ef63c6
ef63c6
* Thu Apr 25 2019 Rob Crittenden <rcritten@redhat.com> - 0.2-1
ef63c6
- Update to upstream 0.2
ef63c6
ef63c6
* Thu Apr 4 2019 François Cami <fcami@redhat.com> - 0.1-2
ef63c6
- Explicitly list dependencies
ef63c6
ef63c6
* Tue Apr 2 2019 François Cami <fcami@redhat.com> - 0.1-1
ef63c6
- Initial package import