Blame SPECS/insights-client.spec

431da0
%if 0%{?rhel} != 8
431da0
%{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
431da0
%endif
e80d18
%define _binaries_in_noarch_packages_terminate_build 0
e80d18
e80d18
Name:                   insights-client
e80d18
Summary:                Uploads Insights information to Red Hat on a periodic basis
431da0
Version:                3.0.13
431da0
Release:                1%{?dist}
e80d18
Source0:                https://github.com/redhatinsights/insights-client/archive/insights-client-%{version}.tar.gz
e80d18
Epoch:                  0
e80d18
License:                GPLv2+
e80d18
URL:                    http://cloud.redhat.com/insights
e80d18
Group:                  Applications/System
e80d18
Vendor:                 Red Hat, Inc.
e80d18
e80d18
Provides: redhat-access-insights = 1.0.13-3
e80d18
Provides: redhat-access-insights = %{version}-%{release}%{?dist}
e80d18
e80d18
Obsoletes: redhat-access-insights
e80d18
Obsoletes: redhat-access-proactive
e80d18
e80d18
Requires: tar
e80d18
Requires: gpg
e80d18
Requires: pciutils
e80d18
BuildArch: noarch
e80d18
e80d18
# RHEL 8
e80d18
%if 0%{?rhel} == 8
e80d18
%{?__python3:Requires: %{__python3}}
e80d18
Requires: platform-python-setuptools
e80d18
Requires: python3-requests >= 2.6
e80d18
Requires: python3-PyYAML
e80d18
Requires: python3-magic
e80d18
Requires: python3-six
e80d18
BuildRequires: python3-devel
431da0
BuildRequires: python3-six
e80d18
BuildRequires: python3-setuptools
e80d18
e80d18
# RHEL 6-7
e80d18
%else
e80d18
Requires: python
e80d18
Requires: python-setuptools
e80d18
Requires: python-requests >= 2.6
e80d18
Requires: PyYAML
e80d18
Requires: libcgroup
e80d18
Requires: python-magic
e80d18
Requires: python-six >= 1.9.0
e80d18
BuildRequires: python2-devel
431da0
BuildRequires: python-six
e80d18
BuildRequires: python-setuptools
e80d18
%endif
e80d18
e80d18
# systemd/RHEL 6 deps
e80d18
%if 0%{?rhel} == 6
e80d18
Requires: python-argparse
e80d18
%else
e80d18
%{?systemd_requires}
e80d18
Requires: systemd
e80d18
BuildRequires: systemd
e80d18
%endif
e80d18
e80d18
%description
e80d18
Sends insightful information to Red Hat for automated analysis
e80d18
e80d18
%prep
e80d18
%setup -q
e80d18
e80d18
%install
e80d18
rm -rf ${RPM_BUILD_ROOT}
e80d18
%if 0%{?rhel} == 8
e80d18
%{__python3} setup.py install --root=${RPM_BUILD_ROOT} $PREFIX
e80d18
pathfix.py -pni "%{__python3}" %{buildroot}%{python3_sitelib}/insights_client/{__init__.py,major_version.py,run.py}
e80d18
pathfix.py -pni "%{__python3}" %{buildroot}%{_bindir}/insights-client
e80d18
pathfix.py -pni "%{__python3}" %{buildroot}%{_bindir}/redhat-access-insights
e80d18
%else
431da0
%{__python} setup.py install --root=${RPM_BUILD_ROOT} $PREFIX
e80d18
%endif
e80d18
e80d18
%post
e80d18
e80d18
%if 0%{?rhel} != 6
e80d18
%systemd_post %{name}.timer
e80d18
%endif
e80d18
e80d18
# Only perform migration from redhat-access-insights to insights-client
e80d18
if  [ $1 -eq 1  ]; then
e80d18
    #Migrate existing machine-id
e80d18
    if  [ -f "/etc/redhat_access_proactive/machine-id" ]; then
e80d18
        cp /etc/redhat_access_proactive/machine-id /etc/insights-client/machine-id
e80d18
    fi
e80d18
    #Migrate OTHER existing machine-id
e80d18
    if [ -f "/etc/redhat-access-insights/machine-id" ]; then
e80d18
        cp /etc/redhat-access-insights/machine-id /etc/insights-client/machine-id
e80d18
    fi
e80d18
    #Migrate existing config
e80d18
    if [ -f "/etc/redhat-access-insights/redhat-access-insights.conf" ]; then
e80d18
        cp /etc/redhat-access-insights/redhat-access-insights.conf /etc/insights-client/insights-client.conf
e80d18
        sed -i 's/\[redhat-access-insights\]/\[insights-client\]/' /etc/insights-client/insights-client.conf
e80d18
    fi
e80d18
    #Migrate registration record
e80d18
    if [ -f "/etc/redhat-access-insights/.registered" ]; then
e80d18
        cp /etc/redhat-access-insights/.registered /etc/insights-client/.registered
e80d18
    fi
e80d18
    if [ -f "/etc/redhat-access-insights/.unregistered" ]; then
e80d18
        cp /etc/redhat-access-insights/.unregistered /etc/insights-client/.unregistered
e80d18
    fi
e80d18
    #Migrate last upload record
e80d18
    if [ -f "/etc/redhat-access-insights/.lastupload" ]; then
e80d18
        cp /etc/redhat-access-insights/.lastupload /etc/insights-client/.lastupload
e80d18
    fi
e80d18
    #Migrate remove.conf
e80d18
    if [ -f "/etc/redhat-access-insights/remove.conf" ]; then
e80d18
        cp /etc/redhat-access-insights/remove.conf /etc/insights-client/remove.conf
e80d18
    fi
e80d18
    if ! [ -d "/etc/redhat-access-insights" ]; then
e80d18
        mkdir /etc/redhat-access-insights
e80d18
    fi
e80d18
    # Symlink new cron job if the old one exists. Remove the old one
e80d18
    if [ -f "/etc/cron.daily/redhat-access-insights" ]; then
e80d18
        rm -f /etc/cron.daily/redhat-access-insights
e80d18
        %if 0%{?rhel} == 6
e80d18
            ln -sf /etc/insights-client/insights-client.cron /etc/cron.daily/insights-client                               
e80d18
        %else
e80d18
            %_bindir/systemctl start insights-client.timer
e80d18
        %endif
e80d18
    fi 
e80d18
fi
e80d18
e80d18
# if the logging directory isnt created then make it
e80d18
if ! [ -d "/var/log/insights-client" ]; then
431da0
mkdir -m 750 /var/log/insights-client
e80d18
fi
e80d18
e80d18
# if the library directory for eggs and such isn't present
e80d18
# make it
e80d18
if ! [ -d "/var/lib/insights" ]; then
431da0
mkdir -m 755 /var/lib/insights
431da0
fi
431da0
431da0
%if 0%{?rhel} == 8
431da0
#Link motd into place. Only do so if motd file doesn't exist and insights hasn't been used
431da0
if [ ! -e /etc/motd.d/insights-client -a ! -L /etc/motd.d/insights-client ]; then
431da0
    mkdir -p /etc/motd.d
431da0
    if [ -e /var/lib/insights/newest.egg ]; then
431da0
        ln -sn /dev/null /etc/motd.d/insights-client
431da0
    else
431da0
        ln -sn /etc/insights-client/insights-client.motd /etc/motd.d/insights-client
431da0
    fi
e80d18
fi
431da0
%endif
e80d18
e80d18
# always perform legacy symlinks
e80d18
%posttrans
e80d18
mkdir -p /etc/redhat-access-insights
e80d18
ln -sf /etc/insights-client/insights-client.conf /etc/redhat-access-insights/redhat-access-insights.conf
e80d18
ln -sf /etc/insights-client/insights-client.cron /etc/redhat-access-insights/redhat-access-insights.cron
e80d18
ln -sf /etc/insights-client/.registered /etc/redhat-access-insights/.registered
e80d18
ln -sf /etc/insights-client/.unregistered /etc/redhat-access-insights/.unregistered
e80d18
ln -sf /etc/insights-client/.lastupload /etc/redhat-access-insights/.lastupload
e80d18
ln -sf /etc/insights-client/machine-id /etc/redhat-access-insights/machine-id
e80d18
# remove all ACLs on upgrade, forever and always
e80d18
setfacl -Rb /var/lib/insights
e80d18
setfacl -Rb /var/log/insights-client
e80d18
setfacl -Rb /etc/insights-client
e80d18
e80d18
%preun
e80d18
%if 0%{?rhel} != 6
e80d18
%systemd_preun %{name}.timer
e80d18
%systemd_preun %{name}.service
e80d18
%endif
e80d18
e80d18
%postun
e80d18
if [ "$1" -eq 0 ]; then
e80d18
# One run on removal, not upgrade
e80d18
%if 0%{?rhel} != 6
e80d18
%_bindir/systemctl daemon-reload > /dev/null 2>&1
e80d18
%endif
e80d18
rm -f /etc/cron.daily/insights-client
e80d18
rm -f /etc/cron.weekly/insights-client
e80d18
rm -f /etc/insights-client/.cache*
e80d18
rm -f /etc/insights-client/.registered
e80d18
rm -f /etc/insights-client/.unregistered
e80d18
rm -f /etc/insights-client/.lastupload
e80d18
rm -f /etc/insights-client/rpm.egg
e80d18
rm -f /etc/insights-client/rpm.egg.asc
e80d18
rm -f /etc/insights-client/.insights-core*.etag
e80d18
rm -rf /var/lib/insights
e80d18
# keep these to remove from previous install
e80d18
rm -f /etc/ansible/facts.d/insights.fact
e80d18
rm -f /etc/ansible/facts.d/insights_machine_id.fact
e80d18
# remove symlink to old name on uninstall
e80d18
rm -f %{_bindir}/redhat-access-insights
e80d18
# remove symlinks to old configs
e80d18
rm -rf /etc/redhat-access-insights/
e80d18
rm -f /etc/cron.daily/redhat-access-insights
e80d18
rm -f /etc/cron.weekly/redhat-access-insights
431da0
%if 0%{?rhel} == 8
431da0
rm -f /etc/motd.d/insights-client
431da0
%endif
e80d18
fi
e80d18
e80d18
%clean
e80d18
test "x$RPM_BUILD_ROOT" != "x" && rm -rf $RPM_BUILD_ROOT
e80d18
e80d18
%files
e80d18
%defattr(0600, root, root)
e80d18
%config(noreplace) /etc/insights-client/*.conf
e80d18
/etc/insights-client/.fallback.json
e80d18
/etc/insights-client/.fallback.json.asc
e80d18
/etc/insights-client/.exp.sed
431da0
%if 0%{?rhel} == 8
431da0
%config(noreplace) %attr(644,root,root) /etc/insights-client/insights-client.motd
431da0
%endif
e80d18
e80d18
%if 0%{?rhel} != 6
e80d18
%attr(644,root,root) %{_unitdir}/insights-client.service
e80d18
%attr(644,root,root) %{_unitdir}/insights-client.timer
e80d18
%endif
e80d18
e80d18
%attr(440,root,root) /etc/insights-client/*.pem
e80d18
%attr(440,root,root) /etc/insights-client/redhattools.pub.gpg
e80d18
e80d18
%attr(755,root,root) %{_bindir}/insights-client
e80d18
%attr(755,root,root) %{_bindir}/redhat-access-insights
e80d18
e80d18
%if 0%{?rhel} == 6
e80d18
%attr(755,root,root) /etc/insights-client/insights-client.cron
431da0
%config(noreplace) %attr(644,root,root) /etc/sysconfig/insights-client
e80d18
%endif
e80d18
e80d18
%attr(644,root,root) /etc/insights-client/rpm.egg
e80d18
%attr(644,root,root) /etc/insights-client/rpm.egg.asc
e80d18
e80d18
%if 0%{?rhel} == 8
431da0
%attr(755,root,root) %{python3_sitelib}/insights_client*.egg-info
e80d18
%attr(644,root,root) %{python3_sitelib}/insights_client*.egg-info/*
e80d18
%attr(644,root,root) %{python3_sitelib}/insights_client/*.py*
431da0
%attr(744,root,root) %{python3_sitelib}/insights_client/__pycache__
e80d18
%else
431da0
%attr(755,root,root) %{python_sitelib}/insights_client*.egg-info
431da0
%attr(644,root,root) %{python_sitelib}/insights_client*.egg-info/*
431da0
%attr(644,root,root) %{python_sitelib}/insights_client/*.py*
e80d18
%endif
e80d18
431da0
%attr(750,root,root) /var/log/insights-client
431da0
%attr(755,root,root) /var/lib/insights
e80d18
e80d18
%doc
e80d18
%defattr(-, root, root)
e80d18
/usr/share/man/man8/*.8.gz
e80d18
/usr/share/man/man5/*.5.gz
e80d18
e80d18
%changelog
431da0
* Tue Feb 11 2020 Link Dupont <link@redhat.com> - 3.0.13-1
431da0
- New upstream version
431da0
- Resolves: RHBZ#1795256
e80d18
e80d18
* Wed Mar 14 2018 Richard Brantley <rbrantle@redhat.com> - 3.0.3-8
e80d18
- Resolves: rhbz#1555041
e80d18
e80d18
* Fri Feb 16 2018 Kyle Lape <klape@redhat.com> - 3.0.3-6
e80d18
- Persist systemd timer config between reboots
e80d18
e80d18
* Wed Feb 7 2018 Kyle Lape <klape@redhat.com> - 3.0.3-2
e80d18
- Correct the version strings in Obsoletes and Provides in RPM spec
e80d18
e80d18
* Thu Jan 18 2018 Kyle Lape <klape@redhat.com> - 3.0.3-1
e80d18
- RHEL 7 RPM now uses systemd service and timer instead of cron
e80d18
- Addition of IO and CPU cgroup constraints
e80d18
- Fixed memory cgroup constraint
e80d18
e80d18
* Wed Oct 18 2017 Richard Brantley <rbrantle@redhat.com> - 3.0.2-2
e80d18
- Resolves BZ1498650, BZ1500008, BZ1501545, BZ1501552, BZ1501556, BZ1501561, BZ1501565, BZ1501566
e80d18
- Fixes version migration logic
e80d18
- Fixes symlink issues to old binary
e80d18
- Fixes short ID analysis for images and containers
e80d18
- Fixes Docker library detection
e80d18
- Fixes image and container detection
e80d18
- Fixes registration execution flow
e80d18
- Fixes --version flag to print to stdout and include additional versioning information
e80d18
- Includes Insights Core 3.0.3-1
e80d18
e80d18
* Wed Oct 4 2017 Richard Brantley <rbrantle@redhat.com> - 3.0.1-5
e80d18
- Resolves BZ1498581
e80d18
- Fixes sys.path issues
e80d18
- Includes Insights Core 3.0.2-6
e80d18
e80d18
* Wed Sep 27 2017 Richard Brantley <rbrantle@redhat.com> - 3.0.0-4
e80d18
- Initial build