|
@@ -6,8 +6,9 @@
|
|
|
# which we capture. At the end, output all of the public keys to a
|
|
|
# pubkeys.yaml file.
|
|
|
|
|
|
-# Usage: mkpubkeys [manifestfile.yaml [pubkeyfile.yaml]]
|
|
|
+# Usage: getpubkeys [-m manifest.yaml] [-p pubkeys.yaml]
|
|
|
|
|
|
+import argparse
|
|
|
import re
|
|
|
import shlex
|
|
|
import subprocess
|
|
@@ -47,16 +48,20 @@ def getkey(node, manifestdata):
|
|
|
return pubkey
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
- if len(sys.argv) > 1:
|
|
|
- MANIFEST = sys.argv[1]
|
|
|
- if len(sys.argv) > 2:
|
|
|
- PUBKEYS = sys.argv[2]
|
|
|
+ aparse = argparse.ArgumentParser(
|
|
|
+ description='Create a TEEMS pubkeys.yaml file from a manifest.yaml file'
|
|
|
+ )
|
|
|
+ aparse.add_argument('-m', default=MANIFEST,
|
|
|
+ help='manifest.yaml input file')
|
|
|
+ aparse.add_argument('-p', default=PUBKEYS,
|
|
|
+ help='pubkeys.yaml output file')
|
|
|
+ args = aparse.parse_args()
|
|
|
|
|
|
# A dictionary to store the output pubkeys
|
|
|
pubkeys = {}
|
|
|
|
|
|
# Read the manifest
|
|
|
- with open(MANIFEST) as mf:
|
|
|
+ with open(args.m) as mf:
|
|
|
manifest = yaml.safe_load(mf)
|
|
|
for (node, data) in manifest.items():
|
|
|
key = getkey(node, data)
|
|
@@ -65,5 +70,5 @@ if __name__ == "__main__":
|
|
|
|
|
|
print('')
|
|
|
print(yaml.dump(pubkeys))
|
|
|
- with open(PUBKEYS, 'w') as pf:
|
|
|
+ with open(args.p, 'w') as pf:
|
|
|
yaml.dump(pubkeys, pf)
|