Merge "Fix subscription vendor passthru"
This commit is contained in:
commit
8434b56766
@ -30,9 +30,8 @@ sushy = importutils.try_import('sushy')
|
|||||||
|
|
||||||
LOG = log.getLogger(__name__)
|
LOG = log.getLogger(__name__)
|
||||||
METRICS = metrics_utils.get_metrics_logger(__name__)
|
METRICS = metrics_utils.get_metrics_logger(__name__)
|
||||||
SUBSCRIPTION_FIELDS_REMOVE = {
|
SUBSCRIPTION_COMMON_FIELDS = {
|
||||||
'@odata.context', '@odate.etag', '@odata.id', '@odata.type',
|
'Id', 'Context', 'Protocol', 'Destination', 'EventTypes'
|
||||||
'HttpHeaders', 'Oem', 'Name', 'Description'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -111,8 +110,10 @@ class RedfishVendorPassthru(base.VendorInterface):
|
|||||||
"""Verify that the args input are valid."""
|
"""Verify that the args input are valid."""
|
||||||
destination = kwargs.get('Destination')
|
destination = kwargs.get('Destination')
|
||||||
event_types = kwargs.get('EventTypes')
|
event_types = kwargs.get('EventTypes')
|
||||||
context = kwargs.get('Context')
|
# NOTE(iurygregory): Use defaults values from Redfish in case they
|
||||||
protocol = kwargs.get('Protocol')
|
# are not present in the args.
|
||||||
|
context = kwargs.get('Context', "")
|
||||||
|
protocol = kwargs.get('Protocol', "Redfish")
|
||||||
|
|
||||||
if event_types is not None:
|
if event_types is not None:
|
||||||
event_service = redfish_utils.get_event_service(task.node)
|
event_service = redfish_utils.get_event_service(task.node)
|
||||||
@ -147,7 +148,7 @@ class RedfishVendorPassthru(base.VendorInterface):
|
|||||||
|
|
||||||
def _filter_subscription_fields(self, subscription_json):
|
def _filter_subscription_fields(self, subscription_json):
|
||||||
filter_subscription = {k: v for k, v in subscription_json.items()
|
filter_subscription = {k: v for k, v in subscription_json.items()
|
||||||
if k not in SUBSCRIPTION_FIELDS_REMOVE}
|
if k in SUBSCRIPTION_COMMON_FIELDS}
|
||||||
return filter_subscription
|
return filter_subscription
|
||||||
|
|
||||||
@METRICS.timer('RedfishVendorPassthru.create_subscription')
|
@METRICS.timer('RedfishVendorPassthru.create_subscription')
|
||||||
@ -196,7 +197,7 @@ class RedfishVendorPassthru(base.VendorInterface):
|
|||||||
"Required argument: a dictionary of "
|
"Required argument: a dictionary of "
|
||||||
"{'id': 'subscription_bmc_id'}"))
|
"{'id': 'subscription_bmc_id'}"))
|
||||||
def delete_subscription(self, task, **kwargs):
|
def delete_subscription(self, task, **kwargs):
|
||||||
"""Creates a subscription.
|
"""Delete a subscription.
|
||||||
|
|
||||||
:param task: A TaskManager object.
|
:param task: A TaskManager object.
|
||||||
:param kwargs: The arguments sent with vendor passthru.
|
:param kwargs: The arguments sent with vendor passthru.
|
||||||
@ -225,7 +226,7 @@ class RedfishVendorPassthru(base.VendorInterface):
|
|||||||
'node': task.node.uuid,
|
'node': task.node.uuid,
|
||||||
'error': e})
|
'error': e})
|
||||||
LOG.error(error_msg)
|
LOG.error(error_msg)
|
||||||
raise exception.RedfishError(error=error_msg)
|
raise exception.RedfishError(error=error_msg, code=404)
|
||||||
|
|
||||||
@METRICS.timer('RedfishVendorPassthru.get_subscriptions')
|
@METRICS.timer('RedfishVendorPassthru.get_subscriptions')
|
||||||
@base.passthru(['GET'], async_call=False,
|
@base.passthru(['GET'], async_call=False,
|
||||||
|
@ -0,0 +1,9 @@
|
|||||||
|
---
|
||||||
|
fixes:
|
||||||
|
- |
|
||||||
|
The validation for ``create_subscription`` now uses the default values
|
||||||
|
from Redfish for `Context` and `Protocol` to avoid `None`.
|
||||||
|
The fields returned by ``create_subscription`` and ``get_subscription``
|
||||||
|
are now filtered by the common fields between vendors.
|
||||||
|
Deleting a subscription that doesn't exist will return 404 instead of 500.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user