pytest-testinfra icon indicating copy to clipboard operation
pytest-testinfra copied to clipboard

Salt host matching issue

Open jynolen opened this issue 6 years ago • 2 comments

Running:

>>> d= get_host("salt://*")
>>> d.salt("pkg.version", "python-34")

Produced

RuntimeError: Error while running pkg.version(['python34']): {'minion-salt-689012b2ca3ff805df1d0cff218e18d2d372db887d1158dfd6dec934b9658cf7': '3.4.9-1.el7', 'master-salt-689012b2ca3ff805df1d0cff218e18d2d372db887d1158dfd6dec934b9658cf7': '3.4.9-1.el7'}. Minion not connected ?

jynolen avatar Jan 22 '19 15:01 jynolen

Hi, thanks for the PR but you're not supposed to use get_host() in this case but rather get_hosts() which return a list of testinfra host objects on which you can call modules.

However the actual behavior need a specific error message I think.

EDIT: But your usage looks interesting "run commands on minions in a single salt call". I wonder how we could introduce this, your solution works for salt module but will not work for all other modules.

philpep avatar Jan 28 '19 02:01 philpep

What do you think about this PR should we close it ?

jynolen avatar Feb 03 '19 22:02 jynolen