Browse Source

Support a "params" stanza in the manifest file that applies to all nodes

Ian Goldberg 1 year ago
parent
commit
74eb0c986d
3 changed files with 13 additions and 5 deletions
  1. 4 3
      App/getpubkeys
  2. 2 0
      App/launch
  3. 7 2
      App/mkconfig.py

+ 4 - 3
App/getpubkeys

@@ -64,9 +64,10 @@ if __name__ == "__main__":
     with open(args.m) as mf:
     with open(args.m) as mf:
         manifest = yaml.safe_load(mf)
         manifest = yaml.safe_load(mf)
         for (node, data) in manifest.items():
         for (node, data) in manifest.items():
-            key = getkey(node, data)
-            if key is not None:
-                pubkeys[node] = key
+            if node != "params":
+                key = getkey(node, data)
+                if key is not None:
+                    pubkeys[node] = key
 
 
     print('')
     print('')
     print(yaml.dump(pubkeys))
     print(yaml.dump(pubkeys))

+ 2 - 0
App/launch

@@ -65,6 +65,8 @@ if __name__ == "__main__":
 
 
     threadlist = []
     threadlist = []
     for node in nodelist:
     for node in nodelist:
+        if node == "params":
+            continue
         thread = threading.Thread(target=launch,
         thread = threading.Thread(target=launch,
             args=(node, manifest, config))
             args=(node, manifest, config))
         thread.start()
         thread.start()

+ 7 - 2
App/mkconfig.py

@@ -30,8 +30,13 @@ def create_json(manifestfile, pubkeysfile, nodelist):
         pubkeys = yaml.safe_load(pf)
         pubkeys = yaml.safe_load(pf)
     if nodelist is None or len(nodelist) == 0:
     if nodelist is None or len(nodelist) == 0:
         nodelist = manifest.keys()
         nodelist = manifest.keys()
-    config = []
+    config = {}
+    if "params" in nodelist:
+        config['params'] = manifest['params']
+    config['nodes'] = []
     for node in nodelist:
     for node in nodelist:
+        if node == "params":
+            continue
         nodeconf = {}
         nodeconf = {}
         m = manifest[node]
         m = manifest[node]
         nodeconf['name'] = node
         nodeconf['name'] = node
@@ -41,7 +46,7 @@ def create_json(manifestfile, pubkeysfile, nodelist):
         for f in ['clisten', 'weight']:
         for f in ['clisten', 'weight']:
             if f in m:
             if f in m:
                 nodeconf[f] = m[f]
                 nodeconf[f] = m[f]
-        config.append(nodeconf)
+        config['nodes'].append(nodeconf)
     return json.dumps(config)
     return json.dumps(config)
 
 
 if __name__ == "__main__":
 if __name__ == "__main__":