Merge "Fix: Make server resize options required"

This commit is contained in:
Zuul
2026-02-10 16:24:11 +00:00
committed by Gerrit Code Review
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.