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!
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

38 linhas
1.0KB

  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()