Skip to content

Commit b1cbac6

Browse files
committed
query_and_count -> query_with_count.
1 parent f79d664 commit b1cbac6

File tree

8 files changed

+13
-13
lines changed

8 files changed

+13
-13
lines changed

CHANGELOG.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ Fixed
4848
* Fix api key generation, to use system user, when auth is disabled. (bug fix) #3578 #3593
4949
* Fix invocation of Mistral workflow from Action Chain with jinja in params. (bug fix) #3440
5050
* Fix st2client API bug, a backward incompatible change in `query()` method, introduced in note
51-
implementation(#3514) in 2.3.1. The `query()` method is now backward compatible (pre 2.3) and
52-
`query_and_count()` method is used for results pagination and note. #3616
51+
implementation (#3514) in 2.3.1. The `query()` method is now backward compatible (pre 2.3) and
52+
`query_with_count()` method is used for results pagination and note. #3616
5353

5454
2.3.1 - July 07, 2017
5555
---------------------

st2client/st2client/commands/action.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1062,7 +1062,7 @@ def run(self, args, **kwargs):
10621062
exclude_attributes = ','.join(exclude_attributes)
10631063
kwargs['exclude_attributes'] = exclude_attributes
10641064

1065-
return self.manager.query_and_count(limit=args.last, **kwargs)
1065+
return self.manager.query_with_count(limit=args.last, **kwargs)
10661066

10671067
def run_and_print(self, args, **kwargs):
10681068

st2client/st2client/commands/rule.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def run(self, args, **kwargs):
8383
# switch attr to display the trigger and action
8484
args.attr = self.display_attributes_iftt
8585

86-
return self.manager.query_and_count(limit=args.last, **kwargs)
86+
return self.manager.query_with_count(limit=args.last, **kwargs)
8787

8888
def run_and_print(self, args, **kwargs):
8989
instances, count = self.run(args, **kwargs)

st2client/st2client/commands/rule_enforcement.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ def run(self, args, **kwargs):
110110
if args.timestamp_lt:
111111
kwargs['enforced_at_lt'] = args.timestamp_lt
112112

113-
return self.manager.query_and_count(limit=args.last, **kwargs)
113+
return self.manager.query_with_count(limit=args.last, **kwargs)
114114

115115
def run_and_print(self, args, **kwargs):
116116
instances, count = self.run(args, **kwargs)

st2client/st2client/commands/trace.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ def run(self, args, **kwargs):
163163
kwargs['sort_asc'] = True
164164
elif args.sort_order in ['desc', 'descending']:
165165
kwargs['sort_desc'] = True
166-
return self.manager.query_and_count(limit=args.last, **kwargs)
166+
return self.manager.query_with_count(limit=args.last, **kwargs)
167167

168168
def run_and_print(self, args, **kwargs):
169169
instances, count = self.run(args, **kwargs)

st2client/st2client/commands/triggerinstance.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ def run(self, args, **kwargs):
118118
if args.status:
119119
kwargs['status'] = args.status
120120

121-
return self.manager.query_and_count(limit=args.last, **kwargs)
121+
return self.manager.query_with_count(limit=args.last, **kwargs)
122122

123123
def run_and_print(self, args, **kwargs):
124124

st2client/st2client/models/core.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ def _query_details(self, **kwargs):
268268
response = self.client.get(url)
269269

270270
if response.status_code == 404:
271-
# for query and query_and_count
271+
# for query and query_with_count
272272
return [], None
273273
if response.status_code != 200:
274274
self.handle_error(response)
@@ -282,7 +282,7 @@ def query(self, **kwargs):
282282
return instances
283283

284284
@add_auth_token_to_kwargs_from_env
285-
def query_and_count(self, **kwargs):
285+
def query_with_count(self, **kwargs):
286286
instances, response = self._query_details(**kwargs)
287287
if response and 'X-Total-Count' in response.headers:
288288
return (instances, response.headers['X-Total-Count'])

st2client/tests/unit/test_models.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,9 @@ def test_resource_query(self):
108108
httpclient.HTTPClient, 'get',
109109
mock.MagicMock(return_value=base.FakeResponse(json.dumps([base.RESOURCES[0]]), 200, 'OK',
110110
{'X-Total-Count': '50'})))
111-
def test_resource_query_and_count(self):
111+
def test_resource_query_with_count(self):
112112
mgr = models.ResourceManager(base.FakeResource, base.FAKE_ENDPOINT)
113-
resources, count = mgr.query_and_count(name='abc')
113+
resources, count = mgr.query_with_count(name='abc')
114114
actual = [resource.serialize() for resource in resources]
115115
expected = json.loads(json.dumps([base.RESOURCES[0]]))
116116
self.assertEqual(actual, expected)
@@ -141,9 +141,9 @@ def test_resource_query_404(self):
141141
httpclient.HTTPClient, 'get',
142142
mock.MagicMock(return_value=base.FakeResponse('', 404, 'NOT FOUND',
143143
{'X-Total-Count': '30'})))
144-
def test_resource_query_and_count_404(self):
144+
def test_resource_query_with_count_404(self):
145145
mgr = models.ResourceManager(base.FakeResource, base.FAKE_ENDPOINT)
146-
resources, count = mgr.query_and_count(name='abc')
146+
resources, count = mgr.query_with_count(name='abc')
147147
self.assertListEqual(resources, [])
148148
self.assertIsNone(count)
149149

0 commit comments

Comments
 (0)