Blame SPECS/insights-client.spec

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