From 8e12d76f86eccac41469f2f100b8fdab0bec0d6b Mon Sep 17 00:00:00 2001 From: Igor Gajsin Date: Fri, 17 Mar 2017 19:23:27 +0300 Subject: [PATCH] Reorder configs_query by time There is the possibility to change OpenStack config after deployment. Changes could be applied per role. And in the case of multiple roles on a node, many changes could pretend to be applied. I.e. if we have a config for the role 'compute', a config for the role 'cinder' and a node with role 'cinder+compute' we have to choose one of them. Previous decision was 'sort it in the lexicographical order', so it applies 'cinder' then --- 'compute'. It is contra intuitive. The best option is applying to a node the last related config, to new config overlaps old ones. Change-Id: I7db388ca3baeb351adc9fdb70c55b0be50fafe48 Closes-bug: #1671521 --- nailgun/nailgun/objects/openstack_config.py | 2 +- nailgun/nailgun/test/unit/test_stages_task_serialization.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/nailgun/nailgun/objects/openstack_config.py b/nailgun/nailgun/objects/openstack_config.py index bf97622d3f..f6e5ac02da 100644 --- a/nailgun/nailgun/objects/openstack_config.py +++ b/nailgun/nailgun/objects/openstack_config.py @@ -104,7 +104,7 @@ class OpenstackConfigCollection(NailgunCollection): """ configs_query = cls.filter_by( None, cluster_id=cluster.id, is_active=True) - configs_query = configs_query.order_by(cls.single.model.node_role) + configs_query = configs_query.order_by(cls.single.model.created_at) node_ids = set(n.id for n in nodes) node_roles = set() diff --git a/nailgun/nailgun/test/unit/test_stages_task_serialization.py b/nailgun/nailgun/test/unit/test_stages_task_serialization.py index 0b0f0dd487..11faa060a5 100644 --- a/nailgun/nailgun/test/unit/test_stages_task_serialization.py +++ b/nailgun/nailgun/test/unit/test_stages_task_serialization.py @@ -313,7 +313,7 @@ class TestHooksSerializers(BaseTaskSerializationTest): 'DEFAULT/param_b': {'value': 'value_cinder'} }, 'keystone_config': { - 'DEFAULT/param_a': {'value': 'value_compute'}, + 'DEFAULT/param_a': {'value': 'value_cinder'}, } }})