RRD: Fix updating of DS
This commit is contained in:
parent
6fc1423124
commit
43e70191f1
17
RRD.py
17
RRD.py
|
@ -80,9 +80,9 @@ class RRD:
|
||||||
raise FileNotFoundError(self.filename)
|
raise FileNotFoundError(self.filename)
|
||||||
info = self.info()
|
info = self.info()
|
||||||
if set(ds_list) - set(info['ds'].values()) != set():
|
if set(ds_list) - set(info['ds'].values()) != set():
|
||||||
if set((ds.name, ds.type) for ds in ds_list) \
|
for ds in ds_list:
|
||||||
- set((ds.name, ds.type) for ds in info['ds'].values()) != set():
|
if ds.name in info['ds'] and ds.type != info['ds'][ds.name].type:
|
||||||
raise RRDIncompatibleException()
|
raise RRDIncompatibleException("%s is %s but should be %s" % (ds.name, ds.type, info['ds'][ds.name].type))
|
||||||
else:
|
else:
|
||||||
raise RRDOutdatedException()
|
raise RRDOutdatedException()
|
||||||
|
|
||||||
|
@ -177,15 +177,8 @@ class RRD:
|
||||||
echo = True
|
echo = True
|
||||||
dump.stdout.close()
|
dump.stdout.close()
|
||||||
restore.stdin.close()
|
restore.stdin.close()
|
||||||
try:
|
dump.wait()
|
||||||
dump.wait(1)
|
restore.wait()
|
||||||
except subprocess.TimeoutExpired:
|
|
||||||
dump.kill()
|
|
||||||
try:
|
|
||||||
restore.wait(2)
|
|
||||||
except subprocess.TimeoutExpired:
|
|
||||||
dump.kill()
|
|
||||||
raise RuntimeError("rrdtool restore process killed")
|
|
||||||
|
|
||||||
os.rename(self.filename + ".new", self.filename)
|
os.rename(self.filename + ".new", self.filename)
|
||||||
self._cached_info = None
|
self._cached_info = None
|
||||||
|
|
Loading…
Reference in a new issue