Merge "Fix updating a non-HTTP(S) Health Monitor"

This commit is contained in:
Zuul 2022-09-12 10:48:08 +00:00 committed by Gerrit Code Review
commit a51d197669
2 changed files with 22 additions and 9 deletions

View File

@ -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)

View File

@ -0,0 +1,5 @@
---
fixes:
- |
Fix a bug that prevented the update of non-HTTP and non-HTTPS health
monitors.