Repository navigation
Closed
Description
Description of Issue/Question
if a batch option is given and no minion matched in a orchestration.
An ' SaltClientError: No minions matched the target' exception will be raised
Setup
create test.sls in orchestration folder
test-state:
salt.state:
- tgt: 'role:not-exist'
- tgt_type: grain
- highstate: True
- batch: 1
Steps to Reproduce Issue
given a test.sls in a orchestration file and run
salt-run state.orch orchestration.test
if an item in a orchestration file with batch option, and not matching anything, it'll raise exception.
----------
ID: test-state
Function: salt.state
Result: False
Comment: An exception occurred in this state: Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/salt/state.py", line 1723, in call
**cdata['kwargs'])
File "/usr/lib/python2.7/dist-packages/salt/loader.py", line 1650, in wrapper
return f(*args, **kwargs)
File "/usr/lib/python2.7/dist-packages/salt/states/saltmod.py", line 230, in state
cmd_ret = __salt__['saltutil.cmd'](tgt, fun, **cmd_kw)
File "/usr/lib/python2.7/dist-packages/salt/modules/saltutil.py", line 959, in cmd
client, tgt, fun, arg, timeout, expr_form, ret, kwarg, **kwargs)
File "/usr/lib/python2.7/dist-packages/salt/modules/saltutil.py", line 927, in _exec
for ret_comp in _cmd(**cmd_kwargs):
File "/usr/lib/python2.7/dist-packages/salt/client/__init__.py", line 439, in cmd_batch
batch = salt.cli.batch.Batch(opts, quiet=True)
File "/usr/lib/python2.7/dist-packages/salt/cli/batch.py", line 35, in __init__
self.minions, self.ping_gen = self.__gather_minions()
File "/usr/lib/python2.7/dist-packages/salt/cli/batch.py", line 64, in __gather_minions
raise salt.exceptions.SaltClientError('No minions matched the target.')
SaltClientError: No minions matched the target.
Started: 07:44:19.694000
Duration: 36.931 ms
Changes:
if no batch option, it will return true even no matched minions.
Versions Report
Salt Version:
Salt: 2016.3.1
Dependency Versions:
cffi: Not Installed
cherrypy: Not Installed
dateutil: 1.5
gitdb: 0.5.4
gitpython: 0.3.2 RC1
ioflo: Not Installed
Jinja2: 2.7.2
libgit2: Not Installed
libnacl: Not Installed
M2Crypto: Not Installed
Mako: 0.9.1
msgpack-pure: Not Installed
msgpack-python: 0.3.0
mysql-python: 1.2.3
pycparser: Not Installed
pycrypto: 2.6.1
pygit2: Not Installed
Python: 2.7.6 (default, Jun 22 2015, 17:58:13)
python-gnupg: Not Installed
PyYAML: 3.10
PyZMQ: 14.0.1
RAET: Not Installed
smmap: 0.8.2
timelib: Not Installed
Tornado: 4.2.1
ZMQ: 4.0.5
System Versions:
dist: Ubuntu 14.04 trusty
machine: x86_64
release: 3.13.0-48-generic
system: Linux
version: Ubuntu 14.04 trusty
Activity
Ch3LL commentedon Jul 26, 2016
@beelit94 looks like i am able to replicate this behavior. We should be displaying a more useful error in the state output rather then stack trace. Thanks
beelit94 commentedon Jul 28, 2016
@Ch3LL I would say the problem here is the result of test-state in this case should be True, not the error msg.
stale commentedon Jun 8, 2018
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
If this issue is closed prematurely, please leave a comment and we will gladly reopen the issue.