IF YOU WOULD LIKE TO GET AN ACCOUNT, please write an email to s dot adaszewski at gmail dot com. User accounts are meant only to report issues and/or generate pull requests. This is a purpose-specific Git hosting for ADARED projects. Thank you for your understanding!
Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

getmetadata.py 1.0KB

12345678910111213141516171819202122232425262728293031323334353637
  1. import glob
  2. import yaml
  3. import json
  4. def main():
  5. res_ips = []
  6. res_domains = []
  7. for fname in glob.glob('../**/focker-compose.yml'):
  8. print(fname)
  9. with open(fname, 'r') as f:
  10. spec = yaml.safe_load(f)
  11. if 'jails' not in spec:
  12. continue
  13. for j in spec['jails'].values():
  14. if 'ip4.addr' not in j:
  15. continue
  16. if 'meta' not in j:
  17. continue
  18. if 'domains' not in j['meta']:
  19. continue
  20. if not j['meta']['domains']:
  21. continue
  22. domains = j['meta']['domains']
  23. if not isinstance(domains, list):
  24. domains = [ domains ]
  25. res_ips.append(j['ip4.addr'])
  26. res_domains.append(domains)
  27. res = { 'directory_name': 'nginx_conf',
  28. 'ips': [ res_ips ],
  29. 'domains': [ res_domains ] }
  30. with open('./files/cookiecutter.json', 'w') as f:
  31. json.dump(res, f)
  32. if __name__ == '__main__':
  33. main()