diff options
author | sconklin <sconklin@ef72aa8b-4018-0410-8976-d6e080ef94d8> | 2006-12-15 19:59:35 +0000 |
---|---|---|
committer | sconklin <sconklin@ef72aa8b-4018-0410-8976-d6e080ef94d8> | 2006-12-15 19:59:35 +0000 |
commit | c3e43855d27163cfea435a54ae8f425003ec0904 (patch) | |
tree | 5b31dfb64e2539b99699be847f888a0d466cf202 /src/sosreport | |
parent | 034f0c4e5272a84ad787c5ae46b6e59d09b4f02c (diff) | |
download | sos-c3e43855d27163cfea435a54ae8f425003ec0904.tar.gz |
Removed spurious messages, fixed file permissions to improve security,
moved tar generation into policy module, delete tree in /tmp when
done, and added option -g to only gather info and not create tarball
git-svn-id: svn+ssh://svn.fedorahosted.org/svn/sos/trunk@58 ef72aa8b-4018-0410-8976-d6e080ef94d8
Diffstat (limited to 'src/sosreport')
-rwxr-xr-x | src/sosreport | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/src/sosreport b/src/sosreport index a8c821d2..a04108dd 100755 --- a/src/sosreport +++ b/src/sosreport @@ -49,6 +49,9 @@ __cmdParser__.add_option("-a", "--alloptions", action="store_true", \ __cmdParser__.add_option("-f", "--fastoptions", action="store_true", \ dest="fastoptions", default=False, \ help="Use only fast options for loaded plugins") +__cmdParser__.add_option("-g", "--gatheronly", action="store_true", \ + dest="gatheronly", default=False, \ + help="Gather information locally but don't package or submit") __cmdParser__.add_option("-l", "--list-plugins", action="store_true", \ dest="listPlugins", default=False, \ help="list existing plugins") @@ -138,7 +141,6 @@ def sosreport(): # Set up common info and create destinations dstroot = sosFindTmpDir() - os.chmod(dstroot, 0755) cmddir = os.path.join(dstroot, "sos_commands") logdir = os.path.join(dstroot, "sos_logs") rptdir = os.path.join(dstroot, "sos_reports") @@ -154,6 +156,9 @@ def sosreport(): 'logfd': logfd, 'policy': policy, 'verbosity' : __cmdLineOpts__.verbosity} + # Make policy aware of the commons + policy.setCommons(commons) + # validate and load plugins plugins = os.listdir(pluginpath) if __cmdLineOpts__.listPlugins: @@ -262,10 +267,6 @@ def sosreport(): <body> """) - rfd.write("Sosreport version blah blah<br />") - - - # Make a pass to gather Alerts and a list of module names allAlerts = [] @@ -308,19 +309,23 @@ def sosreport(): # Collect any needed user information (name, etc) - # Clean up left over files, make tarball, whatever. # Close all log files and perform any cleanup logfd.close() # Call the postproc method for each plugin - # Need to redo this completely to use only one selected reporter module - # This will require hackery and demagaugery, so for now, we'll just - # do something really offensively squinky. - import sos.reporters.tarball - sos.reporters.tarball.postproc() - - if root == dstroot: - print "The report is in " + rptdir + "/" + "sosreport.html" + for plugname, plug in loadedplugins: + plug.postproc() + + if __cmdLineOpts__.gatheronly: + print "Collected information is in " + dstroot + print "Your html report is in " + rptdir + "/" + "sosreport.html" + else: + # package up the results for the support organization + policy.packageResults() + # delete gathered files + os.system("rm -rf %s" % dstroot) + # automated submission will go here + if __name__ == '__main__': sosreport() |