Last active
December 27, 2018 16:18
-
-
Save ekohl/f8f84cd3a21d041d18bf1ea2381a2d22 to your computer and use it in GitHub Desktop.
Foreman Installer dependencies
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import argparse | |
import json | |
def normalize_name(module): | |
full_name = module.replace('-', '/', 1).lower() | |
author, name = full_name.split('/', 1) | |
return name if author in ('theforeman', 'katello') else full_name | |
def handle_metadata(metadata): | |
data = json.load(metadata) | |
name = normalize_name(data['name']) | |
dependencies = data.get('dependencies', []) | |
for dependency in dependencies: | |
dep_name = normalize_name(dependency['name']) | |
if dep_name not in ('puppetlabs/concat', 'puppetlabs/stdlib', 'puppet/extlib'): | |
yield name, dep_name, None | |
def main(): | |
parser = argparse.ArgumentParser() | |
parser.add_argument('metadata', nargs='+', type=argparse.FileType('r')) | |
args = parser.parse_args() | |
print('digraph "module dependencies" {') | |
for metadata in args.metadata: | |
for module, dependency, label in handle_metadata(metadata): | |
if label: | |
print(' "{module}" -> "{dependency}" [label="{label}"]'.format( | |
module=module, dependency=dependency, label=label)) | |
else: | |
print(' "{module}" -> "{dependency}"'.format( | |
module=module, dependency=dependency)) | |
print('}') | |
if __name__ == '__main__': | |
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
digraph "module dependencies" { | |
"candlepin" -> "puppetlabs/postgresql" | |
"candlepin" -> "qpid" | |
"certs" -> "jlambert121/trusted_ca" | |
"dhcp" -> "camptocamp/systemd" | |
"foreman" -> "puppetlabs/apache" | |
"foreman" -> "puppetlabs/apt" | |
"foreman" -> "puppetlabs/postgresql" | |
"foreman_proxy_content" -> "puppetlabs/apache" | |
"foreman_proxy_content" -> "foreman_proxy" | |
"foreman_proxy_content" -> "pulp" | |
"foreman_proxy_content" -> "qpid" | |
"foreman_proxy_content" -> "certs" | |
"foreman_proxy" -> "dns" | |
"foreman_proxy" -> "dhcp" | |
"foreman_proxy" -> "foreman" | |
"foreman_proxy" -> "puppet" | |
"foreman_proxy" -> "tftp" | |
"foreman_proxy" -> "richardc/datacat" | |
"katello" -> "puppetlabs/apache" | |
"katello" -> "candlepin" | |
"katello" -> "certs" | |
"katello" -> "pulp" | |
"katello" -> "qpid" | |
"katello" -> "foreman" | |
"pulp" -> "puppetlabs/apache" | |
"pulp" -> "puppet/mongodb" | |
"pulp" -> "qpid" | |
"pulp" -> "thias/squid3" | |
"puppet" -> "puppetlabs/apache" | |
"puppet" -> "puppetlabs/hocon" | |
"qpid" -> "camptocamp/systemd" | |
"tftp" -> "puppetlabs/xinetd" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
digraph "module dependencies" { | |
"candlepin" -> "qpid" | |
"foreman_proxy_content" -> "foreman_proxy" | |
"foreman_proxy_content" -> "pulp" | |
"foreman_proxy_content" -> "qpid" | |
"foreman_proxy_content" -> "certs" | |
"foreman_proxy" -> "dns" | |
"foreman_proxy" -> "dhcp" | |
"foreman_proxy" -> "foreman" | |
"foreman_proxy" -> "puppet" | |
"foreman_proxy" -> "tftp" | |
"katello" -> "candlepin" | |
"katello" -> "certs" | |
"katello" -> "pulp" | |
"katello" -> "qpid" | |
"katello" -> "foreman" | |
"pulp" -> "qpid" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment