diff --git a/confluent_client/confluent_env.sh b/confluent_client/confluent_env.sh index 0e149a34..e5e241fb 100644 --- a/confluent_client/confluent_env.sh +++ b/confluent_client/confluent_env.sh @@ -166,7 +166,7 @@ _confluent_osimage_completion() return elif [ ${CMPARGS[1]} == 'fetch' ]; then if [ $NUMARGS == 3 ]; then - COMPREPLY=($(compgen -W "alma-10-aarch64 alma-10-x86_64 debian-13-amd64 rocky-10-aarch64 rocky-10-x86_64 ubuntu-26.04-amd64 ubuntu-26.04-arm64 " -- ${COMP_WORDS[COMP_CWORD]})) + COMPREPLY=($(compgen -W "$(osdeploy getfetchable)" -- "${COMP_WORDS[COMP_CWORD]}")) return fi compopt -o dirnames diff --git a/confluent_server/bin/osdeploy b/confluent_server/bin/osdeploy index d00601aa..ddccd241 100644 --- a/confluent_server/bin/osdeploy +++ b/confluent_server/bin/osdeploy @@ -66,6 +66,10 @@ async def main(args): osls = sp.add_parser('list', help='List OS images available for deployment') ubp = sp.add_parser('rebase', help='Update stock profile content from packaged updates') ubp.add_argument('profile', help='Profile to rebase from packaged content') + if len(sys.argv) > 2 and sys.argv[1] == 'getfetchable': # for bash completion + distlist = download.list_fetchable_distributions() + print (' '.join(distlist)) + sys.exit(0) cmdset = ap.parse_args() if cmdset.command == 'list': diff --git a/confluent_server/confluent/deployment/download.py b/confluent_server/confluent/deployment/download.py index f7171a6e..15589267 100644 --- a/confluent_server/confluent/deployment/download.py +++ b/confluent_server/confluent/deployment/download.py @@ -93,6 +93,21 @@ REQUEST_TIMEOUT = aiohttp.ClientTimeout(total=30) DOWNLOAD_TIMEOUT = aiohttp.ClientTimeout(total=None, sock_connect=30, sock_read=60) +def list_fetchable_distributions(): + """Return a list of all known fetchable distributions.""" + distlist = [] + for name, cfg in EL_DISTROS.items(): + for arch in SUPPORTED_ARCHS: + for major in (8, 9, 10): + distlist.append(f"{name}-{major}-{arch}") + for ver in UBUNTU["sources"]: + for version in ["24.04", "26.04"]: + distlist.append(f"ubuntu-{version}-{ver[0]}") + for codename, ver in DEBIAN["suites"]: + for arch in DEBIAN["arches"]: + distlist.append(f"debian-{ver}-{arch}") + return distlist + # Many of the OS download sites are auto generated HTML indexes, we must parse them class DirectoryParser(HTMLParser): """Extract href links from an nginx/apache directory listing page."""