From 9a1d1b25629fc099643d2dadaa8a02019fedb963 Mon Sep 17 00:00:00 2001 From: Arif Ali Date: Tue, 7 Nov 2023 13:58:25 +0200 Subject: [PATCH] [debian] Packaging and testing for debian pkgs Initial start of building and testing the deb package This will improve the overall testing of sos over the Ubuntu releases, and also helps with the basis of then adding further stagetwo testing in the future. This will help to pick up issues automatically rather than the manual testing. Co-authored-by: Nikhil Kshirsagar Signed-off-by: Nikhil Kshirsagar Signed-off-by: Arif Ali --- .cirrus.yml | 43 +- debian/changelog | 947 ++++++++++++++++++ debian/control | 28 + debian/copyright | 51 + debian/dirs | 5 + debian/docs | 1 + debian/install | 1 + .../0001-debian-change-tmp-dir-location.patch | 11 + debian/patches/series | 1 + debian/rules | 15 + debian/source/format | 1 + debian/tests/control | 3 + debian/tests/simple.sh | 272 +++++ debian/watch | 4 + 14 files changed, 1378 insertions(+), 5 deletions(-) create mode 100644 debian/changelog create mode 100644 debian/control create mode 100644 debian/copyright create mode 100644 debian/dirs create mode 100644 debian/docs create mode 100644 debian/install create mode 100644 debian/patches/0001-debian-change-tmp-dir-location.patch create mode 100644 debian/patches/series create mode 100755 debian/rules create mode 100644 debian/source/format create mode 100644 debian/tests/control create mode 100755 debian/tests/simple.sh create mode 100644 debian/watch diff --git a/.cirrus.yml b/.cirrus.yml index acff84333c..dadb041635 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -115,6 +115,25 @@ rpm_build_task: path: ./sos_${BUILD_NAME}.rpm type: application/octet-stream +# Make sure a user can manually build a snap from the checkout +deb_build_task: + alias: "deb_build" + name: "deb Build From Checkout" + gce_instance: + image_project: "${UBUNTU_PROJECT}" + image_name: "${UBUNTU_IMAGE_NAME}" + type: e2-medium + setup_script: | + apt update + apt -y install devscripts dh-python python3-nose python3-pip + pip3 install avocado-framework==94.0 + main_script: | + DEBEMAIL=noreply@canonical.com dch -v "$(git describe --tags --always)" "Cirrus Testing" + dpkg-buildpackage -b -us -uc -rfakeroot -m --build-by="noreply@canonical.com" + prep_artifacts_script: mv ../*.deb ./sos_cirrus.deb + packages_artifacts: + path: ./sos_cirrus.deb + # Make sure a user can manually build a snap from the checkout snap_build_task: alias: "snap_build" @@ -146,6 +165,7 @@ report_stageone_task: depends_on: - rpm_build - snap_build + - deb_build gce_instance: *standardvm matrix: - env: *centos9 @@ -156,24 +176,36 @@ report_stageone_task: PROJECT: ${UBUNTU_PROJECT} BUILD_NAME: ${UBUNTU_NAME} VM_IMAGE_NAME: ${UBUNTU_IMAGE_NAME} + PKG: "snap" - env: &ubuntuprior PROJECT: ${UBUNTU_PROJECT} BUILD_NAME: ${UBUNTU_PRIOR_NAME} VM_IMAGE_NAME: ${UBUNTU_PRIOR_IMAGE_NAME} + PKG: "snap" - env: &ubuntuprior2 PROJECT: ${UBUNTU_PROJECT} BUILD_NAME: ${UBUNTU_PRIOR2_NAME} VM_IMAGE_NAME: ${UBUNTU_PRIOR2_IMAGE_NAME} + PKG: "snap" + - env: &ubuntu-deb + <<: *ubuntu + PKG: "deb" setup_script: &setup | if [ $(command -v apt) ]; then - echo "$ARTCURL/snap%20Build%20From%20Checkout/packages/sosreport_test_amd64.snap" - $ARTCURL/snap%20Build%20From%20Checkout/packages/sosreport_test_amd64.snap apt -y purge sosreport apt update --allow-releaseinfo-change apt -y install python3-pip snapd - systemctl start snapd - snap install ./sosreport_test_amd64.snap --classic --dangerous - snap alias sosreport.sos sos + if [ ${PKG} == "snap" ] ; then + echo "$ARTCURL/snap%20Build%20From%20Checkout/packages/sosreport_test_amd64.snap" + $ARTCURL/snap%20Build%20From%20Checkout/packages/sosreport_test_amd64.snap + systemctl start snapd + snap install ./sosreport_test_amd64.snap --classic --dangerous + snap alias sosreport.sos sos + elif [ ${PKG} == "deb" ]; then + echo "$ARTCURL/deb%20Build%20From%20Checkout/packages/sos_cirrus.deb" + $ARTCURL/deb%20Build%20From%20Checkout/packages/sos_cirrus.deb + apt -y install ./sos_cirrus.deb + fi fi if [ $(command -v dnf) ]; then echo "$ARTCURL/rpm%20Build%20From%20Checkout%20-%20${BUILD_NAME}/packages/sos_${BUILD_NAME}.rpm" @@ -205,6 +237,7 @@ report_stagetwo_task: - env: *centos8 - env: *fedora - env: *ubuntu + - env: *ubuntu-deb setup_script: *setup install_pexpect_script: | if [ $(command -v apt) ]; then diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000000..d4e84c8319 --- /dev/null +++ b/debian/changelog @@ -0,0 +1,947 @@ +sosreport (4.5.6-0ubuntu2) mantic; urgency=medium + + * d/tests/simple.sh: + - Correct typo in test_mask to print ip address + (LP: #2037873) + + * d/p/0002-obfuscate-netplan-ssid-password.patch: + - Obfuscate SSID password in netplan/XX.yaml files + (LP: #2037872) + + -- Nikhil Kshirsagar Tue, 03 Oct 2023 05:43:23 +0000 + +sosreport (4.5.6-0ubuntu1) mantic; urgency=medium + + * New 4.5.6 upstream. (LP: #2028327) + + * For more details, full release note is available here: + - https://github.com/sosreport/sos/releases/tag/4.5.6 + + * Former patches, now fixed: + - d/p/0002-regex-flags.patch + + * Remaining patches: + - d/p/0001-debian-change-tmp-dir-location.patch + + -- Nikhil Kshirsagar Fri, 21 Jul 2023 08:04:22 +0000 + +sosreport (4.5.4ubuntu1) mantic; urgency=medium + + * New 4.5.4 upstream. (LP: #2022915) + + * For more details, full release note is available here: + - https://github.com/sosreport/sos/releases/tag/4.5.4 + + * d/rules: + - skip running unittests/policy_tests.py due to the avocado dependency + + * Remaining patches: + - d/p/0001-debian-change-tmp-dir-location.patch + + * New patches: + - d/p/0002-regex-flags.patch + + -- Nikhil Kshirsagar Tue, 13 Jun 2023 07:15:42 +0000 + +sosreport (4.5.3ubuntu2) mantic; urgency=medium + + * d/control: + - Add 'python3-magic' to runtime depends. + + -- Nikhil Kshirsagar Fri, 05 May 2023 12:37:54 +0000 + +sosreport (4.5.3ubuntu1) mantic; urgency=medium + + * New 4.5.3 upstream. (LP: #2018270) + + * For more details, full release note is available here: + - https://github.com/sosreport/sos/releases/tag/4.5.3 + + * d/control: + - Add 'python3-magic' as part of the build depends. + - Add 'python3-pexpect' as part of the build depends. + + * Remaining patches: + - d/p/0001-debian-change-tmp-dir-location.patch + + -- Nikhil Kshirsagar Tue, 02 May 2023 05:05:50 +0000 + +sosreport (4.5-1ubuntu0) lunar; urgency=medium + + * New 4.5.1 upstream. (LP: #2009338) + + * For more details, full release note is available here: + - https://github.com/sosreport/sos/releases/tag/4.5.0 + - https://github.com/sosreport/sos/releases/tag/4.5.1 + + * d/control: + - Add 'python3-magic' as part of the build depends. + + * Remaining patches: + - d/p/0001-debian-change-tmp-dir-location.patch + + -- Nikhil Kshirsagar Mon, 06 Mar 2023 06:10:48 +0000 + +sosreport (4.4-1ubuntu2) lunar; urgency=medium + + * Adjust version number to fix the upgrade path + (jammy/kinetic/lunar) (LP: #1995234) + + -- Mauricio Faria de Oliveira Tue, 08 Nov 2022 10:14:00 -0300 + +sosreport (4.4-1ubuntu0) kinetic; urgency=medium + + * New 4.4 upstream. (LP: #1986611) + + * For more details, full release note is available here: + - https://github.com/sosreport/sos/releases/tag/4.4 + + * Former patches, now fixed: + - d/p/0002-fix-setup-py.patch + - d/p/0003-mention-sos-help-in-sos-manpage.patch + + * d/control: + - Add 'python3-magic' as part of the build depends. + + * Remaining patches: + - d/p/0001-debian-change-tmp-dir-location.patch + + -- Nikhil Kshirsagar Wed, 17 Aug 2022 08:38:30 +0000 + +sosreport (4.3-1ubuntu2) jammy; urgency=medium + + * d/p/0003-mention-sos-help-in-sos-manpage.patch: + Fix sos-help manpage. + + -- Eric Desrochers Wed, 16 Feb 2022 13:05:13 -0500 + +sosreport (4.3-1ubuntu1) jammy; urgency=medium + + * New 4.3 upstream. (LP: #1960996) + + * For more details, full release note is available here: + - https://github.com/sosreport/sos/releases/tag/4.3 + + * New patches: + - d/p/0002-fix-setup-py.patch: + Add python sos.help module, it was miss in + upstream release. + + * Former patches, now fixed: + - d/p/0002-report-implement_estimate-only.patch + - d/p/0003-ceph-add-support-for-containerized-ceph-setup.patch + - d/p/0004-ceph-split-plugin-by-components.patch + - d/p/0005-openvswitch-get-userspace-datapath-implementations.patch + - d/p/0006-report-check-for-symlink-before-rmtree.patch + + * Remaining patches: + - d/p/0001-debian-change-tmp-dir-location.patch: + + -- Eric Desrochers Tue, 15 Feb 2022 23:10:27 -0500 + +sosreport (4.2-1ubuntu2) jammy; urgency=medium + + * d/p/0006-report-check-for-symlink-before-rmtree.patch: + - Fixing --estimate-only option by checking if the dirs + are also symlink before performing rmtree() method so + that unlink() method can be used instead. + + -- Eric Desrochers Tue, 19 Oct 2021 14:20:44 -0400 + +sosreport (4.2-1ubuntu1) jammy; urgency=medium + + * New 4.2 upstream release. (LP: #1941745) + - This release contains numerous improvements + and bug fixes to several components within sos, + including an overhaul to the project's test suite + and infrastructure. + + * For more details, full release note is available here: + - https://github.com/sosreport/sos/releases/tag/4.2 + + * New patches: + - d/p/0002-report-implement_estimate-only.patch + - d/p/0003-ceph-add-support-for-containerized-ceph-setup.patch + - d/p/0004-ceph-split-plugin-by-components.patch + - d/p/0005-openvswitch-get-userspace-datapath-implementations.patch + + * Former patches, now fixed: + - d/p/0002-clean-prevent-parsing-ubuntu-user.patch + - d/p/0003-ubuntu-policy-fix-upload.patch + - d/p/0004-chrony-configuration-can-now-be-fragmented.patch + - d/p/0005-global-drop-plugin-version.patch + - d/p/0006-networking-check-presence-of-devlink.patch + - d/p/0007-sosnode-avoid-checksum-cleanup-if-no-archive.patch + + * Remaining patches: + - d/p/0001-debian-change-tmp-dir-location.patch + + * d/control: + - Add 'python3-coverage' as part of the build depends. + + * d/rules: + - Fix misplaced and duplicated sos.conf file in /usr/config. + + -- Eric Desrochers Mon, 18 Oct 2021 09:24:22 -0400 + +sosreport (4.1-1ubuntu3) impish; urgency=medium + + * No-change rebuild to build packages with zstd compression. + + -- Matthias Klose Thu, 07 Oct 2021 12:24:39 +0200 + +sosreport (4.1-1ubuntu2) impish; urgency=medium + + * d/p/series: + - Re-order patches in numerical order. + + * d/p/0003-ubuntu-policy-fix-upload.patch: + - Fix sos archive upload to UA Canonical server + (LP: #1923209) + + * d/p/0004-chrony-configuration-can-now-be-fragmented.patch: + - Chrony 4.0, first introduced in Hirsute, support + fragmented configuration. + + * d/p/0005-global-drop-plugin-version.patch: + - Removal of plugins versionning features as it generate + unhelpful noise. (LP: #1922925) + + * d/p/0006-networking-check-presence-of-devlink.patch: + - On certain kernel configuration, devlink cmds may + trigger the module to load automatically. This will + also prevent simple.sh, part of the autopkgtest, in + Bionic to fail due to devlink kernel conf in 4.15. + (LP: #1923661) + + * d/p/0007-sosnode-avoid-checksum-cleanup-if-no-archive.patch: + - Fixes an exception propagation from `cleanup()` + where an attempt to look for and remove a checksum + file was made when an archive was not generated. + (LP: #1923641) + + -- Eric Desrochers Mon, 26 Apr 2021 15:34:42 -0400 + +sosreport (4.1-1ubuntu1) hirsute; urgency=medium + + * New 4.1 upstream minor release. + - https://github.com/sosreport/sos/releases/tag/4.1 + + * d/test/simple.sh: + - Update the script from upstream + - Modify the script to use /tmp as a target, instead + of /var/tmp. + + * d/test/control: + - Adding isolation-machine as simple.sh wants to + interact with the kernel. + + * Former patches: + - d/p/0002-fix-dict-order-py38-incompatibility.patch + - d/p/0003-sosclean-fix-handling-of-filepath-with-archive-name.patch + - d/p/0004-sosclean-fix-tarball-skipping-regex.patch + - d/p/0005-ceph-collect-balancer-and-pg-autoscale-status.patch + - d/p/0006-rabbitmq-add-info-on-maybe-stuck-processes.patch + - d/p/0007-rabbitmq-add-10sec-timeout-to-call-to-maybestuck.patch + - d/p/0008-networking-include-ip-neigh-and-rule-info.patch + - d/p/0009-conntrack-add-conntrack-info.patch + - d/p/0010-conntrack-gather-per-namespace-data.patch + - d/p/0011-ceph-include-time-sync-status-for-ceph-mon.patch + - d/p/0012-apt-move-unattended-upgrades-log-collection.patch + - d/p/0013-bcache-add-a-new-plugin-for-bcache.patch + - d/p/0014-k8s-add-cdk-master-auth-webhook-to-journal.patch + - d/p/0015-k8s-fix-cdk-related-file-paths.patch + - d/p/0016-systemd-prefer-resolvectl-over-systemd-resolve.patch + - d/p/0017-ovn-extend-information.patch + - d/p/0018-ua-prefer-new-ua-cmd-over-the-deprecated-one.patch + - d/p/0019-ovn-fix-sbctl-cmd-execution.patch + + * Remaining patches: + - d/p/0001-debian-change-tmp-dir-location.patch + + * New patches: + - d/p/0002-clean-prevent-parsing-ubuntu-user.patch + + -- Eric Desrochers Mon, 22 Mar 2021 12:19:59 +0000 + +sosreport (4.0-1ubuntu9) hirsute; urgency=medium + + [Edward Hope-Morley] + * d/p/0019-ovn-fix-sbctl-cmd-execution.patch (LP: #1916635) + + -- Eric Desrochers Wed, 24 Feb 2021 10:40:56 -0500 + +sosreport (4.0-1ubuntu8) hirsute; urgency=medium + + * d/p/0018-ua-prefer-new-ua-cmd-over-the-deprecated-one.patch + + -- Eric Desrochers Tue, 23 Feb 2021 08:49:59 -0500 + +sosreport (4.0-1ubuntu7) hirsute; urgency=medium + + [Edward Hope-Morley] + * d/p/0017-ovn-extend-information.patch (LP: #1915072) + - Extend ovn informations + + -- Eric Desrochers Thu, 11 Feb 2021 11:06:31 -0500 + +sosreport (4.0-1ubuntu6) hirsute; urgency=medium + + [Eric Desrochers] + * d/p/0012-apt-move-unattended-upgrades-log-collection.patch + (LP: #1906302) + + [Ponnuvel Palaniyappan] + * d/p/0013-bcache-add-a-new-plugin-for-bcache.patch + (LP: #1913284) + + [Felipe Reyes] + * d/p/0014-k8s-add-cdk-master-auth-webhook-to-journal.patch + * d/p/0015-k8s-fix-cdk-related-file-paths.patch + (LP: #1913583) + + [Michael Biebl] + * d/p/0016-systemd-prefer-resolvectl-over-systemd-resolve.patch + (LP: #1913581) + + -- Eric Desrochers Fri, 29 Jan 2021 12:20:50 -0500 + +sosreport (4.0-1ubuntu5) hirsute; urgency=medium + + [Ponnuvel Palaniyappan] + * d/p/0011-ceph-include-time-sync-status-for-ceph-mon.patch: + - Ceph mons might get into time sync problems if ntp/chrony + isn't installed or configured correctly. Since Luminous + release, upstream support 'time-sync-status' to detect this + more easily. (LP: #1910264) + + -- Eric Desrochers Tue, 05 Jan 2021 11:18:38 -0500 + +sosreport (4.0-1ubuntu4) hirsute; urgency=medium + + [Hemanth Nakkina] + * d/p/0009-conntrack-add-conntrack-info.patch: rename the + conntrackd plugin to conntrack; add conntrack commands. + (LP: #1898077) + + [Mauricio Oliveira] + * d/p/0010-conntrack-gather-per-namespace-data.patch: add + conntrack commands for network namespaces. + + -- Mauricio Faria de Oliveira Mon, 23 Nov 2020 15:10:12 -0300 + +sosreport (4.0-1ubuntu3) hirsute; urgency=medium + + [Edward Hope-Morley] + * d/p/0008-networking-include-ip-neigh-and-rule-info.patch: + - Include ns ip neigh and ip rule info. (LP: #1901555) + + -- Eric Desrochers Mon, 26 Oct 2020 11:04:41 -0400 + +sosreport (4.0-1ubuntu2) groovy; urgency=medium + + [Nicolas Bock] + * d/p/0007-rabbitmq-add-10sec-timeout-to-call-to-maybestuck.patch: + - Add 10 second timeout to call to `maybe_stuck()`. + + -- Eric Desrochers Mon, 21 Sep 2020 10:47:11 -0400 + +sosreport (4.0-1ubuntu1) groovy; urgency=medium + + [Eric Desrochers] + * d/p/0003-sosclean-fix-handling-of-filepath-with-archive-name.patch: + - Fixes the splitting of filepaths within the archive, + when the archive name is included in the filename + inside the archive. (LP: #1896222) + + * d/p/0004-sosclean-fix-tarball-skipping-regex.patch: + - Fix tarball skipping regex + + [Dan Hill] + * d/p/0005-ceph-collect-balancer-and-pg-autoscale-status.patch: + - Collect balancer and pg-autoscale status (LP: #1893109) + + [Nicolas Bock] + * d/p/0006-rabbitmq-add-info-on-maybe-stuck-processes.patch: + - Add information on maybe_stuck() processes for RMQ. (LP: #1890846) + + -- Eric Desrochers Fri, 18 Sep 2020 09:23:04 -0400 + +sosreport (4.0-1) unstable; urgency=medium + + * New 4.0 upstream release. + + Release information and tarballs are available at: + - https://github.com/sosreport/sos/releases/tag/4.0 + + * Other specific modifications: + - d/p/0001-debian-change-tmp-dir-location.patch + - d/p/0002-fix-dict-order-py38-incompatiblity.patch + + * d/control: Maintainer change from Louis to Eric. + + -- Eric Desrochers Wed, 19 Aug 2020 22:49:24 +0000 + +sosreport (3.9.1-1) unstable; urgency=medium + + * New 3.9.1 upstream release. + This maintenance release includes: + - New plugins: sos_extras, ovirt_engine_backup, console, + validation_framework. + - lxd plugin collections have been overhauled. + - Fixed handling of the namespace pattern for the networking + plugin. + - A basic path is now defined in Policy for all subclasses. + + Plugin API Enhancements: + - Enablement checks have been extended to include architecture + constraints. + - SoSPredicate has been extended to include architecture constraints, + as well as negative constraints for all elements. + - Plugins will now capture service status information for all services + defined in the services class attr. + + Further release information and tarballs are available at: + - https://github.com/sosreport/sos/releases/tag/3.9.1 + + * Former patches now fixed upstream: + - d/p/0001-unittest-py3-fix.patch + + * Other specific modifications: + - Include simple.sh, an upstream port of the travis test to bash, + as part of the package autopkgtest. + + -- Eric Desrochers Tue, 16 Jun 2020 12:18:58 +0000 + +sosreport (3.9-2) unstable; urgency=medium + + * debian/control: + Drop accidentally re-introduces py2 runtime dependency + + -- Eric Desrochers Mon, 17 Feb 2020 12:50:37 +0000 + +sosreport (3.9-1) unstable; urgency=medium + + * New 3.9 upstream release. + - Improved human-readable archive naming and support for archive labels + - Improved reporting of archive output and properties + - Support for automatic uploading of report archives via FTP and HTTPS + - Automatic PATH support on Ubuntu distributions + - Improved policy performance + - Improved service status collection API + - 9 new plugins: cloud_init, convert2rhel, ebpf, fwupd, login, nginx, + nvidia, openstack_tripleo + - 6 obsolete plugins removed or merged into other plugins: + katello, last, mrggrid, mrgmessg, satellite + - Significant updates to 14 plugins: dlm, dnf, ceph, foreman, gluster, + gnocchi, juju, kubernetes, logs, maas, networking, openvswitch, + python, plugins + - The openswan plugin was renamed to libreswan to reflect the active + upstream project name + - Updated Red Hat presets and new Cloud Forms preset + - Updates to networking plugin namespace handling + - Updates to the OVN plugins (ovn_central, ovn_host) + - Kernel eBPF data consolidated in a single plugin + + Further release information and tarballs are available at: + https://github.com/sosreport/sos/releases/tag/3.9 + + * Other specific modifications: + - d/p/0001-unittest-py3-fix.patch + + -- Eric Desrochers Sun, 16 Feb 2020 01:35:52 +0000 + +sosreport (3.8-1) unstable; urgency=medium + + * New 3.8 upstream release. + Contains a number of enhancements, new features and bug fixes including: + - 6 new plugins: container_log, frr, leapp, openstack_placement, qt, vdsm + - kubernetes plugin can now optionally grab logs only for certain pods + - kdump plugin will now collect initramfs content + - pulp and foreman plugins now support collecting from an external database + - sar plugin will now collect the full sar log dir + - vdsm and ovirt plugins will now collect host certificates + - openvswitch plugin will now enable on openvswitch2.* packages + - Added support for only capturing logs after a specific date, --since + option + - Fixed an issue causing high CPU utilization which slowed journal + collection + - Fixed an issue where plugins could continue executing commands after + their timeout was hit + - sosreport will no longer abort execution on Red Hat family systems when + the package manager fails to query a file list + + * Plugin API enhancements + - Plugins may now capture environment variables, which will be written to + /environment in the sos archive root + - Plugins may now write command output to subdirs within their own + sos_commands/plugin directory + - The container plugins have been updated to make use of this + functionality + - SoSPredicate usage may now be match either any or all of the provided + elements, and may mix requirements of kmods and services to determine + if a command should be collected. + + * Significant changes to the reporting system of sos + - HTML reports replaced by a Report subclass + - HTML report creation time is significantly improved + - Added a JSON formatted report option + + * Allow system changes option + - A new --allow-system-changes option has been added that will allow users + to collect certain data, even if it means the host system would be + changed. + + * Former patches now fixed upstream: + - d/p/0001-skip-py2-only-tests.patch + - d/p/archive-fix-stat-typo.patch + - d/p/avoid-distutils.diff + + -- Eric Desrochers Mon, 09 Sep 2019 15:40:31 +0000 + +sosreport (3.6-1) unstable; urgency=medium + + * New 3.6 upstream release. + major enhancements to core features and existing plugins: + + - better package manager version information + - policy support for detecting package managed files + - fixed exit status propagation + - deprecated optparse replaced with argparse + - simplified and improved SoSOptions interface + - better error handling during interactive prompting + - allow journal collection by identifier + - allow collection of journal message catalogs + - support for collecting binary file data + - more fine-grained system plugins (date etc.) + - policy defined report file name patterns + - more human-readable report file names by default + - increased default log size (25MiB vs. 10MiB) + - support for forbidden path lists and forbid logging + - support for enabling plugins by kernel module name + - support for enabling plugins by executable name + - support for collecting eBPF (bpftool) data + - support for device information via add_udev_info() + - support for detecting and reporting unpackaged binaries + - optional collection of the RPMDB + - improved archive compression level and multithreading + - default log size increased from 10MiB to 25MiB + - improved debug logging and ENOSPC handling + - major updates to the IPA plugin + - major updates to the Docker plugin + - string decoding fixes + - DNF and Yum module support + - OpenShift 3.10 support + - Python3 fixes + + Further release information and tarballs are available at: + https://github.com/sosreport/sos/releases/tag/3.6 + + * Debian specific modifications : + - Omit Python2 only unittests + - Avoid distutils in lstopo plugin + + * Former debian modifications now fixed upstream: + - d/p/0002-reset-to-expected-variable-order-for-packagemanager.patch: + - d/p/0003-fix-name-containers-is-not-defined.patch: + - Fix-string-decoding-for-debug-log-output.patch + + -- Louis Bouchard Mon, 24 Sep 2018 09:24:07 +0000 + +sosreport (3.5-1ubuntu4) cosmic; urgency=medium + + * d/p/Fix-string-decoding-for-debug-log-output.patch: + Fix bug in _collect_strings that causes error trying to str.decode() + (LP: #1761442) + + -- Dan Streetman Tue, 05 Jun 2018 10:52:56 -0400 + +sosreport (3.5-1ubuntu3) bionic; urgency=medium + + * Avoid using distutils during runtime. + + -- Matthias Klose Thu, 12 Apr 2018 10:48:13 +0200 + +sosreport (3.5-1ubuntu2) bionic; urgency=medium + + * d/p/0003-fix-name-containers-is-not-defined.patch: + "containers" is an unknown variable, "insp" is the correct one. + + -- Eric Desrochers Mon, 15 Jan 2018 18:39:54 -0500 + +sosreport (3.5-1ubuntu1) bionic; urgency=medium + + * d/p/0002-reset-to-expected-variable-order-for-packagemanager.patch: + Fixing severe regression where many "packages = " lines are no + longer working in Debian/Ubuntu. Preventing automatic package detection. + + -- Eric Desrochers Tue, 05 Dec 2017 17:04:34 +0000 + +sosreport (3.5-1) unstable; urgency=medium + + * testNew upstream release v3.5 + New Features include : + New plugins for : + * perl + * boom + * vdo + * os_net_config + * conntrackd + * ovirt_imageio + * nss + * sas3ircu + * openstack_aodh + * docker_distribution + * gluster_block + * snappy + + Plugin API enhancements + * Plugin triggers by executable name + * Improved log size limit handling + * Better handling of compressed log files + * Per-plugin package verification lists + + Updates to 227 plugins + + * Debian modifications : + - Addition of DEP8 tests + - Do not run Python2 only tests + + -- Louis Bouchard Thu, 16 Nov 2017 12:53:34 +0100 + +sosreport (3.4-1) unstable; urgency=medium + + * New upstream release v3.4 + New Features include : + New plugins for : + * virt-who + * nodejs + * npm + * dracut + * juju 2.0 + * grafana + * nfsganesha + * collectd + * canonical_livepatch + * jars + * salt + * saltmaster + * storageconsole + * gnocchi + * crypto + * azure/Red Hat + * zfs + Plugin API enhancements + Internationalisation updates + + * Debian modifications : + - Addition of DEP8 tests + - Do not run Python2 only tests + - d/p/0002-iscsi-Enable-plugin-for-Ubuntu-and-Debian.patch: + Take into account the iscsi initiator config and logs + + -- Louis Bouchard Wed, 05 Apr 2017 13:30:22 +0200 + +sosreport (3.3+git50-g3c0349b-3) unstable; urgency=medium + + * d/p/0003-iscsi-Enable-plugin-for-Ubuntu-and-Debian.patch: + Take into account the iscsi initiator config and logs (LP: #1605243) + + -- Louis Bouchard Thu, 16 Feb 2017 16:32:07 +0100 + +sosreport (3.3+git50-g3c0349b-2) unstable; urgency=medium + + * Fix sosreport displaying the wrong version number when + executed (Closes: #850922) + * Raise the standard version to 3.9.8 + + -- Louis Bouchard Wed, 11 Jan 2017 10:43:37 +0100 + +sosreport (3.3+git50-g3c0349b-1) unstable; urgency=medium + + New release to allign to upstream release : + * make class method instance names consistent + * handle SIGTERM correctly in plugin setup()/collect() phases + * Mention python3 and update Ubuntu note. + * replace cluster plugin by dlm in sosreport help + * plugin tracebacks when net-tools not installed + * [sssd] Retrieve drop directory conf files + * [openstack_sahara] capture all sahara* sudoers files + * [systemd] Collect detailed runtime info on each unit + * [juju] Get Ready for 2.0 and make it less likely to get too much + * [dracut] add new plugin + * [insights] Update some verbiage and collect all log files. + * [docs] document use of --config with in-tree builds + * [docker] Gather more data and expand plugin options + * [osma] add omreport storage controller + * [atomichost] fix collection of 'docker info' output + * improve 'atomic info' collection loop + * replace custom logic with Policy.in_container() + * fix option list style + * [grub2] grub2-mkconfig loads ext4 and brctl kernel modules + * [ceph] skip collecting of all keyring and bindpass files + * new plugin npm : get project modules and globally installed modules + * new plugin nodejs: get runtime info + * new plugin virtwho: for virt-who agent + + Debian specific changes : + * Fix mknod error in systemd plugin when sosreport is running + in LXC containers + + -- Louis Bouchard Thu, 08 Dec 2016 12:37:48 +0100 + +sosreport (3.3-1) unstable; urgency=medium + + * New upstream release. This release includes a number of enhancements, + new features, and bug fixes, including: + + - Support for OpenShift Enterprise 3.x + - Improved and expanded OpenStack plugins + - Enhanced support for Open vSwitch + - Enhanced Kubernetes data collection + - Improved support for systemd journal collection + - Policy support for the SuSE family of Linux distributions + - Policy support for the IBMKvm hypervisor distribution + - Enhanced display manager and 3D acceleration data capture + - Improved support for Linux clusters, including Pacemaker + - Expanded CPU and NUMA topology collection + - Expanded mainframe (s390x) coverage + - Collection of multipath topology + + * Debian modifications : + - Addition of DEP8 tests + - Do not run Python2 only tests + + -- Louis Bouchard Tue, 05 Jul 2016 10:04:55 +0200 + +sosreport (3.2+git276-g7da50d6-3) sid; urgency=medium + + * Fix CVE-2015-7529 - predictable tmp files usage + + -- Louis Bouchard Thu, 10 Dec 2015 14:17:18 +0100 + +sosreport (3.2+git276-g7da50d6-2) sid; urgency=medium + + * Added comprehensive changelog for previous upload + * [activemq] - Honour all_logs and get config on RHEL + * [apache] - Added collection of conf.modules.d dir for httpd 2.4 + * [apparmor] - Capture AppArmor profiles and status + * [apport] - Add information on specific crashes + - Move apport logging to apport plugin + * [atomic] - Add plugin for Atomic Host + * [block] - add 'blockdev --report' + - collect /proc/diskstats + * [boot] - Collect efibootmgr output + * [ceph] - add calamari-server and librados2 to the package list (upstream/pmoravec-ceph-update) + - add logs, report and calamari conf + * [chrony] - add chrony plugin + * [cluster] - add a couple pcs commands to the cluster plugin + - add luci to packages for standalone luci servers + - enable crm_report password scrubbing (upstream/sbradley-cluster_scrub_passwords) + * [corosync] - add postprocessing for corosync-objctl output + * [corosync/pacemaker] - Collect corosync-cfgtool -s output / add Pacemaker support + * [devices] - New plugin to collect "udevadm info --export-db" + * [docker] - add 'docker' to the package list for Red Hat distros + - use splitelines() for command output + * [docs] - add --chroot to sosreport.1 + - add --experimental to sosreport.1 + - Add prominent link to user focused docs + - add -s/--sysroot to sosreport.1 + - fix documentation of --sysroot parameter + - update man page for new options + * [dpkg] - Collect debconf db, add verify and all logs options + * [etcd] - split etcd functionality from kubernetes into new plugin + * [firewalld] - work around command hangs in container environments + * [foreman] - Skip collection of generic resources + * [gdm] - add journalctl logs and systemctl status + * [general] - Better handling --name and --ticket-number in interactive mode + * [global] - make all utf-8 handling use errors='ignore' + * [infiniband] - add opensm and infiniband-diags support + * [iprconfig] - add plugin for IBM Power RAID adapters + * [iscsi] - get iscsiadm -m node -P 1 instead of -P 3 + * [juju] - add generate-bundle option + - Update log collection to have limits + * [kernel] - collect directory listings for module updates + - collect /sys/firmware/acpi/* + - Collect clock source for all kernels + * [kimchi] - add new plugin + * [kubernetes] - add journal output for kube services + - add services and pod logs collection + - Change 'minions' to 'nodes'. + - new plugin + * [landscape] - 15.01 moves logs files to landscape-server + - Collect landscape status + - Move landscape logs, add server support + * [last] - information about login actions + * [libvirt] - add listing of /var/lib/libvirt/qemu + - Collect XML files from /var/run/libvirt + * [lightdm] - add plugin + * [logs] - add to storage profile + - Implement all-logs, limits and small fixes. + - Remove passwords from rsyslog + * [manageiq] - New plugin for ManageIQ + * [memory] - add ksm, swap and vmallocinfo data to plugin + - collect swapon --show output in bytes + * [monit] - add new plugin for monit monitoring + * [mpt] - add plugin + * [mysql] - Collect log file (upstream/sbradley-mysql_config_file) + - improve handling of dbuser, dbpass and MYSQL_PWD + - obtain dbpass from the environment + - test for boolean values in user and password options + * [navicli] - catch exception if input is unreadable + * [networking] - add ethtool -d + - additional ip, firewall and traffic shaping commands + - brctl command is run when bridge kernel module is loaded only + - Collect "ethtool -T $NIC" + - Collect plotnetcfg output. + - Enable the networking on debian based systems + - gather per-namespace ip and ethtool data + - improve readability of nmcli handling + - iptables: check module version and do ipv6 + - nmcli status is obtained from the output + - re-add 'ip addr' with a root symlink + * [ntp] - Collect "ntpq -p" output + * [openshift] - collect additional config files + - Obfuscate DNS plugin credentials + - Obfuscate only DNS plugin credential values + * [openstack] - Add new controller and compute profiles. + - Ensure openstack passwords and secrets are obfuscated. + - New Ironic plugin. + - New openstack_instack plugin. + - New Openstack Trove (DBaaS) plugin. + * [openstack_glance] - ensure class naming is consistent + * [openstack_heat] - ensure class naming is consistent + * [openstack_horizon] - Only use regex against configuration files + - fix legacy component detection test (upstream/bmr-openstack_neutron-pkgcheck) + - obfuscate server_auth in restproxy.ini + - Obscure passwords and secrets + * [openstack_nova] - Limit log collection to .log files by default + * [openstack_sahara] - add new plugin + - redact secrets from sahara configuration + * [openstack_swift] - capture all swift logs + * [openvswitch] - Capture additional output for OVS bridges. + - capture the logs + - dump and capture the database + * [ovirt] - Collect engine tunables and domain information. + - obfuscate passwords in aaa profiles + - remove ovirt-engine setup answer file password leak + - remove password leak from engine setup answer file + - remove password leak from ovirt-engine setup answer file + * [pci] - simplify lspci collection + * [pcp] - collect /etc/pcp.conf + * [rabbitmq] - Added cluster_status command output + * [policies] - add container support to Red Hat policy + - Add support for IBM PowerKVM/ZKVM platform + - run PackageManager query_command under timeout + * [policies/redhat] - add Red Hat Atomic Host policy + * [policies/redhat] - automatically set tmp_dir in containers + * [postgresql] - don't warn if dbname is not set + * [powerpc] - allow PowerPC plugin to run on ppc64le + * [process] - Collect few "ps" outputs + - collect /proc/sched_debug + * [ptp] - Add new plugin for Precision time protocol + * [puppet] - adding new plugin for puppet (upstream/sbradley-puppet-new_plugin) + * [qpid_dispatch] - add new plugin for Qpid Dispatch + * [rabbitmq] - Add list_policies output for the default virtual host. + * [saphana] - add SAP HANA plugin + * [sapnw] - Add check if saphostctrl is not present + - add SAP NetWeaver plugin + - add 'sapnw' as member of the 'sap' profile + - add sybase ASE collection + * [satellite] - remove explicit gathering of Tomcat info + * [selinux] - capture process SELinux domains + - fixfiles produces no useful output, use restorecon + * [services] - add "ls /var/lock/subsys" + * [sosreport] - add --chroot option + - add --sysroot option + - disable the 'zip' compression type + - log plugin exceptions to a file + * [sosreport,plugin] - add --experimental and ExperimentalPlugin tag + * [squid] - collect logs from /var/log/squid + * [startup] - rename plugin to 'services' + * [systemd] - Collect timedatectl for timezone + - Enable the plugin for Debian and Ubuntu + * [sysvipc] - Collect "ipcs -u" + * [targetcli] - add plugin + * [tomcat] - add support for tomcat7 and log size limits + * [tuned] - Collect additional configurations files and profiles. (upstream/sbradley-tuned_config_files) + * [unity] - new plugin to collect unity-support-status + * [vhostmd] - add new plugin + - add plugin to the system and virt profiles + * [virsh] - add new plugin + * [x11] - Add xrandr and glxinfo output + * [yum] - add output for yum history + - add subscription-manager identity output + - call rhsm-debug with --no-subscriptions + - split out subscription-manager into its own plugin + + -- Louis Bouchard Tue, 08 Dec 2015 15:52:02 +0100 + +sosreport (3.2+git276-g7da50d6-1) sid; urgency=medium + + * New release that brings in line sosreport with latest + upstream trunk (commit 7da50d6ee5afce577f02339fdc285891c8485bc0) + * Fix FTBS on debian + (Closes: ##805247) + + -- Louis Bouchard Wed, 25 Nov 2015 14:59:15 +0100 + +sosreport (3.2-1) unstable; urgency=medium + + * Profiles for plugin selection + * Improved log size limiting + * File archiving enhancements and robustness improvements + * Global plugin options: + --verify, --log-size, --all-logs + * Better plugin descriptions + * Improved journalctl log capture + * PEP8 compliant code base + * oVirt support improvements + * New plugins: hpasm, ctdb, dbus, oVirt engine hosted, + MongoDB, ActiveMQ, OpenShift 2.0, MegaCLI, FCoE, + python, Ubuntu, NUMA, Team network driver + + -- Adam Stokes Sun, 12 Oct 2014 12:47:23 -0400 + +sosreport (3.1-1) unstable; urgency=low + + * New upstream release v3.1 + Features include: + - Full Python 3 support + - Further modularized openstack plugins + * debian/rules: + - Use pybuild + * debian/control: + - Use X-Python-Version: >= 3.3 + + -- Adam Stokes Wed, 15 Jan 2014 16:58:54 -0500 + +sosreport (3.0-1) unstable; urgency=low + + * New upstream release v3.0 + Features include: + - Openstack, MAAS, Juju, and other cloud technologies + - Extended policies to allow for easier cross distribution support. + - Cross distribution support for Debian, Ubuntu, Fedora, and + Red Hat Enterprise Linux + - Increase execution speed of plugins + * Fixes traceback error in the utilities log (Closes: #717401) + * debian/copyright: + - Add Company contributions notices in AUTHORS file. + * setup.py: + - Added to support packaging python modules via distutils. + * debian/rules: + - Fix build instructions to package sosreport as a private module. + * debian/control: + - Use XS-Python-Version and remove debian/pyversions. + * tests/archive_tests.py: + - Update unittests to work with latest api changes in the new release. + + -- Adam Stokes Sun, 21 Jul 2013 20:35:04 -0400 + +sosreport (2.3~git20130509-1) unstable; urgency=low + + * Package updated from git rev 395ad13da8 + Closes: #698329 + + -- Adam Stokes Fri, 31 May 2013 12:12:46 -0400 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000000..6542e97d69 --- /dev/null +++ b/debian/control @@ -0,0 +1,28 @@ +Source: sosreport +Maintainer: Nikhil Kshirsagar +Section: admin +Priority: optional +Standards-Version: 4.5.1 +Build-Depends: + debhelper-compat (= 13), + dh-python, + gettext, + python3-all, + python3-coverage, + python3-nose, + python3-setuptools, + python3-sphinx, + python3-magic, + python3-pexpect, +Homepage: https://github.com/sosreport/sos +Vcs-Browser: https://salsa.debian.org/sosreport-team/sosreport +Vcs-Git: https://salsa.debian.org/sosreport-team/sosreport.git + +Package: sosreport +Architecture: any +Depends: ${python3:Depends}, ${misc:Depends}, python3-pexpect, python3-magic +Description: Set of tools to gather troubleshooting data from a system + Sos is a set of tools that gathers information about system + hardware and configuration. The information can then be used for + diagnostic purposes and debugging. Sos is commonly used to help + support technicians and developers. diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000000..39bf84f40c --- /dev/null +++ b/debian/copyright @@ -0,0 +1,51 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: sosreport +Upstream-Contact: Bryn M. Reeves +Source: https://github.com/sosreport/sos + +Files: * +Copyright: 2012-2013 Bryn M. Reeves + 2007-2013 Red Hat, Inc. +License: GPL-2+ + +Files: sos/report/plugins/kernelrt.py +Copyright: 2012 Red Hat, Inc. +License: GPL-2 + +Files: debian/* +Copyright: 2013 Adam Stokes +License: GPL-2+ + +License: GPL-2 + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; version 2. + . + This application is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + . + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, + USA. + +License: GPL-2+ + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or (at + your option) any later version. + . + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + . + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, + USA. + . + On Debian systems, the complete text of the GNU General Public + License, version 2, can be found in /usr/share/common-licenses/GPL-2. diff --git a/debian/dirs b/debian/dirs new file mode 100644 index 0000000000..78757791d7 --- /dev/null +++ b/debian/dirs @@ -0,0 +1,5 @@ +/etc/sos +/etc/sos/cleaner +/etc/sos/extras.d +/etc/sos/groups.d +/etc/sos/presets.d diff --git a/debian/docs b/debian/docs new file mode 100644 index 0000000000..475d728a0e --- /dev/null +++ b/debian/docs @@ -0,0 +1 @@ +README.md AUTHORS diff --git a/debian/install b/debian/install new file mode 100644 index 0000000000..a54b194084 --- /dev/null +++ b/debian/install @@ -0,0 +1 @@ +sos.conf etc/sos/ diff --git a/debian/patches/0001-debian-change-tmp-dir-location.patch b/debian/patches/0001-debian-change-tmp-dir-location.patch new file mode 100644 index 0000000000..29ddefa7d8 --- /dev/null +++ b/debian/patches/0001-debian-change-tmp-dir-location.patch @@ -0,0 +1,11 @@ +Description: Change default location to /tmp +--- a/sos.conf ++++ b/sos.conf +@@ -7,6 +7,7 @@ + #verify = yes + #batch = yes + #log-size = 15 ++tmp-dir = /tmp + + [report] + # Options that will apply to any `sos report` run should be listed here. diff --git a/debian/patches/series b/debian/patches/series new file mode 100644 index 0000000000..3d9fdd4166 --- /dev/null +++ b/debian/patches/series @@ -0,0 +1 @@ +0001-debian-change-tmp-dir-location.patch diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000000..79b75aad9e --- /dev/null +++ b/debian/rules @@ -0,0 +1,15 @@ +#!/usr/bin/make -f + +export PYBUILD_NAME=sosreport + +%: + dh $@ --with python3 --buildsystem=pybuild + +override_dh_install: + # Move config file to the right location. + mv debian/sosreport/usr/config/sos.conf debian/sosreport/etc/sos/sos.conf + # Remove unnecessary unused dir. + rm -rf debian/sosreport/usr/config + +override_dh_auto_test: + nosetests3 -v --with-cover --cover-package=sos tests/unittests diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 0000000000..163aaf8d82 --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (quilt) diff --git a/debian/tests/control b/debian/tests/control new file mode 100644 index 0000000000..77909a088f --- /dev/null +++ b/debian/tests/control @@ -0,0 +1,3 @@ +Tests: simple.sh +Depends: sosreport +Restrictions: needs-root, allow-stderr, isolation-machine diff --git a/debian/tests/simple.sh b/debian/tests/simple.sh new file mode 100755 index 0000000000..8fc9b39ea2 --- /dev/null +++ b/debian/tests/simple.sh @@ -0,0 +1,272 @@ +#!/bin/bash +# This file is part of the sos project: https://github.com/sosreport/sos +# +# This copyrighted material is made available to anyone wishing to use, +# modify, copy, or redistribute it subject to the terms and conditions of +# version 2 of the GNU General Public License. +# +# See the LICENSE file in the source distribution for further information. +# A quick port of the travis tests to bash, requires root +# TODO +# * look into using a framework.. +# * why --dry-run fails? +# * why --experimental fails? +# * make it better validate archives and contents + +PYTHON=${1:-/usr/bin/python3} +SOSPATH=${2:-./bin/sos report --batch --tmp-dir=/tmp } + +NUMOFFAILURES=0 +summary="\nSummary\n" +FAIL_LIST="" + +run_expecting_success () { + #$1 - is command options + #$2 - kind of check to do, so far only extract + FAIL=false + # Make sure clean + rm -f /dev/shm/stderr /dev/shm/stdout /tmp/sosreport*.tar.* + rm -rf /tmp/sosreport_test/ + + start=`date +%s` + echo "######### RUNNING $1 #########" + $PYTHON $SOSPATH $1 2> /dev/shm/stderr 1> /dev/shm/stdout + + if [ $? -eq 0 ]; then + echo "### Success" + else + echo "!!! FAILED !!!" + add_failure "$1 failed during execution" + fi + + end=`date +%s` + runtime=$((end-start)) + echo "#### Sos Total time (seconds):" $runtime + + if [ -s /dev/shm/stderr ]; then + add_failure "test generated stderr output, see above" + echo "### start stderr" + cat /dev/shm/stderr + echo "### end stderr" + fi + + echo "### start stdout" + cat /dev/shm/stdout + echo "### end stdout" + + if [ "extract" = "$2" ]; then + echo "### start extraction" + rm -f /tmp/sosreport*sha256 + mkdir /tmp/sosreport_test/ + tar xfa /tmp/sosreport*.tar* -C /tmp/sosreport_test --strip-components=1 + if [ -s /tmp/sosreport_test/sos_logs/*errors.txt ]; then + FAIL=true + echo "!!! FAILED !!!" + add_failure "Test $1 generated errors" + echo "#### *errors.txt output" + ls -alh /tmp/sosreport_test/sos_logs/ + cat /tmp/sosreport_test/sos_logs/*errors.txt + fi + echo "### stop extraction" + fi + + echo "######### DONE WITH $1 #########" + + if $FAIL; then + NUMOFFAILURES=$(($NUMOFFAILURES + 1)) + return 1 + else + return 0 + fi +} + +update_summary () { + size="$(grep Size /dev/shm/stdout)" + size="$(echo "${size:-"Size 0.00MiB"}")" + summary="${summary} \n failures ${FAIL} \t time ${runtime} \t ${size} \t ${1} " +} + +update_failures () { + if $FAIL; then + NUMOFFAILURES=$(($NUMOFFAILURES + 1)) + fi +} + +add_failure () { + FAIL=true + echo "!!! TEST FAILED: $1 !!!" + FAIL_LIST="${FAIL_LIST}\n \t ${FUNCNAME[1]}: \t\t ${1}" +} + +# Test a no frills run with verbosity and make sure the expected items exist +test_normal_report () { + cmd="-vvv" + # get a list of initial kmods loaded + kmods=( $(lsmod | cut -f1 -d ' ' | sort) ) + run_expecting_success "$cmd" extract + if [ $? -eq 0 ]; then + if [ ! -f /tmp/sosreport_test/sos_reports/sos.html ]; then + add_failure "did not generate html reports" + fi + if [ ! -f /tmp/sosreport_test/sos_reports/manifest.json ]; then + add_failure "did not generate manifest.json" + fi + if [ ! -f /tmp/sosreport_test/free ]; then + add_failure "did not create free symlink in archive root" + fi + if [ ! "$(grep "DEBUG" /tmp/sosreport_test/sos_logs/sos.log)" ]; then + add_failure "did not find debug logging when using -vvv" + fi + # new list, see if we added any + new_kmods=( $(lsmod | cut -f1 -d ' ' | sort) ) + if [ "$(printf '%s\n' "${kmods[@]}" "${new_kmods[@]}" | sort | uniq -u)" ]; then + add_failure "new kernel modules loaded during execution" + echo "$(printf '%s\n' "${kmods[@]}" "${new_kmods[@]}" | sort | uniq -u)" + fi + update_failures + update_summary "$cmd" + fi +} + +# Test for correctly skipping html generation, and label setting +test_noreport_label_only () { + cmd="--no-report --label TEST -o hardware" + run_expecting_success "$cmd" extract + if [ $? -eq 0 ]; then + if [ -f /tmp/sosreport_test/sos_reports/sos.html ]; then + add_failure "html report generated when --no-report used" + fi + if [ ! $(grep /tmp/sosreport-*TEST* /dev/shm/stdout) ]; then + add_failure "no label set on archive" + fi + count=$(find /tmp/sosreport_test/sos_commands/* -type d | wc -l) + if [[ "$count" -gt 1 ]]; then + add_failure "more than one plugin ran when using -o hardware" + fi + update_failures + fi + update_summary "$cmd" +} + +# test using mask +test_mask () { + cmd="--mask" + run_expecting_success "$cmd" extract + if [ $? -eq 0 ]; then + if [ ! $(grep host0 /tmp/sosreport_test/hostname) ]; then + add_failure "hostname not obfuscated with --mask" + fi + # we don't yet support binary obfuscation, so skip binary matches + if [ "$(grep -rI `hostname` /tmp/sosreport_test/*)" ]; then + add_failure "hostname not obfuscated in all places" + echo "$(grep -rI `hostname` /tmp/sosreport_test/*)" + fi + # only tests first interface + mac_addr=$(cat /sys/class/net/$(ip route show default | awk '/default/ {print $5}')/address) + if [ "$(grep -rI $mac_addr /tmp/sosreport_test/*)" ]; then + add_failure "MAC address not obfuscated in all places" + echo "$(grep -rI $mac_addr /tmp/sosreport_test/*)" + fi + # only tests first interface + ip_addr=$(ip route show default | awk '/default/ {print $3}') + if [ "$(grep -rI $ip_addr /tmp/sosreport_test/*)" ]; then + add_failure "IP address not obfuscated in all places" + echo "$(grep -rI $ip_addr /tmp/sosreport_test/*)" + fi + update_failures + fi + update_summary "$cmd" +} + +# test log-size, env vars, and compression type +test_logsize_env_gzip () { + cmd="--log-size 0 --no-env-vars -z gzip" + run_expecting_success "$cmd" extract + if [ $? -eq 0 ]; then + if [ -f /tmp/sosreport_test/environment ]; then + add_failure "env vars captured when using --no-env-vars" + fi + if [ ! $(grep /tmp/sosreport*.gz /dev/shm/stdout) ]; then + add_failure "archive was not gzip compressed using -z gzip" + fi + update_failures + fi + update_summary "$cmd" +} + +# test plugin enablement, plugopts and at the same time ensure our list option parsing is working +test_enable_opts_postproc () { + cmd="-e opencl -v -k kernel.with-timer,libraries.ldconfigv --no-postproc" + run_expecting_success "$cmd" extract + if [ $? -eq 0 ]; then + if [ ! "$(grep "opencl" /dev/shm/stdout)" ]; then + add_failure "force enabled plugin opencl did not run" + fi + if [ ! -f /tmp/sosreport_test/proc/timer* ]; then + add_failure "/proc/timer* not captured when using -k kernel.with-timer" + fi + if [ ! -f /tmp/sosreport_test/sos_commands/libraries/ldconfig_-v* ]; then + add_failure "ldconfig -v not captured when using -k libraries.ldconfigv" + fi + if [ "$(grep "substituting" /tmp/sosreport_test/sos_logs/sos.log)" ]; then + add_failure "post-processing ran while using --no-post-proc" + fi + + update_failures + update_summary "$cmd" + fi +} + +# test if --build and --threads work properly +test_build_threads () { + cmd="--build -t1 -o host,kernel,filesys,hardware,date,logs" + run_expecting_success "$cmd" + if [ $? -eq 0 ]; then + if [ ! "$(grep "Your sosreport build tree" /dev/shm/stdout)" ]; then + add_failure "did not save the build tree" + fi + if [ $(grep "Finishing plugins" /dev/shm/stdout) ]; then + add_failure "did not limit threads when using --threads 1" + fi + update_failures + update_summary "$cmd" + fi +} + +# If /etc/sos/sos.conf doesn't exist let's just make it +if [ -f /etc/sos/sos.conf ]; then + echo "/etc/sos/sos.conf already exists" +else + echo "Creating /etc/sos.conf" + mkdir /etc/sos + touch /etc/sos/sos.conf +fi + + +# Runs not generating sosreports +run_expecting_success " -l"; update_summary "List plugins" +run_expecting_success " --list-presets"; update_summary "List presets" +run_expecting_success " --list-profiles"; update_summary "List profiles" + +# Runs generating sosreports +# TODO: +# - find a way to test if --since is working +test_build_threads +test_normal_report +test_enable_opts_postproc +test_noreport_label_only +test_logsize_env_gzip +test_mask + +echo -e $summary + +if [ $NUMOFFAILURES -gt 0 ]; then + echo -e "\nTests Failed: $NUMOFFAILURES\nFailures within each test:" + echo -e $FAIL_LIST + exit 1 +else + echo "Everything worked!" + exit 0 +fi + +# vim: set et ts=4 sw=4 : diff --git a/debian/watch b/debian/watch new file mode 100644 index 0000000000..fa4ded0db8 --- /dev/null +++ b/debian/watch @@ -0,0 +1,4 @@ +version=4 + opts="filenamemangle=s%(?:.*?)?v?(\d[\d.]*)\.tar\.gz%sos-$1.tar.gz%" \ + https://github.com/sosreport/sos/tags \ + (?:.*?/)?v?(\d[\d.]*)\.tar\.gz debian uupdate