From 7c54bc9597efb2173984aeff131e1f924da6153f Mon Sep 17 00:00:00 2001 From: Billy Olsen Date: Fri, 23 Nov 2018 10:07:05 -0700 Subject: [PATCH] Consistent ordering of ADDRESS_TYPES when traversing dict charms_openstack.adapters.ADDRESS_TYPES is traversed when filling in network split information for haproxy configuration file generation. The ADDRESS_TYPES constant is built from the keys of a simple python dictionary, which provides no guaranteed ordering. This causes the charm to render slight variations of the haproxy.cfg file and the haproxy service is restarted as a result. This is fixed by simply sorting the keys to ensure consistent ordering. The list is reverse sorted so that the iteration occurs in the order of public -> internal -> admin. Change-Id: I89b2ee42b5827d0fe5bbb2ff7051e1bb5bd08c63 Closes-Bug: #1800980 --- charms_openstack/adapters.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charms_openstack/adapters.py b/charms_openstack/adapters.py index 777af77..b7d6a6e 100644 --- a/charms_openstack/adapters.py +++ b/charms_openstack/adapters.py @@ -30,7 +30,7 @@ import charmhelpers.core.hookenv as hookenv import charmhelpers.core.host as ch_host import charms_openstack.ip as os_ip -ADDRESS_TYPES = os_ip.ADDRESS_MAP.keys() +ADDRESS_TYPES = sorted(os_ip.ADDRESS_MAP.keys(), reverse=True) # handle declarative adapter properties using a decorator and simple functions