aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* [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>
* [Plugin] add SoSPredicate implementationBryn M. Reeves2019-03-221-6/+86
| | | | | | | | Add a simple predicate class that can be used to gate collection of certain data without adding conditional code into individual plugins. Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* [Plugin] Terminate running commands when a plugin exceeds timeoutJake Hunsaker2019-03-223-5/+44
| | | | | | | | | | | | | | | | | | | | | | | | | Previously, if a plugin timeout was hit the thread it was running in would be destroyed, however if it were running a command (ultimately handled by a Popen() call), that command would still continue to run under PID 1. This could then cause sos to report I/O exceptions after the archive has been closed with an attempt to write to the temporary directory used for the archive. Now, utilities.sos_get_command_output() accepts (and is handed from Plugin) a polling method that is used to monitor if the timeout has been hit and will call terminate() to end kill the running command if that polling method returns True. For commands run outside of a plugin, previous behavior remains the same since now AsyncReader.get_contents() will block until the command completes (regardless of exit code) rather than relying on the join() when an AsyncReader was initialized as was done before. Fixes: #1590 Resolves: #1615 Signed-off-by: Jake Hunsaker <jhunsake@redhat.com> Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* [foreman] collect all logrotated patterns and error httpd logsPavel Moravec2019-03-221-3/+3
| | | | | | | | | | Logrotated files can have suffix starting by '-' or '.' also. Additionally, collect also foreman-ssl_error_ssl.log httpd logs. Resolves: #1612 Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
* [candlepin] collect all types of logrotated patternsPavel Moravec2019-03-221-2/+2
| | | | | | | | Logrotated files can have suffix starting by '-' or '.' also. Relevant to: #1612 Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
* [apache] dont collect foreman httpd logsPavel Moravec2019-03-221-0/+6
| | | | | | | | | | | Prevent foreman and apache plugins in collecting the same logfiles but with different sizelimit - dont collect those files in apache plugin itself. Resolves: #1596 Signed-off-by: Pavel Moravec <pmoravec@redhat.com> Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* [plugins] dont collect tail of fobidden filePavel Moravec2019-03-221-0/+3
| | | | | | | | | | When a file is over sizelimit and we should collect just tail of it, check if the file isnt in forbidden paths first. Relevant to: #1596 Signed-off-by: Pavel Moravec <pmoravec@redhat.com> Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* [xfs] call xfs_admin on device namePavel Moravec2019-03-221-1/+1
| | | | | | | | | xfs_admin is called with argument of mounting point while it accepts device name. Resolves: #1610 Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
* [openstack_neutron] fix method name typoBryn M. Reeves2019-03-211-1/+1
| | | | Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* [foreman] Natively implement foreman-debug in sosJake Hunsaker2019-03-211-7/+207
| | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, the foreman plugin just served to collect the output of the 'foreman-debug' bash script, however even the 'foreman specific' items that were collected when the generic items were skipped included duplicate information sos already collects in other plugins. Additionally, after discussions with senior members of the Red Hat Satellite support team, it was decided that porting the collection of these bits to sos was preferable given the infrastructure sos provides that foreman-debug does not. The truly foreman-specific bits are now collected by the foreman plugin. This includes log files, config files, and command output for Satellite/Foreman-specific rubygems. Additionally, database output that was collected by foreman-debug is now collected by the foreman plugin and the file names are preserved - e.g. 'foreman_settings_table' remains the same. The katello extension for foreman-debug has been split out into a new, separate katello plugin. Resolves: #1525 Signed-off-by: Jake Hunsaker <jhunsake@redhat.com> Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* [virtwho] Collect virt-who -dopJake Hunsaker2019-03-211-0/+1
| | | | | | | | | Adds collection of 'virt-who -dop'. Related: #1525 Signed-off-by: Jake Hunsaker <jhunsake@redhat.com> Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* [squid] Collect rotated log filesJake Hunsaker2019-03-211-5/+6
| | | | | | | | | Adds collection of rotated log files for Red Hat locations. Related: #1525 Signed-off-by: Jake Hunsaker <jhunsake@redhat.com> Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* [named] Collect /etc/default/bind and named.logJake Hunsaker2019-03-211-0/+4
| | | | | | | | | Adds collection of /etc/default/bind and /var/log/named.log. Related: #1525 Signed-off-by: Jake Hunsaker <jhunsake@redhat.com> Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* [postgresql] Add disk usage summary for psql homeJake Hunsaker2019-03-211-0/+1
| | | | | | | | | Adds collection of 'du -sh' for the postgres home directory. Related: #1525 Signed-off-by: Jake Hunsaker <jhunsake@redhat.com> Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* [tftpserver] Add Debian and Ubuntu supportJake Hunsaker2019-03-211-2/+4
| | | | | | | | | | Adds support for this plugin to run on Debian and Ubuntu systems as part of the effort to port foreman-debug to sos plugins. Related: #1525 Signed-off-by: Jake Hunsaker <jhunsake@redhat.com> Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* [mongodb] Add logs from /var/libJake Hunsaker2019-03-211-2/+3
| | | | | | | | | Adds collection of the mongodb log under /var/lib/mongodb Related: #1525 Signed-off-by: Jake Hunsaker <jhunsake@redhat.com> Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* [redhat] Enable apache.log option for RH Sat presetJake Hunsaker2019-03-211-1/+2
| | | | | | | | | | Sets the Red Hat Satellite preset to enable the apache 'log' option by default so that all of /var/log/httpd is collected Related: #1525 Signed-off-by: Jake Hunsaker <jhunsake@redhat.com> Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* [pulp] Add new pluginJake Hunsaker2019-03-211-0/+72
| | | | | | | | | | Adds a new plugin for pulp as part of the effort to port the foreman-debug script to native sos plugins. Related: #1525 Signed-off-by: Jake Hunsaker <jhunsake@redhat.com> Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* [candlepin] Add new pluginJake Hunsaker2019-03-211-0/+47
| | | | | | | | | | Adds a new plugin for Candlepin as part of the effort to port the foreman-debug script to native sos plugins. Related: #1525 Signed-off-by: Jake Hunsaker <jhunsake@redhat.com> Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* [katello] Add new pluginJake Hunsaker2019-03-211-0/+61
| | | | | | | | | | Adds a new plugin for katello as part of the porting of the foreman-debug script to sos plugins. Related: #1525 Signed-off-by: Jake Hunsaker <jhunsake@redhat.com> Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* [puppet] Collect facter, directory listing, and version outputJake Hunsaker2019-03-211-1/+17
| | | | | | | | | | | Adds collection of 'facter' and the puppet version in use. Additionally collect directory listings for puppet module dirs. Related: #1525 Signed-off-by: Jake Hunsaker <jhunsake@redhat.com> Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* [ruby] Add new pluginJake Hunsaker2019-03-211-0/+28
| | | | | | | | | Adds a new plugin for the ruby runtime. Related: #1525 Signed-off-by: Jake Hunsaker <jhunsake@redhat.com> Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
* [samba] Get information about the primary trustAndreas Schneider2019-03-211-0/+1
| | | | | | | Resolves: #1602 Signed-off-by: Andreas Schneider <asn@cryptomilk.org> Signed-off-by: Bryn M. Reeves <bmr@redhat.com>