aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryn M. Reeves <bmr@redhat.com>2012-12-13 00:31:14 +0000
committerBryn M. Reeves <bmr@redhat.com>2012-12-13 00:31:14 +0000
commitbb525888d26d8671507b2e0e25ffd5cb82ec8ae6 (patch)
tree75dae3c18567b0656d4efb61662f819e631300ac
parent40caaa1606094d212d640f00b6800b47a024ffce (diff)
downloadsos-bb525888d26d8671507b2e0e25ffd5cb82ec8ae6.tar.gz
Fix relative paths in reports
Fix the relative paths used by the legacy HTML reporting methods and passed by sosreport to the new Report class. Fixes Issue #88
-rw-r--r--sos/plugins/__init__.py10
-rw-r--r--sos/sosreport.py6
2 files changed, 11 insertions, 5 deletions
diff --git a/sos/plugins/__init__.py b/sos/plugins/__init__.py
index 862f34ff..42a85aea 100644
--- a/sos/plugins/__init__.py
+++ b/sos/plugins/__init__.py
@@ -661,7 +661,8 @@ class Plugin(object):
if len(self.copiedFiles):
html = html + "<p>Files copied:<br><ul>\n"
for afile in self.copiedFiles:
- html = html + '<li><a href="%s">%s</a>' % (afile['dstpath'], afile['srcpath'])
+ html = html + '<li><a href="%s">%s</a>' % \
+ (".." + afile['dstpath'], afile['srcpath'])
if (afile['symlink'] == "yes"):
html = html + " (symlink to %s)" % afile['pointsto']
html = html + '</li>\n'
@@ -671,10 +672,13 @@ class Plugin(object):
if len(self.executedCommands):
html = html + "<p>Commands Executed:<br><ul>\n"
# convert file name to relative path from our root
+ # don't use relpath - these are HTML paths not OS paths.
for cmd in self.executedCommands:
if cmd["file"] and len(cmd["file"]):
- cmdOutRelPath = sosRelPath(self.cInfo['rptdir'], self.cInfo['cmddir'] + "/" + cmd['file'])
- html = html + '<li><a href="%s">%s</a></li>\n' % (cmdOutRelPath, cmd['exe'])
+ cmdOutRelPath = "../" + self.cInfo['cmddir'] \
+ + "/" + cmd['file']
+ html = html + '<li><a href="%s">%s</a></li>\n' % \
+ (cmdOutRelPath, cmd['exe'])
else:
html = html + '<li>%s</li>\n' % (cmd['exe'])
html = html + "</ul></p>\n"
diff --git a/sos/sosreport.py b/sos/sosreport.py
index 582fef08..54478a01 100644
--- a/sos/sosreport.py
+++ b/sos/sosreport.py
@@ -679,10 +679,12 @@ class SoSReport(object):
section.add(Note(plug.customText))
for f in plug.copiedFiles:
- section.add(CopiedFile(name=f["srcpath"], href=f["dstpath"]))
+ section.add(CopiedFile(name=f['srcpath'],
+ href= ".." + f['dstpath']))
for cmd in plug.executedCommands:
- section.add(Command(name=cmd['exe'], return_code=0, href=cmd['file']))
+ section.add(Command(name=cmd['exe'], return_code=0,
+ href="../" + cmd['file']))
for content, f in plug.copyStrings:
section.add(CreatedFile(name=f))