diff --git a/pepper/libpepper.py b/pepper/libpepper.py index 205b101..78371c2 100644 --- a/pepper/libpepper.py +++ b/pepper/libpepper.py @@ -330,11 +330,8 @@ def local(self, tgt, fun, arg=None, kwarg=None, tgt_type='glob', low['tgt_type'] = tgt_type if expr_form: - logger.warning('expr_form argument is deprecated in local function, please use tgt_type instead') - - if not tgt_type: - low['tgt_type'] = expr_form + low['tgt_type'] = expr_form if timeout: low['timeout'] = timeout @@ -345,7 +342,7 @@ def local(self, tgt, fun, arg=None, kwarg=None, tgt_type='glob', return self.low([low]) def local_async(self, tgt, fun, arg=None, kwarg=None, tgt_type='glob', - timeout=None, ret=None): + timeout=None, ret=None, expr_form=None): ''' Run a single command using the ``local_async`` client @@ -366,6 +363,10 @@ def local_async(self, tgt, fun, arg=None, kwarg=None, tgt_type='glob', if tgt_type: low['tgt_type'] = tgt_type + if expr_form: + logger.warning('expr_form argument is deprecated in local function, please use tgt_type instead') + low['tgt_type'] = expr_form + if timeout: low['timeout'] = timeout @@ -375,7 +376,7 @@ def local_async(self, tgt, fun, arg=None, kwarg=None, tgt_type='glob', return self.low([low]) def local_batch(self, tgt, fun, arg=None, kwarg=None, tgt_type='glob', - batch='50%', ret=None): + batch='50%', ret=None, expr_form=None): ''' Run a single command using the ``local_batch`` client @@ -396,6 +397,10 @@ def local_batch(self, tgt, fun, arg=None, kwarg=None, tgt_type='glob', if tgt_type: low['tgt_type'] = tgt_type + if expr_form: + logger.warning('expr_form argument is deprecated in local function, please use tgt_type instead') + low['tgt_type'] = expr_form + if batch: low['batch'] = batch diff --git a/tests/integration/test_local.py b/tests/integration/test_local.py index 1db97c1..31d7538 100644 --- a/tests/integration/test_local.py +++ b/tests/integration/test_local.py @@ -6,10 +6,11 @@ def test_local(pepper_client, session_minion_id): def test_local_with_tgt_type(pepper_client, session_minion_id): - assert pepper_client.local('*', 'test.ping', tgt_type='list')['return'][0][session_minion_id] is False + assert session_minion_id not in pepper_client.local('*', 'test.ping', tgt_type='list')['return'][0] assert pepper_client.local(session_minion_id, 'test.ping', tgt_type='list')['return'][0][session_minion_id] is True def test_local_with_deprecated_expr_form(pepper_client, session_minion_id): - assert pepper_client.local('*', 'test.ping', expr_form='list')['return'][0][session_minion_id] is False - assert pepper_client.local(session_minion_id, 'test.ping', expr_form='list')['return'][0][session_minion_id] is True + assert session_minion_id not in pepper_client.local('*', 'test.ping', expr_form='list')['return'][0] + r = pepper_client.local(session_minion_id, 'test.ping', expr_form='list')['return'][0][session_minion_id] + assert r is True