aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Harvey <chris@basementcode.com>2010-06-10 15:32:27 -0400
committerChristopher Harvey <chris@basementcode.com>2010-06-10 15:32:27 -0400
commit74ad8c22f3605a38b521fcd12504afe9d1f076c4 (patch)
tree22b295b855d04e0f4a7fd4464cc0707e3c7a810d
parentMerge branch 'work' (diff)
downloadventoo-74ad8c22f3605a38b521fcd12504afe9d1f076c4.tar.gz
ventoo-74ad8c22f3605a38b521fcd12504afe9d1f076c4.tar.bz2
ventoo-74ad8c22f3605a38b521fcd12504afe9d1f076c4.zip
Fixed getAugeasPathFromSystemPath to work with / as root.
-rw-r--r--src/backend/augeas_utils.py9
-rw-r--r--src/frontend/main.py2
2 files changed, 6 insertions, 5 deletions
diff --git a/src/backend/augeas_utils.py b/src/backend/augeas_utils.py
index 8ec0749..6db6551 100644
--- a/src/backend/augeas_utils.py
+++ b/src/backend/augeas_utils.py
@@ -68,8 +68,11 @@ def getVentooModuleNameFromSysPath(a, sysPath):
"""
def getAugeasPathFromSystemPath(a, sysPath):
aug_root = a.get("/augeas/root")
- tmp = osp.relpath(sysPath, aug_root)
- return osp.join('files/', tmp)
+ if aug_root != '/':
+ tmp = osp.relpath(sysPath, aug_root)
+ else:
+ tmp = sysPath
+ return osp.join('/files/', stripLeadingSlash(tmp))
"""
Return an int that says how much to add to 'have' so that it matches mult.
@@ -193,12 +196,10 @@ def makeDiffTree(a, treeRoot):
files = accumulateFiles(a)
for i in range(len(files)): #append .augnew to each file.
files[i] += '.augnew'
- #pdb.set_trace()
a.save()
for f in files:
#each file could exist, copy the ones that do.
if osp.isfile(f):
- #pdb.set_trace()
try:
os.makedirs(osp.join("/tmp", userName, "augeas", stripLeadingSlash(osp.split(f)[0])))
except:
diff --git a/src/frontend/main.py b/src/frontend/main.py
index eded4cc..84dd7d9 100644
--- a/src/frontend/main.py
+++ b/src/frontend/main.py
@@ -133,7 +133,7 @@ class MainWindow(gtk.Window):
docPath = None
#if this is a comment node display all surround docs/comments
if osp.split(p)[1].startswith("#comment["):
- toDisplay = self.getDocsStartingAt(osp.join("/files", augeas_utils.stripBothSlashes(self.currentConfigFilePath), p), "<br>")
+ toDisplay = self.getDocsStartingAt(osp.join(augeas_utils.getAugeasPathFromSystemPath(self.a, self.currentConfigFilePath), p), "<br>")
docPath = "/tmp/commentsDoc.html"
outFile = open("/tmp/commentsDoc.html", 'w')
outFile.write("<html>\n")