Fix updating a non-HTTP(S) Health Monitor
Prevent octavia-dashboard from sending parameters that trigger a
InvalidOption exception when updating a non-HTTP/non-HTTPS health
monitor.
Story 2008803
Task 42223
Change-Id: Ie669829b149001f77f7475216b86a33d96cb5ff5
(cherry picked from commit a8dc94fdbd
)
This commit is contained in:
parent
775cf1399e
commit
d5ff7fed22
@ -631,19 +631,27 @@ def update_monitor(request, **kwargs):
|
||||
"""
|
||||
data = request.DATA
|
||||
monitor_id = data['monitor']['id']
|
||||
hm_type = data['monitor']['type']
|
||||
|
||||
conn = _get_sdk_connection(request)
|
||||
healthmonitor_kwargs = {
|
||||
'delay': data['monitor'].get('delay'),
|
||||
'timeout': data['monitor'].get('timeout'),
|
||||
'max_retries': data['monitor'].get('max_retries'),
|
||||
'max_retries_down': data['monitor'].get('max_retries_down'),
|
||||
'admin_state_up': data['monitor'].get('admin_state_up'),
|
||||
'name': data['monitor'].get('name')
|
||||
}
|
||||
if hm_type in ('HTTP', 'HTTPS'):
|
||||
healthmonitor_kwargs.update({
|
||||
'http_method': data['monitor'].get('http_method'),
|
||||
'url_path': data['monitor'].get('url_path'),
|
||||
'expected_codes': data['monitor'].get('expected_codes')
|
||||
})
|
||||
|
||||
healthmonitor = conn.load_balancer.update_health_monitor(
|
||||
monitor_id,
|
||||
delay=data['monitor'].get('delay'),
|
||||
timeout=data['monitor'].get('timeout'),
|
||||
max_retries=data['monitor'].get('max_retries'),
|
||||
max_retries_down=data['monitor'].get('max_retries_down'),
|
||||
http_method=data['monitor'].get('http_method'),
|
||||
url_path=data['monitor'].get('url_path'),
|
||||
expected_codes=data['monitor'].get('expected_codes'),
|
||||
admin_state_up=data['monitor'].get('admin_state_up'),
|
||||
name=data['monitor'].get('name')
|
||||
**healthmonitor_kwargs
|
||||
)
|
||||
|
||||
return _get_sdk_object_dict(healthmonitor)
|
||||
|
@ -0,0 +1,5 @@
|
||||
---
|
||||
fixes:
|
||||
- |
|
||||
Fix a bug that prevented the update of non-HTTP and non-HTTPS health
|
||||
monitors.
|
Loading…
Reference in New Issue
Block a user