aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* [tests] add license header to source filesBryn M. Reeves2020-02-269-0/+63
| | | | | | | Resolves: #1958 Signed-off-by: Bryn M. Reeves <bmr@redhat.com> Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [tests] delete random shebangsBryn M. Reeves2020-02-264-8/+0
| | | | | | | | | | | | | Various unit test source files in tests/ have unnecessary shell "shebang" notation specifying a particular Python interpereter. Since these files are executed under the test suite runner there is no need for them to include these lines. Related: #1949 Signed-off-by: Bryn M. Reeves <bmr@redhat.com> Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [tests] remove obsolete test_exe.py scriptBryn M. Reeves2020-02-261-4/+0
| | | | | | | Related: #1949 Signed-off-by: Bryn M. Reeves <bmr@redhat.com> Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [tests] use echo instead of py script in test_{output,shell_out}()Bryn M. Reeves2020-02-261-4/+2
| | | | | | | Related: #1949 Signed-off-by: Bryn M. Reeves <bmr@redhat.com> Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [tests] compare correct string types in test_nonexe_file()Bryn M. Reeves2020-02-261-1/+1
| | | | | | | | | Use a byte string instead of a regular string. Related: #1949 Signed-off-by: Bryn M. Reeves <bmr@redhat.com> Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [tests] look for 'true' in test_exe_file() instead of py scriptBryn M. Reeves2020-02-261-2/+1
| | | | | | | | | | Use the executable 'true' when testing is_executable() on a non-absolute path. Related: #1949 Signed-off-by: Bryn M. Reeves <bmr@redhat.com> Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [policies] Set a basic path in sos.policies.PolicyBryn M. Reeves2020-02-261-1/+1
| | | | | | | | | | | | | | | | The PATH has been controlled by policy for some time. This is also used in the test suite which for performance reasons will often instantiate an abstract policy like LinuxPolicy to avoid costly repeat initialisation. Historically this has meant that the policy was set up with an empty PATH environment variable. This causes problems if the test suite attempts to resolve executable names via PATH (e.g. to test the is_executable() fn). Related: #1949 Signed-off-by: Bryn M. Reeves <bmr@redhat.com> Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [networking] namespace pattern fixJan Jansky2020-02-191-11/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixing pattern from using * to .* and also adding $ on end of each namespace. For example: if you have namespaces test1 test11 test2 test3 test333 and will use -k networking.namespace_pattern="test3 test1*" pattern will result as (?:test3$|test1.*$) and only test3, test1 and test11 will be used. Before this fix with same namespaces as above and same input parameter pattern will result as (?:test3|test1*) because of * instead of .* also test2 will be used and because of mising $ also test333 will be used. Input parameter using same syntax as before "ens* eth* test1 test5", * is wildcard in this case. Resolves: #1961 Signed-off-by: Jan Jansky <jjansky@redhat.com> Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [sos] bump release3.9Bryn M. Reeves2020-02-142-2/+5
| | | | Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* [man] Update manpage for --upload and related optionsJake Hunsaker2020-02-141-0/+56
| | | | | | | Adds manage entries for the various --upload options added as part of the previous patches adding upload functionality. Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [Policies] Fix case id being overridden by blank inputJake Hunsaker2020-02-141-4/+6
| | | | | | | | | | | Previously if `--case-id` was specific, and a user provided a blank input for the case-id prompt (when `--batch` isn't used), this would override the case id to be blank. Now we properly default to `--caseid` if it is provided if a user doesn't provide it again for the actual prompt. Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [ubuntu] Add Canonical Support file upload functionalityJake Hunsaker2020-02-141-0/+24
| | | | | | | This commit adds the needed bits to allow sos users on Ubuntu systems to upload to the Canonical Support File Server as part of PR #1911. Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [redhat] Add ability to upload to customer casesJake Hunsaker2020-02-142-2/+60
| | | | | | | | | | | | | | | | | | | Adds the ability to the Red Hat policy for users to upload archives directly to existing technical support cases on the Red Hat Customer Portal. If a case number is provided, uploading to the case is the preferred/default option the policy will take. If `--upload-user` is not provided, users will be prompted for one as well as the password for the Customer Portal account. Note that Red Hat's case management API requires that the user credentials provided here have access to the case number referenced on the Customer Portal. If a case number is not provided, or if one is provided but Customer Portal credentials are not provided, the policy will fallback to using the public dropbox location for upload. Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [redhat] Define policy-default FTP location and credentialsJake Hunsaker2020-02-141-0/+3
| | | | | | | | Adds connection and authentication defaults to the Red Hat policy to use the publicly available dropbox that Red Hat Global Support Services makes available for support cases. Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [sosreport|Policy] Add ability to upload archiveJake Hunsaker2020-02-143-1/+306
| | | | | | | | | | | | | | | | Adds the option to automatically upload a generated sosreport archive to a provided location such as HTTPS or FTP servers. Using --upload will use policy-defined defaults (if available) to upload to a specific vendor's defined location. Otherwise, users may supply --upload-url, --upload-directory, --upload-user, and --upload-pass to specify a custom location/server, directory on that server, and authentication credentials. Resolves: #1911 Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [yum] Add "yum -C repolist --verbose" command outputKyle Walker2020-02-141-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Following the upstream DNF commit below, the "yum -C repolist" command output will no longer include package count information: c4f57476 Do not load metadata for repolist commands... This information is helpful for those searching for client-side mismatches to upstream repositories. Such as in the case of two repositories, where one is missing content that another includes, this information can be crucial for determinining the source of the problem. This change includes a "yum -C repolist --verbose" command in the resulting sosreport which includes information such as the following: Repo-id : <repoid> Repo-name : <full reponame> Repo-revision : <version> Repo-updated : <datestamp> Repo-pkgs : <total repo package count> Repo-available-pkgs: <package count> Repo-size : <size> Repo-baseurl : <url> Repo-expire : <datestamp> Repo-filename : <path> Resolves: #1951 Signed-off-by: Kyle Walker <kwalker@redhat.com> Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* [archive] handle OSErrorsJan Jansky2020-02-141-0/+3
| | | | | | | | | | | | | | | If file/folder will be present during file list creation, but will be missing during collection OSError will throw exception FileNotFoundError: [Errno 2] No such file or directory Added handling of OSError into sos/archive.py and new log message with info level to sos_logs/sos.log Resolves: #1890 Signed-off-by: Jan Jansky <jjansky@redhat.com> Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* [plugins] collect missing command outputs from e51d3e6Pavel Moravec2020-02-145-5/+5
| | | | | | | | | | Commit e51d3e6 caused some commands are called but not further stored in an sosreport archive. This fixes that regression. Related: #1923 Signed-off-by: Pavel Moravec <pmoravec@redhat.com> Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* [ebpf] Collect bpftool [map|prog] list in both formatsBryn M. Reeves2020-02-141-0/+4
| | | | | | | | | | Collect and store both maps and progs list in both human readable and JSON formats. Resolves: #1923 Suggested-by: Pavel Moravec <pmoravec@redhat.com> Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* [openvswitch] Adding nuage-openvswitchDavid Vallee Delisle2020-02-141-2/+3
| | | | | | | | | | Nokia Nuage has forked upstream OVS but basically, the same commands should work. When a server is having nuage-ovs installed, we don't execute the ovs plugin because it doesn't detect the package. Signed-off-by: David Vallee Delisle <dvd@redhat.com> Resolves: #1933
* [policies] fix LinuxPolicy performance regression (test suite)Bryn M. Reeves2020-02-143-23/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 285873a introduces a regression in the performance of LinuxProfile class initialisation: commit 285873a4f753822a88d475a1b030ab622bf4c72e Author: Bryan Quigley <bryan.quigley@canonical.com> Date: Tue Feb 11 15:03:16 2020 -0800 [policies] Detect systemd use instead of hardcoding it All the patch does is to switch from testing self.init to determine whether to use the SystemdInit() class or the basic InitSystem() one, to looking for '/run/systemd/system' in the file system. This has more broad side effects than it might seem since the test suite uses LinuxPolicy() as a mock policy object for a large number of tests. Since SystemdInit() calls out to systemctl to obtain the state of the init system this both increases the run time for the tests and causes high resource use in systemd itself: PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 1 root 20 0 177196 13504 4512 R 92.7 0.1 5:24.04 systemd This causes the run time for the Python2 and 3 test suite (plus pep8/pycodestyle) to grow from ~5s to over 1m20s on my test system: 285873a~1 real 0m5.683s 285873a real 1m20.353s Allow direct users of LinuxPolicy to override the init system detection by specifying an init= kwarg initialised to an InitSystem-like object directly, and use this in the test suite to avoid the cost of initialising the full SystemdInit() class. Resolves: #1953 Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* [ebpf] set class docstringBryn M. Reeves2020-02-141-1/+2
| | | | | | | | | | | | | | The plugin does not set a class level docstring, causing it to dump the Plugin base-class documentation into --list-plugins: ebpf inactive This is the base class for sosreport plugins. Plugins should subclass this and set the class variables where applicable. [...] Related: #1952 Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* [convert2rhel] set class docstringBryn M. Reeves2020-02-141-1/+2
| | | | | | | | | | | | | | The plugin does not set a class level docstring, causing it to dump the Plugin base-class documentation into --list-plugins: convert2rhel inactive This is the base class for sosreport plugins. Plugins should subclass this and set the class variables where applicable. [...] Closes: #1952 Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* [maas] Collect journal logs and services status infosEric Desrochers2020-02-141-0/+15
| | | | | | | Resolves: #1948 Signed-off-by: Eric Desrochers <eric.desrochers@canonical.com> Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* [ebpf] minor style fixesBryn M. Reeves2020-02-141-10/+10
| | | | | | | | * Use a PEP8-style class naming * Don't pass a list for a single add_copy_spec() * Use a list for multiple commands w/add_cmd_output() Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* [ebpf] Add new plugin for eBPF commandsJose Castillo2020-02-143-40/+78
| | | | | | | | | | | | This plugin groups all bpftool commands from plugins kernel and networking, and adds a new one command 'bpftool cgroup tree', as requested by rhbz#1787586. Resolves: #1907 Related: RHBZ#1787586 Signed-off-by: Jose Castillo <jose.mfcastillo@gmail.com>
* [fwupd] new pluginMikel Olasagasti Uranga2020-02-141-0/+50
| | | | | | | | | Add a new plugin for the firmware update daemon. Resolves: #1832 Signed-off-by: Mikel Olasagasti Uranga <mikel@olasagasti.info> Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* [sosreport] fix exit status propagationBryn M. Reeves2020-02-141-2/+2
| | | | | | | | Exits that trap to the SystemExit handler in SoSReport.execute() re-set the exit code passed returned by the process. Catch the exception as 'e' and use e.code to pass on the correct value. Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* [kdump] Switch lsinitrd in favor of lsinitramfsEric Desrochers2020-02-131-1/+1
| | | | | | | | | | | | | | | lsinitramfs is more likely to be installed and useful. lsinitramfs -> initramfs-tools-core (main) -> Canonical maintain lsinitrd -> dracut-core (universe) -> Community maintain Also adding the '-l' argument to display long and more verbose listing of initramfs content. Resolves: #1942 Signed-off-by: Eric Desrochers <eric.desrochers@canonical.com> Signed-off-by: Bryan Quigley <bryan.quigley@canonical.com>
* [ceph] mimic/nautilus data collection updateDan Hill2020-02-131-2/+22
| | | | | | | | | | | | | | | | | | | | Ceph has been focusing on administrator quality of life in the latest releases. There are a number of shiny new tools/reports available that should be captured to help troubleshooting ceph clusters. This is a first pass at updating the ceph plug-in to bring it inline with upstream changes. This fix also addresses several inconsistencies in reports that were captured between mon/mgr/mds/osd/radosgw services. Further improvements are possible here, but I recommend splitting up the ceph plug-in into service-specific modules. See Issue #1945. Resolves: #1947 Signed-off-by: Dan Hill daniel.hill@canonical.com Signed-off-by: Bryan Quigley <bryan.quigley@canonical.com>
* [gdm] gdm3 configuration is found in /etc/gdm3Eric Desrochers2020-02-131-1/+4
| | | | | | | | | | $ dpkg -S /etc/gdm3 gdm3: /etc/gdm3 Resolves: #1939 Signed-off-by: Eric Desrochers <eric.desrochers@canonical.com> Signed-off-by: Bryan Quigley <bryan.quigley@canonical.com>
* [Juju] Juju Plugin RefactoringDavid Negreira2020-02-121-91/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since the current plugin is having issues when we run sosreport on a juju controller we have decided to refactor it and make it simpler. We had some discussions following three separate PRs: https://github.com/sosreport/sos/pull/1670 https://github.com/sosreport/sos/pull/1671 https://github.com/sosreport/sos/pull/1672 We decided not to gather mongodb dumps as it will leak the password from mongodb when running `ps`. We decided to drop the output from juju commands as this requires the command to be run as the user that holds the juju credentials. This plugin will gather logs from `/var/log/juju/*.log` and agent configuration files from `/var/lib/juju/agents/*/agent.conf`, as well as systemd logs related to the agents. If sosreport is run with `--all-logs` it will gather all of the above as well as all the files from `/var/lib/juju/` and `/var/log/juju`. Closes: #1653 Resolves: #1935 Co-authored-by: David Negreira david.negreira@canonical.com Co-authored-by: Nick Niehoff nick.niehoff@canonical.com Signed-off-by: David Negreira david.negreira@canonical.com Signed-off-by: Bryan Quigley <bryan.quigley@canonical.com>
* [kdump] Show current parameters and the saved kexec from last kdump-config load.Eric Desrochers2020-02-121-0/+2
| | | | | | | | | This command can be used to confirm that kdump is correctly configured. Resolves: #1941 Signed-off-by: Eric Desrochers <eric.desrochers@canonical.com> Signed-off-by: Bryan Quigley <bryan.quigley@canonical.com>
* [canonical-livepatch] Switch to add_service_status methodEric Desrochers2020-02-121-1/+2
| | | | | | | Resolves: #1940 Signed-off-by: Eric Desrochers <eric.desrochers@canonical.com> Signed-off-by: Bryan Quigley <bryan.quigley@canonical.com>
* [plugins] set default cmd timeout to add_journalPavel Moravec2020-02-121-9/+12
| | | | | | | | | | | | | add_journal calls a sos command underneath that should apply same command timeout limits like e.g. add_cmd_output method. Further, define the command timeout value of 300 seconds just on one place. Resolves: #1938, #1946 Signed-off-by: Pavel Moravec <pmoravec@redhat.com> Signed-off-by: Bryan Quigley <bryan.quigley@canonical.com>
* [InitSystem|Plugin] Add method to get service names matching regexJake Hunsaker2020-02-122-1/+12
| | | | | | | | | | | | | | | | Adds a new `get_service_names()` method to the `InitSystem` class which is then exposed to plugins via `Plugin.get_service_names()` to allow plugins to fetch a list of service names discovered on the system that match a provided regex. Included in this is a fix to avoid the header line from the discovery command being entered in the dict of known services, so that we avoid inadvertant regex matches. Resolves: #1943 Signed-off-by: Jake Hunsaker <jhunsake@redhat.com> Signed-off-by: Bryan Quigley <bryan.quigley@canonical.com>
* [openstack_horizon] fix useless forbidden pathsJose Castillo2019-11-131-1/+3
| | | | | | | | | | | | | | | | | | | The code has currently the following line: self.add_forbidden_path("*.py[co]") But add_forbidden_path() needs a directory prefix, so this won't work. This line was introduced via commit 4d75385ad to solve issue #856, that discussed the postproc method in openstack_horizon. It seems that the python object and source files are present in /etc/openstack-dashboard/local_settings.d/ used to customize the dashboard. This patch adds that directory to the add_forbidden_path() line. Closes: #1846 Signed-off-by: Jose Castillo <jose.mfcastillo@gmail.com> Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
* [sar] Don't truncate sa file even if --log-size limit is reachedMIZUTA Takeshi2020-02-121-1/+2
| | | | | | | | | | | | When sa file is truncated, it cannot be read correctly. Fix tailit specified in add_copy_spec() to False so that the sa file is not truncated. Resolves: #1871 Signed-off-by: MIZUTA Takeshi <mizuta.takeshi@fujitsu.com> Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
* [gdm] Enable plugin also by gdm3 package on UbuntuBryan Quigley2020-02-111-1/+1
| | | | | | | Resolves: #1937 Signed-off-by: Bryan Quigley <bryan.quigley@canonical.com> Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
* [policies] Detect systemd use instead of hardcoding itBryan Quigley2020-02-112-2/+2
| | | | | | | | | | This just has us the builtin option to determine if we are on systemd or not. https://www.freedesktop.org/software/systemd/man/sd_booted.html Resolves: #1936 Signed-off-by: Bryan Quigley <bryan.quigley@canonical.com>
* [gnocchi] Add support for Debian and Ubuntu.Chris Johnston2020-02-071-18/+44
| | | | | | | | | | Adds Gnocchi plugin support for Debian and Ubuntu. Fixes: #1927 Resolves: #1929 Signed-off-by: Chris Johnston <chris.johnston@canonical.com> Signed-off-by: Bryan Quigley <bryan.quigley@canonical.com>
* [java] Only run java conditionally and collect moreBryan Quigley2020-02-061-4/+7
| | | | | | | | | | | | | | | | | | | | | | | As this has been run unconditionaly to this point I choose to do both commands = java, files=/usr/bin/java and packages. There are many times Java is installed to /opt/ for say IBM's java or Oracle's Java, or someone else's java. To the same extent there are many different packages that include java so do /usr/bin/java in case we miss some. Add * to /etc/java*/ as some of the names can be different like /etc/java-13-openjdk/ Remove alternatives from root symlink - I couldn't find a reason for it to be in root, but happy to revisit. (doesn't work on Ubuntu) Add java -version. If it's in path we should at least be able to get this. Resolves: #1886 Signed-off-by: Bryan Quigley <bryan.quigley@canonical.com>
* [networking] options to limit namespacesJan Jansky2020-02-062-25/+60
| | | | | | | | | | | | | | | | | | | | | * Added posibility to define namespaces with parameter namespaces = "". Posible regexp like "eth* ens4". * Added inspect_namespaces which defines how many namespaces should be inspected, by default unlimited * Added ethtool_namespaces variable which is by default true and if set to false it will not execute ethtool commands for namespaces * Changed options for OpenStack environment where ethtool_namespaces=False and inspect_namespaces = 200 Closes: #1916 Signed-off-by: Jan Jansky <jjansky@redhat.com> Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
* [travis] Move to single test script and use travis job matrixBryan Quigley2020-02-042-28/+172
| | | | | | | | | | | | | | | | | | | | | | Move all the sosreport runs to a simple bash script: tests/simple.sh so it can be called multiple times. This also makes it possible to run locally. The travis job matrix let's us have 2 Ubuntu native sos runs against installed python, while letting us to also continue to do the old style python runs. Ideally, we can utilize this to do Fedora/CentOS/RHEL jobs in the future. Python 3.4 testing was also dropped - as it seems to not be as well used (many test failures due to not being available). Python 3.8 testing was added. pycodestyle will only run once with the bionic version. Resolves: #1896 Signed-off-by: Bryan Quigley <bryan.quigley@canonical.com> Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [foreman] Collect debugging info for Dynflow SidekiqPavel Moravec2020-02-041-0/+7
| | | | | | | | | Collect sidekiq logs and services lists and statuses. Resolves: #1883 Signed-off-by: Pavel Moravec <pmoravec@redhat.com> Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [plugins] add_service_status to support all kwargsPavel Moravec2020-02-041-5/+4
| | | | | | | Currently, add_service_status allows just timeout and pred arguments. Let enhance it to support all arguments of _add_cmd_output / _collect_cmd_output. Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
* [s390] Correctly capture s390dbfJake Hunsaker2020-02-041-2/+8
| | | | | | | | | | | | Captures the content under /sys/kernel/debug/s390dbf rather than just listing the file names. Also included are trivial stylistic fixes. Closes: #905 Resolves: #1926 Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [sssd] call sssctl commands only when sssd service is runningPavel Moravec2020-02-041-3/+9
| | | | | | | | | As sssctl timeouts otherwise. Resolves: #1932 Signed-off-by: Pavel Moravec <pmoravec@redhat.com> Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [corosync] Add 'corosync-cmapctl -m stats' outputJan Friesse2020-02-041-1/+2
| | | | | | | | | | | | | | | Information stored in CMAP got split in Corosync 3.x to configuration and statistics part. Calling 'corosync-cmapctl' command output only configuration part. To output statistics part, 'corosync-cmapctl -m stats' has to be called. Patch adds call of 'corosync-cmapctl -m stats'. Resolves: #1924 Signed-off-by: Jan Friesse <jfriesse@redhat.com> Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [kubernetes|RedHat] Use `oc` command when running on OCPJake Hunsaker2020-01-291-1/+4
| | | | | | | | | | | | | If sos is run on a RHEL OpenShift node, use the `oc` command directly instead of pointing `kubectl` at the origin config file. This allows sos to not need to account for any other differences the `oc` binary might implement when wrapping `kubectl`, which in turn could potentially lead to a difference between what an end-user troubleshooting OCP may see and what a support engineer looking through an sosreport may see. Resolves: #1928 Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>