aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* [sosreport] Print header before policy initializationJake Hunsaker2019-05-141-3/+3
| | | | | | | | | | | The version header is now printed before policy initialization as part of the SoSReport() constructor instead of in the execute() message. Fixes: #762 Resolves: #1644 Signed-off-by: Jake Hunsaker <jhunsake@redhat.com> Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* [Plugin] Allow plugins to capture environment variablesJake Hunsaker2019-05-143-4/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adds a new 'add_env_var()' method to the Plugin class, which allows plugins to specify which environment variables should be recorded in the sos archive. This functions as a whitelist, as only environment variables requested by plugins will be captured. The new method accepts either a single string, or a list of strings. Collection of environment variables is done _after_ we have run collect() for each plugin, and will be written to the 'environment' file in the archive root. Only environment variables that exist will be written, so if a plugin requests an environment variable be captured and it does not appear in the file the chances are good that the variable is not set on the system. Each environment variable will only be captured once - so multiple plugins may specify the same environment variable without an issue. Additionally, when a plugin uses add_env_var(), the value passed as well as an upper- and lower- cased variant of the value will be added to the list of variables to be collected as well. This is because it is a frequent support issue where end users set an incorrectly-cased variable, and support representatives will want to know when this is the case. Because this functionality works off of a whitelist, environment variable values are not sanitized. Note also that due to the variable name casing functionality mentioned above, this means there is a small chance where sensitive data stored in differently-cased variables of the same name as common variables could be unintentionally captured. Use the --no-env-vars option to prevent capturing any environment variables wholesale. Fixes: #1396 Resolves: #1643 Signed-off-by: Jake Hunsaker <jhunsake@redhat.com> Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* [kubernetes] Allow only capturing logs for certain podsJake Hunsaker2019-05-141-0/+10
| | | | | | | | | | | | | | | The 'podlogs' option was previously an all-or-nothing toggle, which could result in incredibly large amounts of data collection when only a few pod's logs were needed. This change adds a 'podlogs-filter' option that allows users to provide either a specific pod name or a regex to match pod names against, to limit the amount of pod logs we collect. Resolves: #1640 Signed-off-by: Jake Hunsaker <jhunsake@redhat.com> Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* [Plugin] Replace command tuples with a classJake Hunsaker2019-05-141-44/+42
| | | | | | | | | | | | | | | | | Adds a SoSCommand class to represent any command that will be collected by sos. This replaces the previously used command tuples, which had an ever growing length that made it difficult to quickly identify fields in the logs. The _add_cmd_output() method now passes SoSCommand objects to the collect_cmds list, and _get_command_output_now() will now use the class directly when referencing parameters supported by add_cmd_output(). Fixes: #1275 Resolves: #1639 Signed-off-by: Jake Hunsaker <jhunsake@redhat.com> Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* [manageiq] add postresql configuration pathDavid Luong2019-05-141-1/+5
| | | | | | | | | | | | | | The most recent version of CloudForms adds postgres configuration files at: /etc/managiq/postgresql.conf.d/ Include these in the set of files collected by the plugin. Resolves: #1637 Signed-off by: David Luong <dluong@redhat.com> Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* [npm] plugin to requires_rootPavel Moravec2019-05-141-1/+0
| | | | | | | | | Until our utils support commands execution for unpriviledged users, we should disable requires_root = False. Resolves: #1625 Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
* [openstack_instack] add ansible.logEmilien Macchi2019-04-301-1/+2
| | | | | | | | | | | | | | | | | | | | Collect /var/lib/mistral/config-download-latest/ansible.log which is an important log to be able to debug issues with Ansible playbooks. /var/lib/mistral/config-download-latest is a directory that exists anyway on the undercloud and is the place where the ansible logs is stored. Note: we don't want to collect the whole /var/lib/mistral because it contains sensitive informations like username/passwords/endpoints. rhbz#1702806 rhbz#1702802 Resolves: #1661 Signed-off-by: Emilien Macchi <emilien@redhat.com> Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* [sosreport] update sos.conf manpages by [general] section descriptionPavel Moravec2019-04-301-4/+34
| | | | | | | | | Since PR #1530, sosreport supports all command line options. Man pages should document the enhancement. Resolves: #1652 Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
* [sosreport] initialize disabled plugins properly when parsing sos.confPavel Moravec2019-04-301-1/+1
| | | | | | | | | opts.noplugins is referred when parsing "tunables" section, so the variable must be set to empty list every time. Resolves: #1651 Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
* [foreman,satellite] increase plugin default timeoutsPavel Moravec2019-04-302-0/+2
| | | | | | | | | | | Those two plugins call commands with bigger timeouts than the default plugin timeout is. That can unexpectedly kill the plugin execution when the commands execution took longer than the plugin timeout (but within cmd timeout). Resolves: #1642 Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
* [maas,mysql,npm,pacemaker,postgresql] fix plugopts data typesPavel Moravec2019-04-305-11/+11
| | | | | | | | | | With new enforcement of implicit data type for plugin options, the plugopts must have proper data types of default values and plugins must work with them accordingly (in tests or so). Resolves: #1635 Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
* [pcp] collect pmlogger without a sizelimitPavel Moravec2019-04-301-1/+1
| | | | | | | | sizelimit=None defaults to --log-size, use sizelimit=0 instead Resolves: #1632 Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
* [vdsm] capture supervdsmd statusIrit goihman2019-04-151-0/+1
|
* [vdsm] change filterIrit goihman2019-04-151-1/+1
|
* [vdsm] drop explicit size limitingIrit goihman2019-04-151-3/+1
|
* [vdsm] use metadata_read_only=1 for LVM2 commandsIrit goihman2019-04-151-0/+5
|
* [vdsm] fix plugin docstring capitalisationIrit goihman2019-04-151-1/+1
|
* [plugins] add vdsm pluginIrit Goihman2019-04-151-0/+146
| | | | | | | | | Add a plugin for vdsm Resolves: #1205 Signed-off-by: Irit Goihman <igoihman@redhat.com> Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* [Plugin] add get_process_pids() to return PIDs by process nameirit.go2019-04-151-0/+16
| | | | | Signed-off-by: Irit Goihman igoihman@redhat.com Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* [sos] bump release3.7Bryn M. Reeves2019-03-272-2/+2
| | | | Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* [origin] make origin.diag-prevent on by defaultPablo Alonso Rodriguez2019-03-271-1/+1
| | | | | | | | | | | Making origin.diag-prevent option "on" by default, so that sosreport does not create/modify/delete projects by default in an OpenShift cluster. Resolves: #1624 Signed-off-by: Pablo Alonso Rodriguez <palonsor@redhat.com> Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* [foreman] decrease default task export to 1 monthPavel Moravec2019-03-261-3/+3
| | | | | | | | | | | | For bigger foreman deployments, csv postgres queries timeout while users are not much concerned about old tasks. Let decrease default time span to 1 month and increase timeout for collecting those commands. Resolves: #1623 Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
* [archive] opening a file should ignore UTF errorsPavel Moravec2019-03-261-1/+1
| | | | | | | | | When opening a file in archive e.g. for do_file_sub, we should ignore UTF encoding errors to prevent UnicodeDecodeError. Resolves: #1622 Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
* [sosreport] do not pass chunksize to ThreadPoolExecutor.map()Bryan Quigley2019-03-261-1/+1
| | | | | | | | | | | | | | | | 3.4 python also appears to be broken by an unnecessary use of the chunksize argument when threading plugins landed. According to the docs it defaults to 1, and has no effect for the ThreadPoolExecutor class: "For very long iterables, using a large value for chunksize can significantly improve performance compared to the default size of 1. With ThreadPoolExecutor, chunksize has no effect." Related: #1603 Signed-off-by: Bryan Quigley <bryan.quigley@canonical.com> Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* [travis] robustness, actually fail on errorsBryan Quigley2019-03-261-1/+4
| | | | | | | | | | | | This makes sure if we get errors (anything to stderr) in the build it gets flagged. Today, it can be easily silently ignored. Current build is broken by recent lgtm pull. Resolves: #1603 Signed-off-by: Bryan Quigley <bryan.quigley@canonical.com> Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* [pacemaker] add sbd configuration and full statusBryn M. Reeves2019-03-261-1/+2
| | | | Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* [plugins] do_file_sub to catch nonexisting filePavel Moravec2019-03-251-1/+1
| | | | | | | | | If trying to do_file_sub on not-captured file, IOError is raised that we have to catch like OSError. Resolves: #1621 Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
* [policies/amazon] update Red Hat copyrightBryn M. Reeves2019-03-251-1/+1
| | | | Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* [plugins] remove stray 'amazon' merge artefactBryn M. Reeves2019-03-251-35/+0
| | | | | | | A file in sos/plugins named 'amazon.py' was accidentally created during the Amazon policy merge: remove it from the tree. Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* [amazon] Add Amazon Linux policyJake Hunsaker2019-03-253-1/+70
| | | | | | | | | | | | Adds a policy for Amazon Linux. As Amazon Linux is a RHEL clone, it inherits from the base RedHatPolicy and uses the RedHatPlugin tagging class. Fixes: #1563 Resolves: #1619 Signed-off-by: Jake Hunsaker <jhunsake@redhat.com> Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* [kubernetes] Split out non-namespaced resourcesJake Hunsaker2019-03-251-8/+10
| | | | | | | | | | Removes non-namespaced resources from being iterated over by the namespace-sensitive loops such as describe. Resolves: #1618 Signed-off-by: Jake Hunsaker <jhunsake@redhat.com> Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* [plugins] add_string_as_file to deal with empty content properlyPavel Moravec2019-03-251-1/+1
| | | | | | | | | If add_string_as_file is called with emtpy content, dont attempt to parse it but set summary to '' directly. Resolves: #1620 Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
* [docker] fix command predicate usageBryn M. Reeves2019-03-251-6/+1
| | | | | | | | | | Move the Docker service command predicate later in the file (so as not to gate journal and ls collection), and ensure that the 'owner' argument of the SoSPredicate initialiser is set. Resolves: #1617 Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* [Plugin] fix predicate precedence in get_predicate()Bryn M. Reeves2019-03-251-2/+4
| | | | | | | | | | | | | | | | The get_predicate() method is responsible for evaluating the precedence of the three types of predicate: * Explicit predicate passed as `pred` keyword argument * Implicit command default predicate if processing a command * Implicit plugin default predicate Fix the ordering of checks in get_predicate() so that these rules are consistently followed. Related: #1616 Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* [Plugin] handle predicates correctly in get_cmd_output_now()Bryn M. Reeves2019-03-251-14/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The get_command_output_now() method is used for two distinct purposes: * Called directly from user plugin code, to immediately collect the output of a command during the setup() phase (e.g. to then process the output to inform further collection, while also storing the result in the report). * Internally from the _collect_cmd_output() callback, in order to collect the commands added at setup() time by user plugins during the collect() phase. In the former case, predicates should be applied as normal and evaluated prior to command execution. In the latter, predicates have already been applied at the time of the add_cmd_output() call; any predicate that was not set at the time of that call must not apply to the collection of the command. Split the method in two: _g_c_o_n() now collects command output unconditionally, and is used directly by internal callers, and g_c_o_n() becomes a wrapper to perform predicate evaluation. Resolves: #1616 Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* [Plugin] decode content read from file in do_file_sub()Bryn M. Reeves2019-03-221-1/+4
| | | | | | Fixes: #1614 Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* [Plugin] ensure the null predicate evaluates to TrueBryn M. Reeves2019-03-221-1/+5
| | | | | | | A null predicate (one with no set predicates) must always evaluate to True, or it will block all collection. Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* [Plugin] always use current predicate in log messagesBryn M. Reeves2019-03-221-4/+4
| | | | | | | | | The 'pred' local in collection methods is unused when a default (command or plugin) predicate is in use. Always retrieve the active predicate via get_predicate() when logging predicate decisions. Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* [man] add --dry-run to sosreport.1Bryn M. Reeves2019-03-221-3/+9
| | | | Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* [npm] do not call self.archive.add_string() directlyBryn M. Reeves2019-03-221-1/+1
| | | | | | | | | | | No plugin code outside of Plugin (and other classes defined in the plugin module itself) should ever access the archive directly: this is so that metadata is created, limits are respected, and predicates applied. Correct npm to use self.add_string_as_file(). Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* [unpackaged] check plugin predicate before processing packagesBryn M. Reeves2019-03-221-0/+4
| | | | | | | | | | | | | The unpackaged plugin is unusual in that it does a lot of costly processing in Python, without ever calling out to an external binary. This means that the normal, automatic predicate testing hooks are not executed until we come to add the final string to the archive (by which time we've already done all the work). Make a special case for this plugin, and test the current plugin predicate before operating on package lists. Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* [Plugin] factor out common code into Plugin.test_predicate()Bryn M. Reeves2019-03-221-8/+17
| | | | | | | Factor out the common steps to check the current predicate, and use this from the API methods that require it. Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* [Plugin] accept predicates in Plugin.add_string_as_file()Bryn M. Reeves2019-03-221-6/+14
| | | | Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* [sos] Implement sosreport --dry-runBryn M. Reeves2019-03-225-27/+53
| | | | Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* [docker] gate command collection on docker service predicateBryn M. Reeves2019-03-221-1/+3
| | | | Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* [Plugin] allow setting default plugin predicatesBryn M. Reeves2019-03-221-0/+33
| | | | | | | | | | | | Allow plugin authors to set default predicates to apply to either all collection, or to all command collection, subsequent to the call to Plugin.set_predicate(). The set predicate will be tested in any subsequent collection call (depending on the type of predicate), and will gate the collection of data requested by those calls. Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* [Plugin] use service_is_running() in SoSPredicate()Bryn M. Reeves2019-03-221-1/+1
| | | | Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* [Plugin] accept predicates in Plugin.add_journal()Bryn M. Reeves2019-03-221-2/+2
| | | | Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* [Plugin] accept predicates in Plugin.add_copy_spec()Bryn M. Reeves2019-03-221-1/+6
| | | | Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* [Plugin] accept predicates in Plugin.get_cmd_output_now()Bryn M. Reeves2019-03-221-1/+7
| | | | Signed-off-by: Bryn M. Reeves <bmr@redhat.com>