summaryrefslogtreecommitdiffstats
path: root/firstaidkit
diff options
context:
space:
mode:
authorJoel Andres Granados <jgranado@redhat.com>2008-05-30 16:36:31 +0200
committerJoel Andres Granados <jgranado@redhat.com>2008-05-30 16:36:31 +0200
commit95104a7cc264e21d8fc77bdc9fc9748e1b8abc98 (patch)
treeeb552c44b53842acf216394d1dc68a8e29865c1a /firstaidkit
parent9066933c13649c0913a0d3387728573580912c41 (diff)
downloadfirstaidkit-95104a7cc264e21d8fc77bdc9fc9748e1b8abc98.tar.gz
firstaidkit-95104a7cc264e21d8fc77bdc9fc9748e1b8abc98.tar.xz
firstaidkit-95104a7cc264e21d8fc77bdc9fc9748e1b8abc98.zip
Fix traceback if user not root and has not log file defined.
If firstaidkit is run with default config (from configuration.py) the log file is /var/log/firstaidkit.log. This could generate a traceback if the user is not root. This patch simply make fak fall back on a file located on the curren directory. If this further fails print error and exit with error code.
Diffstat (limited to 'firstaidkit')
-rwxr-xr-xfirstaidkit12
1 files changed, 11 insertions, 1 deletions
diff --git a/firstaidkit b/firstaidkit
index 2cc124e..41f7d46 100755
--- a/firstaidkit
+++ b/firstaidkit
@@ -231,7 +231,17 @@ if __name__=="__main__":
sys.exit(1)
# initialize log for plugin system.
- initLogger(Config)
+ try:
+ initLogger(Config)
+ except IOError, ioe:
+ if ioe[0] == 13:
+ #This is probably because the user is not root.
+ Config.log.filename = "firstaidkit-" + "%s" % os.getpid()
+ initLogger(Config)
+ else:
+ print ioe
+ usage(sys.argv[0])
+ sys.exit(1)
report = reporting.Reports(maxsize = 1, round = True)
singlerun = Tasker(Config, reporting = report)