Use a UUID instead of a named identity for httpboot
This is an alternative to https://review.opendev.org/c/openstack/sushy-tools/+/902015 The tl;dr is we can leak the uuid out in some weird cases and while things will just keep working, some methods internally really just want a UUID and not a name. The other patch is the name fix. This, explicitly uses a UUID for httpboot, in the event it is still happilly working with a name up until that point. Change-Id: I52121f7e6148aaa3739bc9900b4480b7b3dff8fc
This commit is contained in:
parent
feb88a5c46
commit
6b4e418d6d
|
@ -369,6 +369,7 @@ def system_collection_resource():
|
|||
@api_utils.ensure_instance_access
|
||||
@api_utils.returns_json
|
||||
def system_resource(identity):
|
||||
uuid = app.systems.uuid(identity)
|
||||
if flask.request.method == 'GET':
|
||||
|
||||
app.logger.debug('Serving resources for system "%s"', identity)
|
||||
|
@ -422,7 +423,7 @@ def system_resource(identity):
|
|||
try:
|
||||
# Mount it as an ISO
|
||||
app.systems.set_boot_image(
|
||||
identity,
|
||||
uuid,
|
||||
'Cd', boot_image=image_path,
|
||||
write_protected=True)
|
||||
# Set it for our emulator's API surface to return it
|
||||
|
@ -468,7 +469,7 @@ def system_resource(identity):
|
|||
|
||||
if indicator_led_state:
|
||||
app.indicators.set_indicator_state(
|
||||
app.systems.uuid(identity), indicator_led_state)
|
||||
uuid, indicator_led_state)
|
||||
|
||||
app.logger.info('Set indicator LED to "%s" for system "%s"',
|
||||
indicator_led_state, identity)
|
||||
|
|
|
@ -292,7 +292,7 @@ class SystemsTestCase(EmulatorTestCase):
|
|||
set_http_boot_uri = systems_mock.return_value.set_http_boot_uri
|
||||
set_boot_device.assert_called_once_with('xxxx-yyyy-zzzz', 'Cd')
|
||||
set_boot_image.assert_called_once_with(
|
||||
'xxxx-yyyy-zzzz',
|
||||
mock.ANY,
|
||||
'Cd',
|
||||
boot_image='/path/to/file.iso',
|
||||
write_protected=True)
|
||||
|
|
Loading…
Reference in New Issue