Mercurial > code > home > repos > homeauto
view service/arduinoNode/pushConfig.py @ 1513:c829df2b0dd5
new graph output for browsers, with autorefresh
Ignore-this: e4ff4dbed311b238d90988a1891ef640
darcs-hash:ba19d0d8975104ec6a3580e50cf8b7ca7745abdc
author | drewp <drewp@bigasterisk.com> |
---|---|
date | Mon, 03 Feb 2020 23:47:23 -0800 |
parents | c3c2418d138c |
children | 6b80a6c58907 |
line wrap: on
line source
from __future__ import division import sys import etcd3 from twisted.python.filepath import FilePath etcd = etcd3.client(host='bang', port=9022) prefix, = sys.argv[1:] def main(): existing = set(md.key for v, md in etcd.get_prefix(prefix)) written = set() root = FilePath('config') print 'reading at %s' % root for f in root.walk(): if f.isfile() and f.path.endswith('.n3'): n3 = f.getContent() key = prefix + b'/'.join(f.segmentsFrom(root)) etcd.put(key, n3) written.add(key) print 'wrote %s' % key for k in existing - written: etcd.delete(k) print 'removed %s' % k main()