Add gen-readme script
This commit is contained in:
parent
24cac6b1a4
commit
0a69d4dfe9
|
@ -2,3 +2,4 @@
|
|||
/.py3/
|
||||
/variables.json
|
||||
/scrub-old-amis.py
|
||||
/gen-readme.py
|
||||
|
|
4
Makefile
4
Makefile
|
@ -17,10 +17,10 @@ build/convert:
|
|||
@echo "json.dump(yaml.load(open(sys.argv[1])), sys.stdout, indent=4, separators=(',', ': '))" >> build/convert
|
||||
@chmod +x build/convert
|
||||
|
||||
scrub-old-amis.py: scrub-old-amis.py.in
|
||||
%.py: %.py.in
|
||||
sed "s|@PYTHON@|#!`pwd`/.py3/bin/python|" $< > $@
|
||||
chmod +x $@
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
rm -rf build .py3 scrub-old-amis.py
|
||||
rm -rf build .py3 scrub-old-amis.py gen-readme.py
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
@PYTHON@
|
||||
|
||||
import yaml
|
||||
|
||||
URI_TEMPLATE = "https://{region}.console.aws.amazon.com/ec2/home#launchAmi={ami}"
|
||||
ROW_TEMPLATE = "| {release} | {region} | [{ami}]({uri}) |"
|
||||
|
||||
|
||||
with open("release.yaml") as fp:
|
||||
releases = yaml.load(fp)
|
||||
|
||||
for metadata in releases.values():
|
||||
release = str(metadata["alpine-release"])
|
||||
|
||||
for region, ami in metadata["region-identifiers"].items():
|
||||
uri = URI_TEMPLATE.format(**locals())
|
||||
print(ROW_TEMPLATE.format(**locals()))
|
Loading…
Reference in New Issue