client/tools/spacewalk-abrt/src/bin/spacewalk-abrt | 12 +-----------
client/tools/spacewalk-abrt/src/spacewalk_abrt/abrt.py | 14 ++++++++++++--
2 files changed, 13 insertions(+), 13 deletions(-)
New commits:
commit e2996dd63067a5cda0a6c4e53c69716d802dce8c
Author: Milan Zazrivec <mzazrivec(a)redhat.com>
Date: Thu Feb 28 16:09:36 2013 +0100
spacewalk-abrt: remodel dump dir location logic
diff --git a/client/tools/spacewalk-abrt/src/bin/spacewalk-abrt
b/client/tools/spacewalk-abrt/src/bin/spacewalk-abrt
index 49821ae..eba2ede 100755
--- a/client/tools/spacewalk-abrt/src/bin/spacewalk-abrt
+++ b/client/tools/spacewalk-abrt/src/bin/spacewalk-abrt
@@ -26,7 +26,6 @@ t = gettext.translation('spacewalk-abrt', fallback=True)
_ = t.ugettext
from optparse import OptionGroup
-from up2date_client import config
from up2date_client import rhncli
from up2date_client import up2dateAuth
import spacewalk_abrt.abrt
@@ -51,15 +50,6 @@ class AbrtCli(rhncli.RhnCli):
_("Error: specified problem directory [%s] does not exist.\n" %
path)))
sys.exit(1)
-
- def get_abrt_dir(self):
- default_abrt_dir = '/var/spool/abrt'
- if os.path.exists('/var/tmp/abrt') and
os.path.isdir('/var/tmp/abrt'):
- default_abrt_dir = '/var/tmp/abrt'
- cf = config.ConfigFile('/etc/abrt/abrt.conf')
- return cf['DumpLocation'] or default_abrt_dir
-
-
def main(self):
if not (self.options.report or self.options.update_count or self.options.sync):
print _("No command specified. Use --help for more information on the
usage.")
@@ -86,7 +76,7 @@ class AbrtCli(rhncli.RhnCli):
spacewalk_abrt.abrt.update_count(self.options.update_count)
if self.options.sync:
- return (spacewalk_abrt.abrt.sync(self.get_abrt_dir()))
+ return (spacewalk_abrt.abrt.sync())
sys.exit(0)
diff --git a/client/tools/spacewalk-abrt/src/spacewalk_abrt/abrt.py
b/client/tools/spacewalk-abrt/src/spacewalk_abrt/abrt.py
index 9dc1ad9..b908f37 100644
--- a/client/tools/spacewalk-abrt/src/spacewalk_abrt/abrt.py
+++ b/client/tools/spacewalk-abrt/src/spacewalk_abrt/abrt.py
@@ -26,6 +26,7 @@ import gettext
t = gettext.translation('spacewalk-abrt', fallback=True)
_ = t.ugettext
+from up2date_client import config
from up2date_client import up2dateAuth
from up2date_client import rhnserver
from up2date_client import up2dateLog
@@ -41,6 +42,15 @@ def _readline(filepath):
else:
return None
+def _get_abrt_dir():
+ abrt_dir = '/var/tmp/abrt'
+ for directory in ['/var/tmp/abrt', '/var/spool/abrt']:
+ if os.path.exists(directory) and os.path.isdir(directory):
+ abrt_dir = directory
+
+ cf = config.ConfigFile('/etc/abrt/abrt.conf')
+ return cf['DumpLocation'] or abrt_dir
+
def report(problem_dir):
problem_dir = os.path.normpath(os.path.abspath(problem_dir))
basename = os.path.basename(problem_dir)
@@ -123,8 +133,8 @@ def update_count(problem_dir):
return 1
-def sync(abrt_dir):
- abrt_dir = os.path.normpath(abrt_dir)
+def sync():
+ abrt_dir = os.path.normpath(_get_abrt_dir())
if not (os.path.exists(abrt_dir) and os.path.isdir(abrt_dir)):
log.log_me("The specified path [%s] is not a valid directory." %
abrt_dir)
return -1
Show replies by date