identity: in service set command, don't pass the enable option when it is None

Currently, it is passing None value which is not accepted by keystone
parameters validation:

BadRequestException: 400: Client Error for url: ... Invalid input for field 'enabled': None is not of type 'boolean'

Failed validating 'type' in schema['properties']['enabled']:
    {'enum': [True, False, None], 'type': 'boolean'}

On instance['enabled']:
    None

Closes-Bug: #2083021
Change-Id: Ia8772560deb54e71672102157659d4eb22e6ad59
This commit is contained in:
Alfredo Moralejo 2024-09-30 12:08:47 +02:00
parent 2f790c319d
commit 52d56b3fd9
2 changed files with 2 additions and 4 deletions

View File

@ -225,7 +225,8 @@ class SetService(command.Command):
kwargs['name'] = parsed_args.name
if parsed_args.description:
kwargs['description'] = parsed_args.description
kwargs['is_enabled'] = parsed_args.is_enabled
if parsed_args.is_enabled is not None:
kwargs['is_enabled'] = parsed_args.is_enabled
identity_client.update_service(service.id, **kwargs)

View File

@ -311,7 +311,6 @@ class TestServiceSet(identity_fakes.TestIdentityv3):
# Set expected values
kwargs = {
'type': self.service.type,
'is_enabled': None,
}
self.identity_sdk_client.update_service.assert_called_with(
self.service.id, **kwargs
@ -338,7 +337,6 @@ class TestServiceSet(identity_fakes.TestIdentityv3):
# Set expected values
kwargs = {
'name': self.service.name,
'is_enabled': None,
}
self.identity_sdk_client.update_service.assert_called_with(
self.service.id, **kwargs
@ -365,7 +363,6 @@ class TestServiceSet(identity_fakes.TestIdentityv3):
# Set expected values
kwargs = {
'description': self.service.description,
'is_enabled': None,
}
self.identity_sdk_client.update_service.assert_called_with(
self.service.id, **kwargs