|
|
588af0 |
Name: redhat-cloud-client-configuration
|
|
|
588af0 |
Version: 1
|
|
|
588af0 |
Release: 9%{?dist}
|
|
|
588af0 |
Summary: Red Hat cloud client configuration
|
|
|
588af0 |
License: GPLv2+
|
|
|
588af0 |
URL: https://github.com/RedHatInsights/redhat-cloud-client-configuration
|
|
|
588af0 |
|
|
|
588af0 |
Source0: insights-register.path.in
|
|
|
588af0 |
Source1: insights-register.service.in
|
|
|
588af0 |
Source2: insights-unregister.path.in
|
|
|
588af0 |
Source3: insights-unregister.service.in
|
|
|
588af0 |
Source4: 80-insights-register.preset
|
|
|
588af0 |
Source5: insights-unregistered.path.in
|
|
|
588af0 |
Source6: insights-unregistered.service.in
|
|
|
588af0 |
Source7: rhcd.path.in
|
|
|
588af0 |
Source8: rhcd-stop.path.in
|
|
|
588af0 |
Source9: rhcd-stop.service.in
|
|
|
588af0 |
Source10: 80-rhcd-register.preset
|
|
|
588af0 |
Source11: LICENSE
|
|
|
588af0 |
|
|
|
588af0 |
BuildArch: noarch
|
|
|
588af0 |
|
|
|
588af0 |
Requires: insights-client
|
|
|
588af0 |
Requires: subscription-manager
|
|
|
588af0 |
|
|
|
588af0 |
%if 0%{?rhel} >= 8
|
|
|
588af0 |
Requires: rhc
|
|
|
588af0 |
%endif
|
|
|
588af0 |
|
|
|
588af0 |
BuildRequires: systemd
|
|
|
588af0 |
|
|
|
588af0 |
%description
|
|
|
588af0 |
Configure client autoregistration for cloud environments
|
|
|
588af0 |
|
|
|
588af0 |
%prep
|
|
|
588af0 |
# we have no source
|
|
|
588af0 |
|
|
|
588af0 |
|
|
|
588af0 |
%build
|
|
|
588af0 |
# insights-client
|
|
|
588af0 |
sed -e 's|@sysconfdir@|%{_sysconfdir}|g' %{SOURCE0} > insights-register.path
|
|
|
588af0 |
sed -e 's|@bindir@|%{_bindir}|g' %{SOURCE1} > insights-register.service
|
|
|
588af0 |
sed -e 's|@sysconfdir@|%{_sysconfdir}|g' %{SOURCE2} > insights-unregister.path
|
|
|
588af0 |
sed -e 's|@sysconfdir@|%{_sysconfdir}|g' -e 's|@bindir@|%{_bindir}|g' %{SOURCE3} > insights-unregister.service
|
|
|
588af0 |
sed -e 's|@sysconfdir@|%{_sysconfdir}|g' %{SOURCE5} > insights-unregistered.path
|
|
|
588af0 |
sed -e 's|@sysconfdir@|%{_sysconfdir}|g' %{SOURCE6} > insights-unregistered.service
|
|
|
588af0 |
|
|
|
588af0 |
%if 0%{?rhel} >= 8
|
|
|
588af0 |
# rhcd
|
|
|
588af0 |
sed -e 's|@sysconfdir@|%{_sysconfdir}|g' %{SOURCE7} > rhcd.path
|
|
|
588af0 |
sed -e 's|@sysconfdir@|%{_sysconfdir}|g' %{SOURCE8} > rhcd-stop.path
|
|
|
588af0 |
sed -e 's|@sysconfdir@|%{_sysconfdir}|g' %{SOURCE9} > rhcd-stop.service
|
|
|
588af0 |
%endif
|
|
|
588af0 |
|
|
|
588af0 |
%install
|
|
|
588af0 |
# insights-client
|
|
|
588af0 |
install -d %{buildroot}%{_unitdir}
|
|
|
588af0 |
install -m644 insights-register.path %{buildroot}%{_unitdir}/
|
|
|
588af0 |
install -m644 insights-register.service %{buildroot}%{_unitdir}/
|
|
|
588af0 |
install -m644 insights-unregister.path %{buildroot}%{_unitdir}/
|
|
|
588af0 |
install -m644 insights-unregister.service %{buildroot}%{_unitdir}/
|
|
|
588af0 |
install -m644 insights-unregistered.path %{buildroot}%{_unitdir}/
|
|
|
588af0 |
install -m644 insights-unregistered.service %{buildroot}%{_unitdir}/
|
|
|
588af0 |
install -d %{buildroot}%{_presetdir}
|
|
|
588af0 |
install -m644 %{SOURCE4} -t %{buildroot}%{_presetdir}/
|
|
|
588af0 |
|
|
|
588af0 |
%if 0%{?rhel} >= 8
|
|
|
588af0 |
# rhcd
|
|
|
588af0 |
install -D -m644 rhcd.path %{buildroot}%{_unitdir}/
|
|
|
588af0 |
install -D -m644 rhcd-stop.path %{buildroot}%{_unitdir}/
|
|
|
588af0 |
install -D -m644 rhcd-stop.service %{buildroot}%{_unitdir}/
|
|
|
588af0 |
install -m644 %{SOURCE10} -t %{buildroot}%{_presetdir}/
|
|
|
588af0 |
%endif
|
|
|
588af0 |
|
|
|
588af0 |
%post
|
|
|
588af0 |
# insights-client
|
|
|
588af0 |
%systemd_post insights-register.path
|
|
|
588af0 |
%systemd_post insights-unregister.path
|
|
|
588af0 |
%systemd_post 80-insights-register.preset
|
|
|
588af0 |
%systemd_post insights-unregistered.path
|
|
|
588af0 |
#rhcd
|
|
|
588af0 |
%if 0%{?rhel} >= 8
|
|
|
588af0 |
%systemd_post rhcd.path
|
|
|
588af0 |
%systemd_post rhcd-stop.path
|
|
|
588af0 |
%systemd_post 80-rhcd-register.preset
|
|
|
588af0 |
%endif
|
|
|
588af0 |
|
|
|
588af0 |
# Make sure that rhsmcertd.service is enabled and running
|
|
|
588af0 |
%systemd_post rhsmcertd.service
|
|
|
588af0 |
# Run following block only during installation (not during update)
|
|
|
588af0 |
if [ $1 -eq 1 ]; then
|
|
|
588af0 |
# Try to get current value of auto-registration in rhsm.conf
|
|
|
588af0 |
subscription-manager config --list | grep -q '^[ \t]*auto_registration[ \t]*=[ \t]*1'
|
|
|
588af0 |
if [ $? -eq 0 ]; then
|
|
|
588af0 |
auto_reg_enabled=1
|
|
|
588af0 |
else
|
|
|
588af0 |
auto_reg_enabled=0
|
|
|
588af0 |
fi
|
|
|
588af0 |
|
|
|
588af0 |
# Try to get current value of manage_repos
|
|
|
588af0 |
subscription-manager config --list | grep -q '^[ \t]*manage_repos[ \t]*=[ \t]*0'
|
|
|
588af0 |
if [ $? -eq 0 ]; then
|
|
|
588af0 |
manage_repos_enabled=0
|
|
|
588af0 |
else
|
|
|
588af0 |
manage_repos_enabled=1
|
|
|
588af0 |
fi
|
|
|
588af0 |
|
|
|
588af0 |
# When we are going to change any configuration value, then save original rhsm.conf
|
|
|
588af0 |
if [ $auto_reg_enabled -eq 0 -o $manage_repos_enabled -eq 1 ]; then
|
|
|
588af0 |
echo -e "#\n# Automatic backup of rhsm.conf created by %{name} installation script\n#\n" \
|
|
|
588af0 |
> /etc/rhsm/rhsm.conf.cloud_save
|
|
|
588af0 |
cat /etc/rhsm/rhsm.conf >> /etc/rhsm/rhsm.conf.cloud_save
|
|
|
588af0 |
fi
|
|
|
588af0 |
|
|
|
588af0 |
# Enable auto-registration in rhsm.conf
|
|
|
588af0 |
if [ $auto_reg_enabled -eq 0 ]; then
|
|
|
588af0 |
subscription-manager config --rhsmcertd.auto_registration=1
|
|
|
588af0 |
fi
|
|
|
588af0 |
|
|
|
588af0 |
# Disable management of redhat.repo on systems running in
|
|
|
588af0 |
# public cloud, because content is provided by RHUI
|
|
|
588af0 |
if [ $manage_repos_enabled -eq 1 ]; then
|
|
|
588af0 |
subscription-manager config --rhsm.manage_repos=0
|
|
|
588af0 |
fi
|
|
|
588af0 |
|
|
|
588af0 |
# Restart rhsmcertd to reload configuration file, when it is necessary
|
|
|
588af0 |
if [ $auto_reg_enabled -eq 0 -o $manage_repos_enabled -eq 1 ]; then
|
|
|
588af0 |
/bin/systemctl restart rhsmcertd.service
|
|
|
588af0 |
fi
|
|
|
588af0 |
fi
|
|
|
588af0 |
|
|
|
588af0 |
%preun
|
|
|
588af0 |
if [ $1 -eq 0 ]; then
|
|
|
588af0 |
# Packager removal, unmask register if exists
|
|
|
588af0 |
/bin/systemctl unmask --now insights-register.path > /dev/null 2>&1 || :
|
|
|
588af0 |
%if 0%{?rhel} >= 8
|
|
|
588af0 |
/bin/systemctl unmask --now rhcd.path > /dev/null 2>&1 || :
|
|
|
588af0 |
%endif
|
|
|
588af0 |
fi
|
|
|
588af0 |
%systemd_preun insights-register.path
|
|
|
588af0 |
%systemd_preun insights-unregister.path
|
|
|
588af0 |
%systemd_preun insights-unregistered.path
|
|
|
588af0 |
|
|
|
588af0 |
%if 0%{?rhel} >= 8
|
|
|
588af0 |
%systemd_preun rhcd.path
|
|
|
588af0 |
%systemd_preun rhcd-stop.path
|
|
|
588af0 |
%endif
|
|
|
588af0 |
|
|
|
588af0 |
%postun
|
|
|
588af0 |
%systemd_postun insights-register.path
|
|
|
588af0 |
%systemd_postun insights-unregister.path
|
|
|
588af0 |
%systemd_postun insights-unregistered.path
|
|
|
588af0 |
|
|
|
588af0 |
%if 0%{?rhel} >= 8
|
|
|
588af0 |
%systemd_postun rhcd.path
|
|
|
588af0 |
%systemd_postun rhcd-stop.path
|
|
|
588af0 |
%endif
|
|
|
588af0 |
|
|
|
588af0 |
|
|
|
588af0 |
if [ $1 -eq 0 ]; then
|
|
|
588af0 |
if [ -f /etc/rhsm/rhsm.conf.cloud_save ]; then
|
|
|
588af0 |
rhsmcertd_restart_required=0
|
|
|
588af0 |
|
|
|
588af0 |
# When auto-registration was originally disabled and we had
|
|
|
588af0 |
# to enable it during installation of this RPM, then disable it
|
|
|
588af0 |
# again during removal of RPM package to restore original state.
|
|
|
588af0 |
grep -q '^[ \t]*auto_registration[ \t]*=[ \t]*0' /etc/rhsm/rhsm.conf.cloud_save
|
|
|
588af0 |
if [ $? -eq 0 ]; then
|
|
|
588af0 |
subscription-manager config --rhsmcertd.auto_registration=0
|
|
|
588af0 |
rhsmcertd_restart_required=1
|
|
|
588af0 |
fi
|
|
|
588af0 |
|
|
|
588af0 |
# When managing was originally enabled, then enable it again
|
|
|
588af0 |
grep -q '^[ \t]*manage_repos[ \t]*=[ \t]*1' /etc/rhsm/rhsm.conf.cloud_save
|
|
|
588af0 |
if [ $? -eq 0 ]; then
|
|
|
588af0 |
subscription-manager config --rhsm.manage_repos=1
|
|
|
588af0 |
rhsmcertd_restart_required=1
|
|
|
588af0 |
fi
|
|
|
588af0 |
|
|
|
588af0 |
# Restart rhsmcertd to propagate change in rhsm.conf
|
|
|
588af0 |
if [ $rhsmcertd_restart_required -eq 1 ]; then
|
|
|
588af0 |
%systemd_postun_with_restart rhsmcertd.service
|
|
|
588af0 |
fi
|
|
|
588af0 |
|
|
|
588af0 |
# Script should clean up after itself
|
|
|
588af0 |
rm -f /etc/rhsm/rhsm.conf.cloud_save
|
|
|
588af0 |
fi
|
|
|
588af0 |
fi
|
|
|
588af0 |
|
|
|
588af0 |
|
|
|
588af0 |
%files
|
|
|
588af0 |
%{_unitdir}/*
|
|
|
588af0 |
%{_presetdir}/*
|
|
|
588af0 |
|
|
|
588af0 |
|
|
|
588af0 |
%changelog
|
|
|
588af0 |
* Wed Jul 06 2022 Gaël Chamoulaud <gchamoul@redhat.com> - 1-9
|
|
|
588af0 |
- Add LICENSE file
|
|
|
588af0 |
|
|
|
588af0 |
* Mon Jul 04 2022 Gaël Chamoulaud <gchamoul@redhat.com> - 1-8
|
|
|
588af0 |
- Fix bad date format in changelog
|
|
|
588af0 |
|
|
|
588af0 |
* Mon Jul 04 2022 Gaël Chamoulaud <gchamoul@redhat.com> - 1-7
|
|
|
588af0 |
- Remove conditional for rhcd sources
|
|
|
588af0 |
- Fix: systemctl absolute path for rhel7
|
|
|
588af0 |
|
|
|
588af0 |
* Thu Jun 30 2022 Gaël Chamoulaud <gchamoul@redhat.com> - 1-6
|
|
|
588af0 |
- Split preset insights-client and rhcd. RHEL7 compatibility.
|
|
|
588af0 |
- Add autoregistration when insights-client manually unregister
|
|
|
588af0 |
|
|
|
588af0 |
* Thu Jun 30 2022 Gaël Chamoulaud <gchamoul@redhat.com> - 1-5
|
|
|
588af0 |
- Disable RHSM config option manage_repos during installation
|
|
|
588af0 |
- Enable rhcd auto-enablement only for RHEL>=8
|
|
|
588af0 |
|
|
|
588af0 |
* Thu Jun 23 2022 Gaël Chamoulaud <gchamoul@redhat.com> - 1-4
|
|
|
588af0 |
- Add gating.yaml file
|
|
|
588af0 |
|
|
|
588af0 |
* Thu Jun 23 2022 Gaël Chamoulaud <gchamoul@redhat.com> - 1-3
|
|
|
588af0 |
- Fix - Executable path is not absolute, ignoring: systemctl
|
|
|
588af0 |
|
|
|
588af0 |
* Thu Jun 16 2022 Gaël Chamoulaud <gchamoul@redhat.com> - 1-2
|
|
|
588af0 |
- fix - remove .in suffix from rhcd unit files
|
|
|
588af0 |
- remove rhcd-override.conf
|
|
|
588af0 |
- add rhcd path files to monitor existence of cert file + add rhcd stop service file which can stop rhcd when system is unsubscribed
|
|
|
588af0 |
|
|
|
588af0 |
* Tue May 31 2022 Link Dupont <link@redhat.com> - 1-1
|
|
|
588af0 |
- fix up some spec file descriptions
|
|
|
588af0 |
- add override to automatically activate rhcd
|
|
|
588af0 |
|
|
|
588af0 |
* Tue May 17 2022 Alba Hita Catala <ahitacat@redhat.com> - 1-1
|
|
|
588af0 |
- insights-client autoregistration
|