|
| 1 | +#!/usr/bin/env python |
| 2 | + |
| 3 | +import argparse |
| 4 | + |
| 5 | +import requests |
| 6 | + |
| 7 | +from itertools import chain |
| 8 | +from fpo import load_config |
| 9 | + |
| 10 | +REPOS_URL = 'https://api.github.com/orgs/%(owner)s/repos' |
| 11 | +ORGS = ['theforeman'] |
| 12 | + |
| 13 | +EXCLUDED_REPOS = [ |
| 14 | + |
| 15 | + #'theforeman/ansible-foreman_scap_client', |
| 16 | + #'theforeman/foreman-ansible-modules', |
| 17 | + #'theforeman/foreman-discovery-image', |
| 18 | + #'theforeman/foreman-fapolicyd', |
| 19 | + #'theforeman/foreman-installer', |
| 20 | + #'theforeman/foreman-mcp-server', |
| 21 | + #'theforeman/foreman-operations-collection', |
| 22 | + #'theforeman/foreman-selinux', |
| 23 | + #'theforeman/foreman_kernel_care', |
| 24 | + #'theforeman/foreman_maintain', |
| 25 | + #'theforeman/foreman_opennebula', |
| 26 | + #'theforeman/foreman_scap_client', |
| 27 | + #'theforeman/foreman_scap_client_bash', |
| 28 | + #'theforeman/foreman_ygg_worker', |
| 29 | + #'theforeman/foremanctl', |
| 30 | + #'theforeman/hammer-cli' |
| 31 | + #'theforeman/hammer-cli-foreman', |
| 32 | + #'theforeman/hammer-cli-foreman-statistics', |
| 33 | + #'theforeman/journald-logger', |
| 34 | + #'theforeman/journald-native', |
| 35 | + #'theforeman/kafo', |
| 36 | + #'theforeman/kafo_parsers', |
| 37 | + #'theforeman/kafo_wizards', |
| 38 | + #'theforeman/katello-pull-transport-migrate', |
| 39 | + #'theforeman/katello-selinux', |
| 40 | + #'theforeman/ldap_fluff', |
| 41 | + #'theforeman/obsah', |
| 42 | + #'theforeman/puppet-foreman_scap_client', |
| 43 | + #'theforeman/puppet-iop', |
| 44 | + #'theforeman/puppet-iop_advisor_engine', |
| 45 | + #'theforeman/safemode', |
| 46 | + #'theforeman/smart-proxy', |
| 47 | + #'theforeman/smart_proxy_discovery_image', |
| 48 | + #'theforeman/smart_proxy_vault', |
| 49 | + 'theforeman/.github', |
| 50 | + 'theforeman/actions', |
| 51 | + 'theforeman/apidocs', |
| 52 | + 'theforeman/candlepin-oci-images', |
| 53 | + 'theforeman/candlepin-packaging', |
| 54 | + 'theforeman/foreman', |
| 55 | + 'theforeman/foreman-graphics', |
| 56 | + 'theforeman/foreman-infra', |
| 57 | + 'theforeman/foreman-installer-modulesync', |
| 58 | + 'theforeman/foreman-js', |
| 59 | + 'theforeman/foreman-oci-images', |
| 60 | + 'theforeman/foreman-packaging', |
| 61 | + 'theforeman/foreman-plugin-overview', |
| 62 | + 'theforeman/foreman_transfer_repo', |
| 63 | + 'theforeman/gha-matrix-builder', |
| 64 | + 'theforeman/gha-matrix-ruby-verifier', |
| 65 | + 'theforeman/jenkins-jobs', |
| 66 | + 'theforeman/kafo_module_lint', |
| 67 | + 'theforeman/nboci-files', |
| 68 | + 'theforeman/npm2rpm', |
| 69 | + 'theforeman/obal', |
| 70 | + 'theforeman/prprocessor', |
| 71 | + 'theforeman/pulp-oci-images', |
| 72 | + 'theforeman/pulpcore-packaging', |
| 73 | + 'theforeman/puppet-foreman_simple_user', |
| 74 | + 'theforeman/puppet-katello_devel', |
| 75 | + 'theforeman/puppet-motd', |
| 76 | + 'theforeman/redmine_omniauth_github', |
| 77 | + 'theforeman/redmine_release_fields', |
| 78 | + 'theforeman/redmine_ruby_code', |
| 79 | + 'theforeman/smart_proxy_dns_plugin_template', |
| 80 | + 'theforeman/smart_proxy_example', |
| 81 | + 'theforeman/smart_proxy_plugin_template', |
| 82 | + 'theforeman/smoker', |
| 83 | + 'theforeman/theforeman-rel-eng', |
| 84 | + 'theforeman/tool_belt', |
| 85 | +] |
| 86 | + |
| 87 | +all_repos = set() |
| 88 | + |
| 89 | + |
| 90 | + |
| 91 | +def main(): |
| 92 | + parser = argparse.ArgumentParser() |
| 93 | + parser.add_argument('--filename', '-f', default='config.yaml', type=argparse.FileType()) |
| 94 | + |
| 95 | + args = parser.parse_args() |
| 96 | + data = load_config(args.filename) |
| 97 | + |
| 98 | + known_repos = set() |
| 99 | + for entry in chain(data['cli']['plugins'], data['foreman']['plugins'], data['smart_proxy']['modules'], data['smart_proxy']['providers'], data['installer']['modules'], data['client'], data['libraries'], data['auxiliary']): |
| 100 | + known_repos.add(entry.url.replace('https://github.com/', '')) |
| 101 | + |
| 102 | + |
| 103 | + for org in ORGS: |
| 104 | + u = REPOS_URL % {'owner': org} |
| 105 | + while (u): |
| 106 | + r = requests.get(u) |
| 107 | + if (r.ok): |
| 108 | + repos = r.json() |
| 109 | + for repo in repos: |
| 110 | + full_name = f'{org}/{repo['name']}' |
| 111 | + if repo['archived'] or repo['fork'] or full_name in EXCLUDED_REPOS: |
| 112 | + continue |
| 113 | + all_repos.add(full_name) |
| 114 | + if 'next' in r.links: |
| 115 | + u = r.links['next']['url'] |
| 116 | + else: |
| 117 | + u = None |
| 118 | + print(all_repos-known_repos) |
| 119 | + |
| 120 | +if __name__ == '__main__': |
| 121 | + main() |
0 commit comments