From 7cf1e4b7e40cb9eb70419f3c404c70d6fdc66aa0 Mon Sep 17 00:00:00 2001 From: Roger Luethi Date: Thu, 16 Jul 2026 10:02:07 +0200 Subject: [PATCH] manage images: default --cloud to admin A bare `osism manage images` failed on every standard OSISM deployment with `ConfigException: Cloud openstack was not found`. The Images command defaulted --cloud to "openstack", a profile that cfg-cookiecutter's clouds.yml never ships: it provides admin, admin-system, and octavia. The "openstack" value was inherited from the standalone openstack-image-manager tool rather than OSISM's own operator-profile convention. Change the default to "admin", matching the sibling subcommands (manage flavors, manage project *) and a profile that actually exists in the shipped clouds.yml, so the documented bare invocation works out of the box. Add a regression guard asserting the parsed default. DocImpact Assisted-by: Claude:claude-opus-4-8 Signed-off-by: Roger Luethi --- osism/commands/manage.py | 2 +- tests/unit/commands/test_manage_wiring.py | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/osism/commands/manage.py b/osism/commands/manage.py index 1d2a53e1c..655783b77 100644 --- a/osism/commands/manage.py +++ b/osism/commands/manage.py @@ -531,7 +531,7 @@ def get_parser(self, prog_name): action="store_true", ) parser.add_argument( - "--cloud", type=str, help="Cloud name in clouds.yaml", default="openstack" + "--cloud", type=str, help="Cloud name in clouds.yaml", default="admin" ) parser.add_argument( "--filter", diff --git a/tests/unit/commands/test_manage_wiring.py b/tests/unit/commands/test_manage_wiring.py index 79e42fadb..8721cb692 100644 --- a/tests/unit/commands/test_manage_wiring.py +++ b/tests/unit/commands/test_manage_wiring.py @@ -29,6 +29,15 @@ def _stub_args(**overrides) -> MagicMock: return args +def test_images_cloud_default_matches_shipped_profile(): + # The shipped cfg-cookiecutter clouds.yml provides 'admin' (not 'openstack'), + # so a bare `osism manage images` must default to a profile that exists. + cmd = manage.Images(MagicMock(), MagicMock()) + parser = cmd.get_parser("manage images") + args = parser.parse_args([]) + assert args.cloud == "admin" + + def test_w1_octavia_wires_validators_to_call_sites(): cmd = manage.ImageOctavia(MagicMock(), MagicMock()) args = _stub_args()