aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* [Plugin] Add new method for iterating over storage devicesJake Hunsaker2020-04-074-20/+147
| | | | | | | | | | | | | | | | | | | | | | | Adds a new mechanism for iterating over a list of devices with a given command or list of commands. This is to allow us to stop doing ad-hoc device enumeration in multiple plugins and instead provide a consistent behavior for iterating over devices such as disks. Before setting up plugins, sos will now enumerate a list of block devices and fibre devices that is made available to the plugins. From there the new 'add_blockdev_cmd()' method may be passed a command or list of commands that will be iterated over for every device. Commands passed need to include '%(dev)s' in the appropriate place for device name substitution. By default this will iterate over all discovered block devices. The 'devices' parameter may be used to change this, either by passing 'fibre' to instead iterate over fibre devices, or by passing a list of devices to use directly. To filter out or restrict commands to running on specific types of devices, the blacklist and whitelist parameters can be used respectively and can accept either a single regex string or a list of regexes. Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [podman] Update plugin to utilize policy container runtimeJake Hunsaker2020-04-071-20/+7
| | | | | | | | | | Updates the plugin to use the new `ContainerRuntime` abstraction provided by the loaded `Policy` rather than shelling out again to get the same data loaded during `Policy` initialization. Resolves: #1873 Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [docker] Update plugin to utilize policy container runtimeJake Hunsaker2020-04-071-20/+7
| | | | | | | | Updates the plugin to use the new `ContainerRuntime` abstraction provided by the loaded `Policy` rather than shelling out again to get the same data loaded during `Policy` initialization. Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [rabbitmq] Update to use ContainerRuntimeJake Hunsaker2020-04-071-12/+7
| | | | | | | Updates the `rabbitmq` plugin to use the new ContainerRuntime abstraction. Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [ovn_central] Use new ContainerRuntime methodsJake Hunsaker2020-04-071-22/+8
| | | | | | | | | | | | Updates `ovn_central` to use the new ContainerRuntime methods exposed to the `Plugin` class. Rather than manually checking for runtimes, and then manually building the exec commands, the plugin now relies on the `Plugin` methods for discovering containers and formatting commands to be run in a container, if applicable. Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [Openstack] Update plugins to use ContainerRuntime methodsJake Hunsaker2020-04-076-60/+7
| | | | | | | | Removes the duplicated container runtime checks from individual plugins, and updates them to use the new methods exposed in `Plugin`, thus reducing the number of times sos calls out to the runtime. Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [Plugin] Integrate ContainerRuntime in Plugin APIJake Hunsaker2020-04-071-5/+97
| | | | | | | | | | | | | | | | | | Integrates the ContainerRuntime checks to the Plugin API - `Plugin.exec_cmd()` now accepts a `container` argument that, if set, will first check to see if the container exists and if it does, format the requested command to be executed by the runtime in the selected container. If the runtime is not available, or the container does not exist, the command is not run. Additionally adds a `container_exists()` call to check to see if a container is present/running, and a `fmt_container_cmd()` call that wraps the `ContainerRuntime` method to allow for easy formatting of commands for `add_cmd_output()` calls. Closes: #1866 Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [Policy] Add Container Runtime abstraction classJake Hunsaker2020-04-073-35/+218
| | | | | | | | | | | | | | | | | Adds a `ContainerRuntime()` class to allow policies to specify a container runtime to allow plugins to utilize. The `ContainerRuntime` is intended to allow for the discovery of containers, including specific ones by name, and for the execution of commands inside those containers. This is meant to remove the overhead of manually defining ways to determine an active runtime and if a component is containerized within plugins. Related: #1866 Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [ovirt] add additional log files to collect.Ehud Yonasi2020-04-071-0/+6
| | | | | | | | | Adds collection of log files for metrics, setup, and vmconsole Resolves: #2002 Signed-off-by: Ehud Yonasi <eyonasi@redhat.com> Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [hardware] Add output of lshwJose Castillo2020-04-071-0/+1
| | | | | | | | | This plugin adds the output of the command lshw, and its output complements what we already collect with dmidecode. Signed-off-by: Jose Castillo <jcastillo@redhat.com> Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [ovirt_engine_backup] Add a new "ovirt_engine_backup" plugin3.9.1Miguel Martin2020-03-241-0/+52
| | | | | | | | | Add a new plugin to retrieve an oVirt engine database backup. Resolves: #1977 Signed-off-by: Miguel Martin <mmartinv@redhat.com> Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [Plugin] Collect plugin service status by defaultJake Hunsaker2020-03-244-3/+12
| | | | | | | | | | | | | | By default, plugins will now capture service status information from the init system for any services defined in the plugin's `services` member, provided that that service actually exists on the system. This is done by calling a new method, `add_default_collections()` before we call `Plugin.setup()` for each plugin. This will allow us to more easily extend default collection behaviors going forward. Resolves: #1965 Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [sos_extras] A new plugin to collect user defined dataPavel Moravec2020-03-181-0/+92
| | | | | | | | | | | | | | | | | | | | | | | | | | | Enabled by presence of /etc/sos.extras.d/ directory, the plugin will execute all commands from all files in the directory, in order to collect extra user-defined data e.g. specific for a given system or product (or not yet being collected by sosreport otherwise). Empty lines or lines starting by '#' are ignored. Files or file patterns to be collected must be preceded by ':' , optionally followed by sizelimit. Examples: :/path/to/file :/path/to/files* sizelimit Other lines are treated as commands to execute, with output stored under sos_commands/sos_extras/<filename>/<command> directory. Resolves: #1663 Resolves: #1788 Signed-off-by: Pavel Moravec <pmoravec@redhat.com> Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [Plugin] New Validation Framework pluginCédric Jeanneret2020-03-181-0/+40
| | | | | | | | | | | | | The Validation Framework provides an overview of deployed services. For now, this Framework is linked to OpenStack and TripleO[1], but since it might be used by other products, it's probably better to get a generic name. Resolves: #1970 Signed-off-by: Cédric Jeanneret <cjeanner@redhat.com> Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [foreman] collect smart proxies detailsJan Jansky2020-03-181-1/+5
| | | | | | | | | | Adding commands which collects smart proxies details. Closes: #1972 Signed-off-by: Jan Jansky <jjansky@redhat.com> Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [tests] Make simple.sh consistentBryan Quigley2020-03-181-9/+1
| | | | | | | | | | | We no longer have to workaround an odd LXD/Travis interaction so make simple.sh not treat Travis special. Closes: #1921 Resolves: #1983 Signed-off-by: Bryan Quigley <bryan.quigley@canonical.com> Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [console] Add new pluginKazuhito Hagio2020-03-181-0/+29
| | | | | | | | | | Add a new plugin for collecting information about console and keyboard including the status of console and Scroll Lock flag. Resolves: #1981 Signed-off-by: Kazuhito Hagio <k-hagio-ab@nec.com> Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [sar] Fix "sar: could not list /var/log/sa/*" warningKazuhito Hagio2020-03-181-4/+4
| | | | | | | | | | | | | | Commit d334c5dedbcf ("[sar] Fix the parameter specified in add_copy_spec() to wildcard") appended the wildcard to the sa_path. But since it is passed to os.listdir() as is, the following warning is printed and later commands are not collected. [plugin:sar] sar: could not list /var/log/sa/* Resolves: #1978 Signed-off-by: Kazuhito Hagio <k-hagio-ab@nec.com> Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [selinux] collect /var/lib/selinuxRenaud Métrich2020-03-181-1/+2
| | | | | | | | | | On RHEL 8, modules and contexts are not in /etc/selinux/<policy> directory anymore, but in /var/lib/selinux/<policy> directory. Resolves: #1976 Signed-off-by: Renaud Métrich <rmetrich@redhat.com> Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [powerpc] Remove check_enablement() overrideJake Hunsaker2020-03-181-3/+1
| | | | | | | | | Removes the check_enablement() override for this plugin and replaces it with the new architecture enablement check. Closes: #1975 Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [iprconfig] Remove check_enablement() overrideJake Hunsaker2020-03-181-5/+3
| | | | | | | | | Replaces the check_enablement() override with the standard package check, and the new arch check functionality. Related: #1975 Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [pci] Do not run lspci commands when buses are not enumeratedJake Hunsaker2020-03-181-2/+4
| | | | | | | | | | From support team feedback, power systems may not have useful pci information. Now, gate `lspci` command collection behind the presence of bus directories under /proc/bus/pci. Related: #1975 Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [Plugin] Add enablement check based on architectureJake Hunsaker2020-03-181-4/+15
| | | | | | | | | | | | Plugins may now set an 'architectures' tuple when instantiating a Plugin to restrict that plugin from enabling only on those architectures provided any other enablement checks pass as well. By default, a plugin is considered to be runnable on any architecture. Related: #1975 Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [Plugin] Allow negative matching for SoSPredicateJake Hunsaker2020-03-181-27/+70
| | | | | | | | | | | | | | | | | | | | Extends SoSPredicate to allow for 'negative' presence checks, e.g. a package is _not_ installed or a system is _not_ of a specified list of architectures. This is done by setting the relevant test in the 'required' dict handed to SoSPredicate instances to be set to 'none' (the string, not the NoneType). For example, in order to run a command provided that a particular service is not running, the following predicate would be used: SoSPredicate(self, services='foobar', required={'services': 'none'}) Related: #1975 Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [Plugin] Extend SoSPredicate to gate on system architectureJake Hunsaker2020-03-181-6/+28
| | | | | | | | | | | | | Extends `SoSPredicate()` so that plugins may test for being run on specific architectures. This predicate test only really supports the 'any' test as a system can only have one architecture, so the use of an 'all' predicate test does not make sense. Related: #1975 Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [Plugin] Do not write empty files to archive on command failureJake Hunsaker2020-03-181-0/+4
| | | | | | | | | | | | | | | | If a command is not found on the system, sos traditionally will handle that failed call by simply not writing any output to the archive. However, if the command was given a suggested_filename or a root_symlink parameter in the `add_cmd_output()` call, we would end up writing an empty file to the archive. Now, we will re-check the status of the command attempt after the chroot check (and possible re-run) is done, and if the command "still" is not found, exit immediately to avoid the empty writes. Related: #1975 Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [lxd] Drop db collection and introduce lxd.buginfoEric Desrochers2020-03-161-26/+18
| | | | | | | | | | | | | | | | | | | | | The content of lxd database is rarely useful unless DB corruption and can get very large. This can be run manually if needed (outside sosreport) lxd.buginfo command only available via SNAP installation, would have the advantage of not needing updates whenever lxd upstream add a new feature or find something new that’s worth capturing. LXD upstream reference: https://discuss.linuxcontainers.org/t/what-lxd-information-should-be-collected-by-sosreport https://github.com/lxc/lxd-pkg-snap/issues/14 Resolves: #1982 Signed-off-by: Eric Desrochers <eric.desrochers@canonical.com> Signed-off-by: Bryan Quigley <bryan.quigley@canonical.com>
* [Foreman] collect /etc/sysconfig/dynflowdWilliam Bradford Clark2020-02-261-0/+1
| | | | | | | Resolves: #1966 Signed-off-by: William Bradford Clark <wclark@redhat.com> Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [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>