Fix: Make server resize options required

Change-Id: I7e8f4e750822a2e8c85826f49c56e10f7605fedb
Signed-off-by: Jan Ueberacker <jan.ueberacker@inovex.de>
This commit is contained in:
Jan Ueberacker
2026-01-20 10:50:48 +01:00
parent 0a93733293
commit ea0a2c126c
3 changed files with 15 additions and 9 deletions

View File

@@ -4267,7 +4267,7 @@ release the new server and restart the old one."""
metavar='<server>',
help=_('Server (name or ID)'),
)
phase_group = parser.add_mutually_exclusive_group()
phase_group = parser.add_mutually_exclusive_group(required=True)
phase_group.add_argument(
'--flavor',
metavar='<flavor>',

View File

@@ -7896,15 +7896,13 @@ class TestServerResize(compute_fakes.TestComputev2):
('server', self.server.id),
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
result = self.cmd.take_action(parsed_args)
self.compute_client.find_server.assert_called_once_with(
self.server.id, ignore_missing=False
self.assertRaises(
test_utils.ParserException,
self.check_parser,
self.cmd,
arglist,
verifylist,
)
self.compute_client.find_flavor.assert_not_called()
self.compute_client.resize_server.assert_not_called()
self.assertIsNone(result)
def test_server_resize(self):
arglist = [

View File

@@ -0,0 +1,8 @@
---
fixes:
- |
The ``openstack server resize`` command now requires the ``--flavor``
option or one of the deprecated ``--confirm`` or ``--revert`` options
to be provided.
Previously, the command would silently exit successfully without
performing any action if no option was provided.