Mercurial > code > home > repos > homeauto
view service/arduinoNode/pushConfig.py @ 400:1b303e7542a3
start the next python rewrite of rfid pm_532 reader. Nim didn'
Ignore-this: b6a98b3f0f1c4147bedcc5d2bcfec226
t go well with asynchttpserer adn hreaind
author | drewp@bigasterisk.com |
---|---|
date | Wed, 27 Feb 2019 10:23:36 -0800 |
parents | 13b2a61650c1 |
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()