aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorClark Williams <williams@redhat.com>2012-12-05 10:53:34 -0600
committerClark Williams <williams@redhat.com>2012-12-05 10:53:34 -0600
commitcd298b146bff8b206d51e482c747603066c5852e (patch)
treee69d2f97d02440fdaab8ad89c0b875fe94e6e7af
parenta9b86f57f44316f31206af49722f09142343dfb3 (diff)
downloadrteval-cd298b146bff8b206d51e482c747603066c5852e.tar.gz
handle no 'dmesg' file in osinfo.py
Some systems (Fedora 17+) do not store the boot time dmesg output in a file. If it does not exist, try to run the dmesg program to generate current dmesg output. If the file doesn't exist and we can't find the dmesg program, print an error Signed-off-by: Clark Williams <williams@redhat.com>
-rw-r--r--rteval/sysinfo/osinfo.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/rteval/sysinfo/osinfo.py b/rteval/sysinfo/osinfo.py
index 604e63a..271ada2 100644
--- a/rteval/sysinfo/osinfo.py
+++ b/rteval/sysinfo/osinfo.py
@@ -49,10 +49,14 @@ class OSInfo(object):
def copy_dmesg(self, repdir):
dpath = "/var/log/dmesg"
- if not os.path.exists(dpath):
- print "dmesg file not found at %s" % dpath
+ if os.path.exists(dpath):
+ shutil.copyfile(dpath, os.path.join(repdir, "dmesg"))
return
- shutil.copyfile(dpath, os.path.join(repdir, "dmesg"))
+ if os.path.exists('/usr/bin/dmesg'):
+ subprocess.call('/usr/bin/dmesg > %s' % os.path.join(repdir, "dmesg"), shell=True)
+ return
+ print "dmesg file not found at %s and no dmesg exe found!" % dpath
+
def run_sysreport(self, repdir):