import insights-client-3.0.14-2.el8

This commit is contained in:
CentOS Sources 2020-07-28 04:46:21 -04:00 committed by Stepan Oksanichenko
parent ede5b9cb66
commit 2c72419d71
5 changed files with 179 additions and 201 deletions

2
.gitignore vendored
View File

@ -1 +1 @@
SOURCES/insights-client-3.0.8.tar.gz
SOURCES/insights-client-3.0.14.tar.gz

View File

@ -1 +1 @@
ff2ad762a4a7a399223e31020862b199d4e718f3 SOURCES/insights-client-3.0.8.tar.gz
e67aa1adab226f13ffc066a628352bf1dc6cff6d SOURCES/insights-client-3.0.14.tar.gz

View File

@ -0,0 +1,74 @@
From aa5d5860146e6b5c76da4746f18b64313cc848e9 Mon Sep 17 00:00:00 2001
From: Link Dupont <subpop@users.noreply.github.com>
Date: Fri, 1 May 2020 13:20:52 -0400
Subject: [PATCH] Fix shellcheck warnings (#117)
* Explicitly invoke bash as the interpreter
* Allow shellcheck to follow external sources
* Test cgconfig check directly - Fixes SC2181
* Remove unncessary variable prefix - Fixes SC2004
* Quote test for ENABLE_CHECK_RESULTS - Fixes SC2070
* Quote $0 properly inside $() context - Fixes SC2086
* Quote the arguments before execing insights-client - Fixes SC2068
* Fix shellcheck errors in autogen.sh
* Update the cgroup check to be more explicit
---
data/cron/insights-client.cron | 12 ++++++------
src/redhat-access-insights.in | 4 ++--
3 files changed, 16 insertions(+), 14 deletions(-)
diff --git a/data/cron/insights-client.cron b/data/cron/insights-client.cron
index aa5cff6..82add66 100644
--- a/data/cron/insights-client.cron
+++ b/data/cron/insights-client.cron
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
# This file is part of insights-client.
#
@@ -13,13 +13,13 @@ RANDOM_DELAY_SEC=14400
ENABLE_CHECK_RESULTS="yes"
if [ -f /etc/sysconfig/insights-client ]; then
+ # shellcheck source=insights-client
. /etc/sysconfig/insights-client
fi
-DELAY=$((1 + RANDOM % ${RANDOM_DELAY_SEC}))
+DELAY=$((1 + RANDOM % RANDOM_DELAY_SEC))
/bin/sleep ${DELAY}
-/sbin/service cgconfig status > /dev/null 2>&1
-if [ $? == 0 ];
+if [ "$(/sbin/service cgconfig status)" == "Running" ];
then
/bin/cgcreate -g memory,cpu,blkio:insights
/bin/cgset -r memory.limit_in_bytes=2147483648 insights
@@ -29,13 +29,13 @@ then
/bin/cgset -r blkio.weight=100 insights
/bin/cgexec -g memory,cpu,blkio:insights /usr/bin/timeout 10m ${path} --retry 3 --quiet
/bin/cgdelete memory,cpu,blkio:insights
- if [ -n ${ENABLE_CHECK_RESULTS} ]; then
+ if [[ -n ${ENABLE_CHECK_RESULTS} ]]; then
/bin/sleep 120
${path} --check-results
fi
else
/usr/bin/timeout 10m ${path} --quiet
- if [ -n ${ENABLE_CHECK_RESULTS} ]; then
+ if [[ -n ${ENABLE_CHECK_RESULTS} ]]; then
/bin/sleep 120
/usr/bin/timeout 10m ${path} --check-results
fi
diff --git a/src/redhat-access-insights.in b/src/redhat-access-insights.in
index dfa016b..62f7bfe 100644
--- a/src/redhat-access-insights.in
+++ b/src/redhat-access-insights.in
@@ -1,5 +1,5 @@
#!/bin/sh
-echo "WARNING: $(basename $0) is deprecated and will be removed in a future release; use 'insights-client' instead."
+echo "WARNING: $(basename "$0") is deprecated and will be removed in a future release; use 'insights-client' instead."
sleep 3
-exec @bindir@/insights-client $@
+exec @bindir@/insights-client "$@"

View File

@ -0,0 +1,13 @@
--- a/configure.orig 2020-06-11 10:25:02.853487027 -0400
+++ b/configure 2020-06-11 10:25:12.149398946 -0400
@@ -3269,8 +3269,8 @@
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for motd_d support" >&5
$as_echo_n "checking for motd_d support... " >&6; }
have_motdd=no
-if test -f /usr/lib64/security/pam_motd.so; then
- $STRINGS /usr/lib64/security/pam_motd.so | grep -q "motd_dir="
+if test -f $libdir/security/pam_motd.so; then
+ $STRINGS $libdir/security/pam_motd.so | grep -q "motd_dir="
if test $? -eq 0; then
have_motdd=yes
fi

View File

@ -2,256 +2,147 @@
Name: insights-client
Summary: Uploads Insights information to Red Hat on a periodic basis
Version: 3.0.8
Release: 4%{?dist}
Version: 3.0.14
Release: 2%{?dist}
Source0: https://github.com/redhatinsights/insights-client/archive/insights-client-%{version}.tar.gz
# RHCLOUD-6204: fix error in cron that correctly disables results check
Patch0: RHCLOUD-6204-fix-shellcheck-warnings-aa5d586.patch
# It's not safe to assume pam modules exist in /usr/lib64
Patch1: configure-use-libdir.patch
Epoch: 0
License: GPLv2+
URL: http://cloud.redhat.com/insights
Group: Applications/System
Vendor: Red Hat, Inc.
Provides: redhat-access-insights = 1.0.13-3
Provides: redhat-access-insights = %{version}-%{release}%{?dist}
Obsoletes: redhat-access-insights
Obsoletes: redhat-access-proactive
Obsoletes: redhat-access-insights <= 1.0.13-2
Obsoletes: redhat-access-proactive <= 1.0.13-2
BuildArch: noarch
Requires: tar
Requires: gpg
Requires: pciutils
BuildArch: noarch
# RHEL 8
%if 0%{?rhel} == 8
%{?__python3:Requires: %{__python3}}
Requires: platform-python-setuptools
%{?systemd_requires}
Requires: python3-requests >= 2.6
Requires: python3-PyYAML
Requires: python3-magic
Requires: python3-six
Requires: platform-python-setuptools
Requires: coreutils
BuildRequires: wget
BuildRequires: binutils
BuildRequires: python3-devel
BuildRequires: python3-six
BuildRequires: python3-setuptools
# RHEL 6-7
%else
Requires: python
Requires: python-setuptools
Requires: python-requests >= 2.6
Requires: PyYAML
Requires: libcgroup
Requires: python-magic
Requires: python-six >= 1.9.0
BuildRequires: python2-devel
BuildRequires: python-six
BuildRequires: python-setuptools
%endif
# systemd/RHEL 6 deps
%if 0%{?rhel} == 6
Requires: python-argparse
%else
%{?systemd_requires}
Requires: systemd
BuildRequires: systemd
%endif
BuildRequires: pam
%description
Sends insightful information to Red Hat for automated analysis
%prep
%setup -q
%autosetup -p1
%build
%{configure} PYTHON=%{_libexecdir}/platform-python
%{__make}
%install
rm -rf ${RPM_BUILD_ROOT}
%if 0%{?rhel} == 8
%{__python3} setup.py install --root=${RPM_BUILD_ROOT} $PREFIX
pathfix.py -pni "%{__python3}" %{buildroot}%{python3_sitelib}/insights_client/{__init__.py,major_version.py,run.py}
pathfix.py -pni "%{__python3}" %{buildroot}%{_bindir}/insights-client-run
pathfix.py -pni "%{__python3}" %{buildroot}%{_bindir}/insights-client
pathfix.py -pni "%{__python3}" %{buildroot}%{_bindir}/redhat-access-insights
%else
%{__python2} setup.py install --root=${RPM_BUILD_ROOT} $PREFIX
%endif
%{make_install}
%{__install} -d -m 755 %{buildroot}/%{_localstatedir}/log/insights-client
%{__install} -d -m 755 %{buildroot}/%{_localstatedir}/lib/insights
%post
%if 0%{?rhel} != 6
%systemd_post %{name}.timer
%endif
# Only perform migration from redhat-access-insights to insights-client
if [ $1 -eq 1 ]; then
#Migrate existing machine-id
if [ -f "/etc/redhat_access_proactive/machine-id" ]; then
cp /etc/redhat_access_proactive/machine-id /etc/insights-client/machine-id
fi
#Migrate OTHER existing machine-id
if [ -f "/etc/redhat-access-insights/machine-id" ]; then
cp /etc/redhat-access-insights/machine-id /etc/insights-client/machine-id
fi
#Migrate existing config
if [ -f "/etc/redhat-access-insights/redhat-access-insights.conf" ]; then
cp /etc/redhat-access-insights/redhat-access-insights.conf /etc/insights-client/insights-client.conf
sed -i 's/\[redhat-access-insights\]/\[insights-client\]/' /etc/insights-client/insights-client.conf
fi
#Migrate registration record
if [ -f "/etc/redhat-access-insights/.registered" ]; then
cp /etc/redhat-access-insights/.registered /etc/insights-client/.registered
fi
if [ -f "/etc/redhat-access-insights/.unregistered" ]; then
cp /etc/redhat-access-insights/.unregistered /etc/insights-client/.unregistered
fi
#Migrate last upload record
if [ -f "/etc/redhat-access-insights/.lastupload" ]; then
cp /etc/redhat-access-insights/.lastupload /etc/insights-client/.lastupload
fi
#Migrate remove.conf
if [ -f "/etc/redhat-access-insights/remove.conf" ]; then
cp /etc/redhat-access-insights/remove.conf /etc/insights-client/remove.conf
fi
if ! [ -d "/etc/redhat-access-insights" ]; then
mkdir /etc/redhat-access-insights
fi
# Symlink new cron job if the old one exists. Remove the old one
if [ -f "/etc/cron.daily/redhat-access-insights" ]; then
rm -f /etc/cron.daily/redhat-access-insights
%if 0%{?rhel} == 6
ln -sf /etc/insights-client/insights-client.cron /etc/cron.daily/insights-client
%else
%_bindir/systemctl start insights-client.timer
%endif
fi
fi
# if the logging directory isnt created then make it
if ! [ -d "/var/log/insights-client" ]; then
mkdir -m 640 /var/log/insights-client
fi
# if the library directory for eggs and such isn't present
# make it
if ! [ -d "/var/lib/insights" ]; then
mkdir -m 644 /var/lib/insights
fi
%if 0%{?rhel} != 6
#Link motd into place. Only do so if motd file doesn't exist and insights hasn't been used
if [ ! -e /etc/motd.d/insights-client -a ! -L /etc/motd.d/insights-client ]; then
mkdir -p /etc/motd.d
if [ -e /var/lib/insights/newest.egg ]; then
ln -sn /dev/null /etc/motd.d/insights-client
else
ln -sn /etc/insights-client/insights-client.motd /etc/motd.d/insights-client
if [ -d %{_sysconfdir}/motd.d ]; then
if [ ! -e %{_sysconfdir}/motd.d/insights-client -a ! -L %{_sysconfdir}/motd.d/insights-client ]; then
if [ -e %{_localstatedir}/lib/insights/newest.egg ]; then
ln -sn /dev/null %{_sysconfdir}/motd.d/insights-client
else
ln -sn %{_sysconfdir}/insights-client/insights-client.motd %{_sysconfdir}/motd.d/insights-client
fi
fi
fi
%endif
# always perform legacy symlinks
%posttrans
mkdir -p /etc/redhat-access-insights
ln -sf /etc/insights-client/insights-client.conf /etc/redhat-access-insights/redhat-access-insights.conf
ln -sf /etc/insights-client/insights-client.cron /etc/redhat-access-insights/redhat-access-insights.cron
ln -sf /etc/insights-client/.registered /etc/redhat-access-insights/.registered
ln -sf /etc/insights-client/.unregistered /etc/redhat-access-insights/.unregistered
ln -sf /etc/insights-client/.lastupload /etc/redhat-access-insights/.lastupload
ln -sf /etc/insights-client/machine-id /etc/redhat-access-insights/machine-id
# remove all ACLs on upgrade, forever and always
setfacl -Rb /var/lib/insights
setfacl -Rb /var/log/insights-client
setfacl -Rb /etc/insights-client
%preun
%if 0%{?rhel} != 6
%systemd_preun %{name}.timer
%systemd_preun %{name}.service
%endif
%postun
if [ "$1" -eq 0 ]; then
# One run on removal, not upgrade
%if 0%{?rhel} != 6
%_bindir/systemctl daemon-reload > /dev/null 2>&1
%endif
rm -f /etc/cron.daily/insights-client
rm -f /etc/cron.weekly/insights-client
rm -f /etc/insights-client/.cache*
rm -f /etc/insights-client/.registered
rm -f /etc/insights-client/.unregistered
rm -f /etc/insights-client/.lastupload
rm -f /etc/insights-client/rpm.egg
rm -f /etc/insights-client/rpm.egg.asc
rm -f /etc/insights-client/.insights-core*.etag
rm -rf /var/lib/insights
# keep these to remove from previous install
rm -f /etc/ansible/facts.d/insights.fact
rm -f /etc/ansible/facts.d/insights_machine_id.fact
# remove symlink to old name on uninstall
rm -f %{_bindir}/redhat-access-insights
# remove symlinks to old configs
rm -rf /etc/redhat-access-insights/
rm -f /etc/cron.daily/redhat-access-insights
rm -f /etc/cron.weekly/redhat-access-insights
%if 0%{?rhel} != 6
rm -f /etc/motd.d/insights-client
%endif
%systemd_postun %{name}.timer
%systemd_postun %{name}.service
# Clean up files created by insights-client that are unowned by the RPM
if [ $1 -eq 0 ]; then
rm -f %{_sysconfdir}/cron.daily/insights-client
rm -f %{_sysconfdir}/ansible/facts.d/insights.fact
rm -f %{_sysconfdir}/ansible/facts.d/insights_machine_id.fact
rm -f %{_sysconfdir}/motd.d/insights-client
rm -f %{_localstatedir}/lib/insights/*
fi
%clean
test "x$RPM_BUILD_ROOT" != "x" && rm -rf $RPM_BUILD_ROOT
rm -rf %{buildroot}
%files
%defattr(0600, root, root)
%config(noreplace) /etc/insights-client/*.conf
/etc/insights-client/.fallback.json
/etc/insights-client/.fallback.json.asc
/etc/insights-client/.exp.sed
%if 0%{?rhel} != 6
%config(noreplace) %attr(644,root,root) /etc/insights-client/insights-client.motd
%endif
%config(noreplace) %{_sysconfdir}/insights-client/*.conf
%{_sysconfdir}/insights-client/insights-client.motd
%{_sysconfdir}/insights-client/.fallback.json*
%{_sysconfdir}/insights-client/.exp.sed
%{_sysconfdir}/insights-client/rpm.egg*
%{_bindir}/*
%{_unitdir}/*
%attr(440,root,root) %{_sysconfdir}/insights-client/*.pem
%attr(440,root,root) %{_sysconfdir}/insights-client/redhattools.pub.gpg
%{python3_sitelib}/insights_client/
%{_localstatedir}/log/insights-client
%{_localstatedir}/lib/insights
%{_defaultdocdir}/%{name}
%if 0%{?rhel} != 6
%attr(644,root,root) %{_unitdir}/insights-client.service
%attr(644,root,root) %{_unitdir}/insights-client.timer
%endif
%attr(440,root,root) /etc/insights-client/*.pem
%attr(440,root,root) /etc/insights-client/redhattools.pub.gpg
%attr(755,root,root) %{_bindir}/insights-client
%attr(755,root,root) %{_bindir}/redhat-access-insights
%attr(755,root,root) %{_bindir}/insights-client-run
%if 0%{?rhel} == 6
%attr(755,root,root) /etc/insights-client/insights-client.cron
%endif
%attr(644,root,root) /etc/insights-client/rpm.egg
%attr(644,root,root) /etc/insights-client/rpm.egg.asc
%if 0%{?rhel} == 8
%attr(755,root,root) %{python3_sitelib}/insights_client*.egg-info
%attr(644,root,root) %{python3_sitelib}/insights_client*.egg-info/*
%attr(644,root,root) %{python3_sitelib}/insights_client/*.py*
%attr(744,root,root) %{python3_sitelib}/insights_client/__pycache__
%else
%attr(755,root,root) %{python2_sitelib}/insights_client*.egg-info
%attr(644,root,root) %{python2_sitelib}/insights_client*.egg-info/*
%attr(644,root,root) %{python2_sitelib}/insights_client/*.py*
%endif
%attr(640,root,root) /var/log/insights-client
%attr(644,root,root) /var/lib/insights
%doc
%defattr(-, root, root)
/usr/share/man/man8/*.8.gz
/usr/share/man/man5/*.5.gz
%{_mandir}/man8/*.8.gz
%{_mandir}/man5/*.5.gz
%changelog
* Thu Oct 24 2019 Jeremy Crafts <jcrafts@redhat.com> - 3.0.8-4
- Resolves: BZ1760749
* Thu Jun 11 2020 Link Dupont <link@redhat.com> - 3.0.14-2
- Backport patch that fixes shellcheck warnings (RHCLOUD-6204)
* Wed Apr 29 2020 Link Dupont <link@redhat.com> - 3.0.14-1
- Removed printing to stdout in cron script (RHBZ#1828778)
- Add deprecation message when running legacy redhat-access-insights (RHCLOUD-5409)
- Update systemd timer to use timers.target (RHBZ#1798373)
- Fix an issue updating motd.d on relevant systems (RHCLOUD-6144)
- Update shipped core to version 3.0.161 (RHCLOUD-4457)
- Enable automatic checking for advisor results (RHCLOUD-4558)
- Ensure dependency on coreutils for timeout (RHCLOUD-5131)
- Build system converted to autotools (RHCLOUD-4333)
* Tue Feb 11 2020 Link Dupont <link@redhat.com> - 3.0.13-1
- Resolves: RHBZ#1753991
* Fri Dec 20 2019 Jeremy Crafts <jcrafts@redhat.com> - 3.0.12-0
- Update core egg (3.0.139-1)
* Wed Dec 11 2019 Jeremy Crafts <jcrafts@redhat.com> - 3.0.10-0
- Update core egg (3.0.137-1)
- Remove insights-client-run entrypoint
- Enable timer persistence
- Fix directory permissions
- Timer/service documentation for overriding parameters
- Resolves: BZ1772027
* Thu Sep 26 2019 Jeremy Crafts <jcrafts@redhat.com> - 3.0.8-2
- Resolves: BZ1753991