Mercurial > code > home > repos > homeauto
comparison service/arduinoNode/pushConfig.py @ 1259:672a3d830e7f
arduinoNode: build updates, stats support, etc
Ignore-this: 39386eb7644e3cf522e0f72a874eadba
darcs-hash:b6fa9fbda226917dd3b94d8a87556c4cd6d51180
author | drewp <drewp@bigasterisk.com> |
---|---|
date | Sat, 20 Apr 2019 23:28:29 -0700 |
parents | 8b4eda2cf0bd |
children | 048a8df60e2e |
comparison
equal
deleted
inserted
replaced
1258:f0bbab217983 | 1259:672a3d830e7f |
---|---|
2 import sys | 2 import sys |
3 import etcd3 | 3 import etcd3 |
4 | 4 |
5 from twisted.python.filepath import FilePath | 5 from twisted.python.filepath import FilePath |
6 | 6 |
7 etcd = etcd3.client(host='bang6') | 7 etcd = etcd3.client(host='bang6', port=9022) |
8 | 8 |
9 prefix, = sys.argv[1:] | 9 prefix, = sys.argv[1:] |
10 | 10 |
11 def main(): | 11 def main(): |
12 existing = set(md.key for v, md in etcd.get_prefix(prefix)) | 12 existing = set(md.key for v, md in etcd.get_prefix(prefix)) |
13 written = set() | 13 written = set() |
14 root = FilePath('config') | 14 root = FilePath('config') |
15 print 'reading at %s' % root | |
15 for f in root.walk(): | 16 for f in root.walk(): |
16 if f.isfile() and f.path.endswith('.n3'): | 17 if f.isfile() and f.path.endswith('.n3'): |
17 n3 = f.getContent() | 18 n3 = f.getContent() |
18 key = prefix + b'/'.join(f.segmentsFrom(root)) | 19 key = prefix + b'/'.join(f.segmentsFrom(root)) |
19 etcd.put(key, n3) | 20 etcd.put(key, n3) |