Merge pull request #202 from karibou/master

    Add new plugin for apt

Signed-off by: Adam Stokes <adam.stokes@ubuntu.com>
No TTY should not imply batch mode

Commit 6ea48cbb introduced an isatty() check on stdin and
automatically sets batch mode if we're not attached to a TTY.

Although the logic of this seems simple enough the combination of
this and commit 4b46e04 breaks valid uses that have worked since
sos-1.x, e.g.:

Traceback (most recent call last):
  File "/usr/sbin/sosreport", line 23, in <module>
    main(sys.argv[1:])
  File "/usr/lib/python2.7/site-packages/sos/sosreport.py", line 1171, in main
    sos.execute()
  File "/usr/lib/python2.7/site-packages/sos/sosreport.py", line 1133, in execute
    self._setup_logging()
  File "/usr/lib/python2.7/site-packages/sos/sosreport.py", line 630, in _setup_logging
    self.opts.batch = True
  File "/usr/lib/python2.7/site-packages/sos/sosreport.py", line 324, in batch
    self._check_options_initialized()
  File "/usr/lib/python2.7/site-packages/sos/sosreport.py", line 229, in _check_options_initialized
    + "from command line")
ValueError: SoSOptions object already initialized from command line

Given the actual semantics of --batch (do not prompt for or read
user input from stdin) there is no need to enable it if stdin is
a pipe or other non-TTY file descriptor.

Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
Do not exit on interactive mode read exceptions

Currently the default policy object will exit without logging any
errors if an exception (e.g. EOF while reading line) is caught
during reads for interactive mode prompts.

Instead re-set the report name to a sane value (localname) and
attempt to continue.

Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
Include /etc/yaboot.conf in boot plug-in

Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
Fix exception in command output substitution

If an attempt is made to apply command output substitution via
Plugin.do_cmd_output_sub() and no output has been collected (i.e.
called['file'] == None) an exception is thrown by os.path.join().

The exception is also not logged properly due to an attempt in
the do_cmd_output_sub() exception handler to access an unbound
local variable (path - the exception occurs before it is
assigned).

Fix both of these by checking for an empty file entry and avoiding
access to the path variable from the exception handler.

Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
Remove useless os.path.exists check for brctl executable

The networking module previously checked that its hard-coded path
for the brctl command existed before collecting output. This was
missed in the conversion to using policy defined PATH search for
external commands in commit e0d132e.

Similar problems were fixed in commits 8b10cb0, 374da99, 8883155.

Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
Remove obsolete workaround for newline added by pipe.communicate()

Older versions of the python runtime would add a newline to output
obtained via pipe.communicate(). Current versions do not leading
to output being stored in reports without a trailing newline
character.

Remove the workaround to ensure that stored content matches that
obtained via simple shell redirection ("/some/command > file").

Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
Add OpenStack Keystone and Horizon plug-ins

Split out the Keystone and Horizon support from the main OpenStack
plug-in and put them in their own modules.

Signed-off-by: Jeremy Agee <jagee@redhat.com>
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>