From 63c70381cf5808ac12ac209a37f3b4d1bd13b6ae Mon Sep 17 00:00:00 2001 From: Alex Kavanagh Date: Wed, 15 Jun 2016 14:31:13 +0000 Subject: [PATCH] Change states_to_check() to return OrderedDict Previously it returned a simple dictionary. However, this means that the function (potentially) gives different ordering of states to check between Py27 and Py35, but more importantly, different to the order of the required_relations. This provides a fix for that. --- charms_openstack/charm.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/charms_openstack/charm.py b/charms_openstack/charm.py index 0c31840..d8a4612 100644 --- a/charms_openstack/charm.py +++ b/charms_openstack/charm.py @@ -582,14 +582,15 @@ class OpenStackCharm(object): after the first failure. This means that it doesn't check (say) available if connected is not available. """ - states_to_check = { - relation: [("{}.connected".format(relation), - "blocked", - "'{}' missing".format(relation)), - ("{}.available".format(relation), - "waiting", - "'{}' incomplete".format(relation))] - for relation in self.required_relations} + states_to_check = collections.OrderedDict() + for relation in self.required_relations: + states_to_check[relation] = [ + ("{}.connected".format(relation), + "blocked", + "'{}' missing".format(relation)), + ("{}.available".format(relation), + "waiting", + "'{}' incomplete".format(relation))] return states_to_check def check_services_running(self):