aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* [tests] Fix unittestsJake Hunsaker2020-04-213-4/+4
| | | | | | | | | | Fixes a unittest failure due to an attempt to pass print() a `file` keyword for Red Hat, which is no longer accepted in python3 Additionally fixes 2 string related errors in the test suite since changing from python2 to python3. Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [insights] collect insights-client dumpPavel Moravec2020-04-211-0/+4
| | | | | | | | | | Collect data of "insights-client --offline" into sos_commands/insights/insights-client-dump directory. Resolves: #2030 Signed-off-by: Pavel Moravec <pmoravec@redhat.com> Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [systemd] update trigger with better generic file checkHeather Lemon2020-04-211-4/+1
| | | | | | | | | | | | | | | | Currently it checks for the existance of systemd using two different directories depending on the distro used. Updating systemd trigger to handle the detection of checking for systemd more reliably and generically. Reference: https://github.com/systemd/systemd/blob/master/src/libsystemd/sd-daemon/sd-daemon.c#L598-L604 Closes: #2013 Resolves: #2029 Signed-off-by: Heather Lemon <heather.lemon@canonical.com> Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [landscape] Substitute oidc conf in service fileEric Desrochers2020-04-211-0/+20
| | | | | | | | | | | | | | | | | | | | Substitute sensitive informations about oidc found in landscape service configuration file. From release 19.10, Landscape can use OpenID-Connect (OIDC) to authenticate users. To enable OpenID-Connect support, please add oidc-issuer, oidc-client-id and oidc-client-secret to /etc/landscape/service.conf in the [landscape] section. Reference: https://docs.ubuntu.com/landscape/en/onprem-auth#openid-connect-support Closes: #2023 Resolves: #2025 Signed-off-by: Eric Desrochers <eric.desrochers@canonical.com> Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [navicli] replace interactive prompt by plugin optionPavel Moravec2020-04-161-25/+5
| | | | | | | | | | | List of ClariiOn IP addresses should be provided via -k navicli.ipaddrs plugopt, as a space separated list. Closes: #405 Resolves: #2020 Signed-off-by: Pavel Moravec <pmoravec@redhat.com> Signed-off-by: Bryan Quigley <bryan.quigley@canonical.com>
* [freeipmi] Add freeipmi supportArif Ali2020-04-161-0/+33
| | | | | | | Resolves: #2022 Signed-off-by: Arif Ali <arif.ali@canonical.com> Signed-off-by: Bryan Quigley <bryan.quigley@canonical.com>
* [pmem] Adds a new 'pmem' (Persistent Memory) plugin to collect dataSteve Scargall2020-04-161-0/+91
| | | | | | | | | | Uses ndctl, daxctl, and ipmctl utilities Closes: #1398 Resolves: #2021 Signed-off-by: Steve Scargall <steve.scargall@intel.com> Signed-off-by: Bryan Quigley <bryan.quigley@canonical.com>
* [landscape] simplify and remove deprecated log dirEric Desrochers2020-04-141-11/+15
| | | | | | | | | | | | | | * Make add_copy_spec & add_cmd_output method to accept a list. * Log directory "/var/log/landscape-server" is now fully deprecated. Nowadays, all supported versions are logging inside "/var/log/landscape". Resolves: #2012 Signed-off-by: Eric Desrochers <eric.desrochers@canonical.com> Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [global] fix some flake8 issuesBryan Quigley2020-04-144-9/+6
| | | | | | | | | | Mostly unused import or missing variables. Including 1 mistyped variable by me. Resolves: #2011 Signed-off-by: Bryan Quigley <bryan.quigley@canonical.com> Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [global] Drop use of python six and other 2.X bitsBryan Quigley2020-04-0917-120/+40
| | | | | | Resolves: #2006 Signed-off-by: Bryan Quigley <bryan.quigley@canonical.com>
* [global] Drop use of __future__Bryan Quigley2020-04-088-17/+0
| | | | | | | | | | This was used either to * get the print function * get the with function (for py2.5) Resolves: #2005 Signed-off-by: Bryan Quigley <bryan.quigley@canonical.com>
* [build] Update setuptools for new package layout, remove python2 testsJake Hunsaker2020-04-083-12/+4
| | | | | | | | | | | | | Updates setup.py to reflect project changes with 4.0, thus allowing the 'python setup.py install' checks to run normally. Removes futures from requirements.txt, as futures is packaged with python 3.4 and newer, and sos no longer supports python2. In that vein, also removes the pytohn-2.7 test from the travis configuration. Resolves: #2004 Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [options] Remove extraneous importJake Hunsaker2020-04-081-1/+1
| | | | | | Removes an extraneous import identified by LGTM Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [travis] Update test script for new binaryJake Hunsaker2020-04-081-9/+9
| | | | | | | Updates the test script `simple.sh` used by Travis to use the new `sos` binary with the `report` subcommand. Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [global] PEP8 fixesJake Hunsaker2020-04-084-11/+13
| | | | | | Consolidated PEP8 fixes following reorganization and redeisgn work. Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [binary] Allow subcommand alias referencesJake Hunsaker2020-04-081-6/+17
| | | | | | | | | | Adds support to the parser to allow aliases for subcommands in the parser. At the moment, this only applies to `report`, with the 'rep' shorthand. This is however intended for further 4.0 use via the integration of sos-collector and soscleaner. For example, invoking 'sos clean' and 'sos cleaner' would both be possible. Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [reporting] Move reporting under sos/reportJake Hunsaker2020-04-083-2/+2
| | | | | | Moves the HTML/JSON reporting bits under sos/report. Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [binary] Have legacy sosreport binary redirect to sosJake Hunsaker2020-04-083-6/+16
| | | | | | | | | | | | | | | | | | We need to carry a `sosreport` binary for some time to allow for end users and downstreams to adjust to the new binary. It was hoped originally that the old `sosreport` binary could be maintained in place and simply provide the older set of functionality. This has proven to not be possible givent he overhaul of the options handling that allows us to have multiple subcommands. So while we will still ship an `sosreport` binary, and it will be locked to `report` functionality, it is now a simple redirection script that also makes the user aware of the new `sos` binary. Closes: #1986 Resolves: #1993 Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [binary] Set python3 as the interpreterJake Hunsaker2020-04-081-1/+1
| | | | | | Since sos-4.0 is py3 only, set the interpreset of the binary as such Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [report] Add a description for help outputJake Hunsaker2020-04-081-8/+5
| | | | | | | Adds the `desc` class attr to SoSReport() for use by the help text when `sos --help` is run. Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [options] Ensure verbosity is an intJake Hunsaker2020-04-081-1/+1
| | | | | | | When loading from a config file, ensure that verbosity is set to and integer rather than a string. Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [report] Remove extra 'report' string from log messageJake Hunsaker2020-04-081-1/+1
| | | | Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [report] Don't override self.sys_tmp in __init__()Jake Hunsaker2020-04-081-1/+0
| | | | | | | | Removes an extraneous setting of self.sys_tmp, which is now handled via `SoSComponent`. This was getting overridden to `None` which was causing the final archive creation to fail. Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [options] Cast arg_names to list instead of dict_keysJake Hunsaker2020-04-081-1/+1
| | | | | | | For python3, calling `.keys()` on a dict no longer returns a list, so we need to explicitly make it a list of values to behave as expected. Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [report] Update SoSReport() to use SoSComponent()Jake Hunsaker2020-04-083-328/+197
| | | | | | | | | | | Moves SoSReport() from a standalone class to a subclass of SoSComponent() in order to take advantage of the new 4.0 redesign. This commit also pulls out methods that were previously transitioned to other places, e.g. logging setup moving from SoSReport() to the base SoSComponent() class. Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [redhat] Fix SoSOptions importJake Hunsaker2020-04-081-1/+1
| | | | Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [options] Drop explicit subclass of objectJake Hunsaker2020-04-081-1/+1
| | | | | | | | | For the 3.x line, many classes subclassed `object` directly, in order to use the 'new-style' objects introduced with python3, while still maintaining python2 functionality. As sos-4.0 is python3 only, we no longer need to do this. Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [utilities] Move _sos back into sos/__init__.pyJake Hunsaker2020-04-083-13/+11
| | | | | | | | Moving the `_sos_ definition wrapper for gettext into utilities proved to be the wrong direction, so this moves it back into sos/__init__.py in order to preserve the ability to properly import it elsewhere. Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [component] Add Policy loading and move to new component.pyJake Hunsaker2020-04-082-144/+172
| | | | | | | | | | | | | Adds Policy loading into `SoSComponent()` so that any subcommand can, if it needs it, have policies loaded consistenly. This is controlled via the `load_policy` class attr, which defaults to True. Future subcommands that do not need to have a policy loaded (E.G. the planned `info` command), can simply set this to False in order to skip this step. Moves `SoSComponent()` out of sos/__init__.py and into sos/component.py to ease import conflicts arising from policy loading. Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [soscomponent] Add exit handling to SoSComponentJake Hunsaker2020-04-081-0/+17
| | | | | | Adds the exit handling from SoSReport() directly into SoSComponent() Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [options] Update option loading from config fileJake Hunsaker2020-04-082-38/+92
| | | | | | | | | | | | | | | | | | | | As we are moving to decouple SoSOptions() from report, we need to adjust how some of the option loading is handled, such as loading values from a conf file. The previous approach was to instantiate a new SoSOptions() object, read into it from the config file, and then merge that with the "main" SoSOptions() object. This worked well when we only had report to worry about since the arguments were more or less static. However, in allowing new subcommands to define their own options this presented a problem due to the behavior of merging. This was compounded by the fact that merging still functioned how we expected/needed for actions like merging commandline options against the defaults. As such, the new approach is to use the "main" SoSOptions() instance to read the config file specifications and then directly modify the needed values rather than relying on the merging behavior. Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [sos] Extract logging setup from reportJake Hunsaker2020-04-082-0/+89
| | | | | | | | | | | Moves logging setup into `SoSComponent`, and logging is setup by default at component initialization, unless the `configure_logging` class attr is set to `False`. Moves the TempFileUtil() class out of report and into utilities for easier usage by all sos components. Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [options] Decouple SoSOptions from reportJake Hunsaker2020-04-083-91/+39
| | | | | | | | This is the first of probably a number of commits aimed at making SoSOptions() a generic option handling class for all components in sos, rather than being tightly bound to `report`. Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [sos] Dynamically build argparser usage stringsJake Hunsaker2020-04-081-2/+23
| | | | | | | | | | Now dynamically build the usage string reported by --help for the top-level parser (I.E. `sos --help`) to print available components. Additionally, rework the subparser usage strings to accurately report the syntax for subcommands. Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [policies] Fix imports after moving SoSOptionsJake Hunsaker2020-04-081-2/+2
| | | | Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [sos] Fix bad imports/typosJake Hunsaker2020-04-081-5/+5
| | | | Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [options] Split SoSOptions into a new moduleJake Hunsaker2020-04-082-321/+342
| | | | | | | | | Moves `SoSOptions()` and the related bits to a new sos/options.py location. This should allow for easier maintenance and ongoing development as our option handling approach will be shared across components. Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [4.0] Create new binary and define new entrypoints for subcommandsJake Hunsaker2020-04-082-14/+116
| | | | | | | | | | | | | | | This is the first patch to add a new `sos` binary to act as the new commandline interface for users. It adds the basic `SoS()` and `SoSComponent()` classes that will be built out and used going forward for new subcommand development. Actual functionality will be added in coming patches, as this is mainly serving as a checkpoint to avoid over-large commits affecting wide swathes of changes at once. Resolves: #1986 Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [utilities] Move gettext into utilitiesJake Hunsaker2020-04-071-0/+12
| | | | Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [4.0] Remove __run__.pyJake Hunsaker2020-04-071-14/+0
| | | | | | | | Removes the redundant __run__.py from the project root, as it has not been used for quite some time and the legacy `sosreport` binary was its replacement. Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [report] Move sosreport.py into report/__init__.pyJake Hunsaker2020-04-073-1469/+1469
| | | | | | | Moves the legacy sosreport.py into sos/report/__init__.py as part of the reorganization for 4.0 Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [global] Fix report import pathsJake Hunsaker2020-04-07308-319/+323
| | | | | | | | | | | Updates the uses of 'from sos.plugins' to 'from sos.report.plugins' in order to fix imports across the project with the new tree organization. Additionally, the legacy `sosreport` binary now injects the user's current working directory into the path the python interpreter uses in order to allow local execution from a git checkout. Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [4.0] Re-organize tree for sos-4.0Jake Hunsaker2020-04-07298-0/+0
| | | | | | | | | | | | | | | This is the beginning of the sos-4.0 design rework. First, move the existing `sosreport` binary into a new top-level `bin` dir. The future `sos` binary will also live here. Second, create a `report` subdir within the `sos` module, and move the relevant `sosreport` bits to that subdir. A following commit will update all references like `from sos.plugins` to `from sos.report.plugins`. Related: #1986 Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [Plugin] Remove add_udev_info methodJake Hunsaker2020-04-071-19/+0
| | | | | | | | | | Removes the add_udev_info method as its original purpose was to easily iterate over a list of devices which is now handled (better) by add_blockdev_cmd. Resolves: #1508 Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [scsi] Use new add_blockdev_cmd methodJake Hunsaker2020-04-071-1/+2
| | | | | | | Updates the scsi plugin to use the new add_blockdev_cmd() method instead of add_udev_info(). Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [fibrechannel] Use new add_blockdev_cmd methodJake Hunsaker2020-04-071-14/+1
| | | | | | | Updates the fibrechannel plugin to replace the ad-hoc device enumeration with the new add_blockdev_cmd method. Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [nvme] Use new add_blockdev_cmd methodJake Hunsaker2020-04-071-19/+13
| | | | | | | Updates the nvme plugin to replace the ad-hoc device enumeration and command building with the new add_blockdev_cmd method. Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [block] Use new add_blockdev_cmd methodJake Hunsaker2020-04-071-15/+10
| | | | | | | Updates the block plugin to replace the ad-hoc device enumeration and command building with using the new add_blockdev_cmd method. Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
* [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>