Mercurial > code > home > repos > homeauto
annotate service/arduinoNode/pushConfig.py @ 1562:c2ed44ed1e3c dependabot/pip/service/collector/twisted-19.7.0
Bump twisted from 19.2.0 to 19.7.0 in /service/collector
Bumps [twisted](https://github.com/twisted/twisted) from 19.2.0 to 19.7.0.
- [Release notes](https://github.com/twisted/twisted/releases)
- [Changelog](https://github.com/twisted/twisted/blob/trunk/NEWS.rst)
- [Commits](https://github.com/twisted/twisted/compare/twisted-19.2.0...twisted-19.7.0)
Signed-off-by: dependabot[bot] <support@github.com>
author | dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> |
---|---|
date | Fri, 14 Feb 2020 10:01:26 +0000 |
parents | c3c2418d138c |
children | 6b80a6c58907 |
rev | line source |
---|---|
1138 | 1 from __future__ import division |
1148 | 2 import sys |
1139
db955e7943af
arduinonode reads config from etcd. use pushConfig.py to inform all nodes
drewp <drewp@bigasterisk.com>
parents:
1138
diff
changeset
|
3 import etcd3 |
db955e7943af
arduinonode reads config from etcd. use pushConfig.py to inform all nodes
drewp <drewp@bigasterisk.com>
parents:
1138
diff
changeset
|
4 |
1138 | 5 from twisted.python.filepath import FilePath |
6 | |
1426 | 7 etcd = etcd3.client(host='bang', port=9022) |
1138 | 8 |
1148 | 9 prefix, = sys.argv[1:] |
10 | |
1139
db955e7943af
arduinonode reads config from etcd. use pushConfig.py to inform all nodes
drewp <drewp@bigasterisk.com>
parents:
1138
diff
changeset
|
11 def main(): |
db955e7943af
arduinonode reads config from etcd. use pushConfig.py to inform all nodes
drewp <drewp@bigasterisk.com>
parents:
1138
diff
changeset
|
12 existing = set(md.key for v, md in etcd.get_prefix(prefix)) |
1138 | 13 written = set() |
14 root = FilePath('config') | |
1259
672a3d830e7f
arduinoNode: build updates, stats support, etc
drewp <drewp@bigasterisk.com>
parents:
1148
diff
changeset
|
15 print 'reading at %s' % root |
1138 | 16 for f in root.walk(): |
17 if f.isfile() and f.path.endswith('.n3'): | |
18 n3 = f.getContent() | |
19 key = prefix + b'/'.join(f.segmentsFrom(root)) | |
1139
db955e7943af
arduinonode reads config from etcd. use pushConfig.py to inform all nodes
drewp <drewp@bigasterisk.com>
parents:
1138
diff
changeset
|
20 etcd.put(key, n3) |
1138 | 21 written.add(key) |
22 print 'wrote %s' % key | |
23 for k in existing - written: | |
1139
db955e7943af
arduinonode reads config from etcd. use pushConfig.py to inform all nodes
drewp <drewp@bigasterisk.com>
parents:
1138
diff
changeset
|
24 etcd.delete(k) |
1138 | 25 print 'removed %s' % k |
26 | |
1139
db955e7943af
arduinonode reads config from etcd. use pushConfig.py to inform all nodes
drewp <drewp@bigasterisk.com>
parents:
1138
diff
changeset
|
27 main() |