Mercurial > code > home > repos > homeauto
view service/arduinoNode/pushConfig.py @ 1149:163042261ef1
rename board0 to boardBang. add other temp sensor.
Ignore-this: 10df00e617c1f4d5b4427efb5e9a544d
darcs-hash:cb8ca1761579e8eb0932271f62513ae4b7e93fc4
author | drewp <drewp@bigasterisk.com> |
---|---|
date | Sat, 14 Apr 2018 23:47:34 -0700 |
parents | 8b4eda2cf0bd |
children | 12f9f1838fb5 |
line wrap: on
line source
from __future__ import division import sys import etcd3 from twisted.python.filepath import FilePath etcd = etcd3.client(host='bang6') prefix, = sys.argv[1:] def main(): existing = set(md.key for v, md in etcd.get_prefix(prefix)) written = set() root = FilePath('config') 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()