# HG changeset patch
# User cl349@xxxxxxxxxxxxxxxxxxxx
# Node ID 960d4f6b58b3fb4d3dab82f98254fa3e6bcbe52a
# Parent f92bdd9153f54583512635ced9d5a8812233f29e
Support removing nodes from store if value to store is None.
Signed-off-by: Christian Limpach <Christian.Limpach@xxxxxxxxxxxx>
diff -r f92bdd9153f5 -r 960d4f6b58b3
tools/python/xen/xend/xenstore/xstransact.py
--- a/tools/python/xen/xend/xenstore/xstransact.py Wed Sep 14 19:22:31 2005
+++ b/tools/python/xen/xend/xenstore/xstransact.py Wed Sep 14 19:29:25 2005
@@ -113,7 +113,7 @@
else:
(key, fn, defval) = tup
try:
- val = fn(self.read(key))
+ val = fn(self._read(key))
except TypeError:
val = defval
ret.append(val)
@@ -128,12 +128,16 @@
try:
fmt = { str : "%s",
int : "%i",
- float : "%f" }[type(val)]
+ float : "%f",
+ type(None) : None }[type(val)]
except KeyError:
raise TypeError
else:
(key, val, fmt) = tup
- self.write(key, fmt % val)
+ if val:
+ self._write(key, fmt % val)
+ else:
+ self._remove(key)
def Read(cls, path, *args):
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|