From 4377e0d5ab38d09dfe41d1115ab0e4610ec48a10 Mon Sep 17 00:00:00 2001 From: jinzhenguo Date: Wed, 7 Jun 2017 15:48:12 +0800 Subject: [PATCH] fix the function named get_count_all To achieve a unified style in the cluster.py,add function annotation and rename the third parameter Change-Id: I271910695d32c06c46e9cf01e072fb756a33cd76 --- magnum/objects/cluster.py | 13 +++++++++++-- magnum/tests/unit/objects/test_objects.py | 2 +- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/magnum/objects/cluster.py b/magnum/objects/cluster.py index 5b1c04b3aa..eed3becb32 100644 --- a/magnum/objects/cluster.py +++ b/magnum/objects/cluster.py @@ -139,8 +139,17 @@ class Cluster(base.MagnumPersistentObject, base.MagnumObject, return cluster @base.remotable_classmethod - def get_count_all(cls, context, **kwargs): - return cls.dbapi.get_cluster_count_all(context, **kwargs) + def get_count_all(cls, context, filters=None): + """Get count of matching clusters. + + :param context: The security context + :param filters: filter dict, can includes 'cluster_template_id', + 'name', 'node_count', 'stack_id', 'api_address', + 'node_addresses', 'project_id', 'user_id', + 'status'(should be a status list), 'master_count'. + :returns: Count of matching clusters. + """ + return cls.dbapi.get_cluster_count_all(context, filters=filters) @base.remotable_classmethod def get_by_name(cls, context, name): diff --git a/magnum/tests/unit/objects/test_objects.py b/magnum/tests/unit/objects/test_objects.py index 2d30c1196b..1b3654e64a 100644 --- a/magnum/tests/unit/objects/test_objects.py +++ b/magnum/tests/unit/objects/test_objects.py @@ -355,7 +355,7 @@ class TestObject(test_base.TestCase, _TestObject): # For more information on object version testing, read # http://docs.openstack.org/developer/magnum/objects.html object_data = { - 'Cluster': '1.13-87f9b6ff2090663d69a1de2e95c50a27', + 'Cluster': '1.13-5da08d5f023eab4c5657c3fb6997e44c', 'ClusterTemplate': '1.17-74e4e6b1faca768714be809a828599c2', 'Certificate': '1.1-1924dc077daa844f0f9076332ef96815', 'MyObj': '1.0-34c4b1aadefd177b13f9a2f894cc23cd',