Mercurial > code > home > repos > homeauto
view service/arduinoNode/pushConfig.py @ 1140:f349fe25789c
rgb strip animation support in arduinoNode
Ignore-this: 5f50c7b54ce1588243735c43d2cbea0f
darcs-hash:0e2e1e2156b181c83d6e4f2f85afc849dc07fec0
author | drewp <drewp@bigasterisk.com> |
---|---|
date | Sat, 03 Mar 2018 17:55:37 -0800 |
parents | db955e7943af |
children | 13b2a61650c1 |
line wrap: on
line source
from __future__ import division import etcd3 from twisted.python.filepath import FilePath etcd = etcd3.client(host='bang6') def main(): prefix = b'arduino/' 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()