Skip to content

Commit 37631fe

Browse files
committed
tgt_type vs expr_form: add backward compatilibty, add tests
1 parent bbe3f97 commit 37631fe

2 files changed

Lines changed: 18 additions & 1 deletion

File tree

pepper/libpepper.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ def low(self, lowstate, path='/'):
308308
return self.req(path, lowstate)
309309

310310
def local(self, tgt, fun, arg=None, kwarg=None, tgt_type='glob',
311-
timeout=None, ret=None):
311+
timeout=None, ret=None, expr_form=None):
312312
'''
313313
Run a single command using the ``local`` client
314314
@@ -329,6 +329,13 @@ def local(self, tgt, fun, arg=None, kwarg=None, tgt_type='glob',
329329
if tgt_type:
330330
low['tgt_type'] = tgt_type
331331

332+
if expr_form:
333+
334+
logger.warning('expr_form argument is deprecated in local function, please use tgt_type instead')
335+
336+
if not tgt_type:
337+
low['tgt_type'] = expr_form
338+
332339
if timeout:
333340
low['timeout'] = timeout
334341

tests/integration/test_local.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,13 @@
33

44
def test_local(pepper_client, session_minion_id):
55
assert pepper_client.local('*', 'test.ping')['return'][0][session_minion_id] is True
6+
7+
8+
def test_local_with_tgt_type(pepper_client, session_minion_id):
9+
assert pepper_client.local('*', 'test.ping', tgt_type='list')['return'][0][session_minion_id] is False
10+
assert pepper_client.local(session_minion_id, 'test.ping', tgt_type='list')['return'][0][session_minion_id] is True
11+
12+
13+
def test_local_with_deprecated_expr_form(pepper_client, session_minion_id):
14+
assert pepper_client.local('*', 'test.ping', expr_form='list')['return'][0][session_minion_id] is False
15+
assert pepper_client.local(session_minion_id, 'test.ping', expr_form='list')['return'][0][session_minion_id] is True

0 commit comments

Comments
 (0)