-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Saltcheck salt-ssh support #52541
Saltcheck salt-ssh support #52541
Conversation
Tidy "salt://" handling by using url util Create saltcheck wrapper for use in salt-ssh. Handles cp.cache_dir functionality by creating a tarball, copying, and extracting on ssh minion. Then calls the regular saltcheck functions.
# client is hardcoded to local | ||
# If the minion is running with a master, a potentially non-local client is needed to lookup states | ||
local_opts = salt.config.minion_config(__opts__['conf_file']) | ||
if '_salt/running_data/var/run/salt-minion.pid' in __opts__.get('pidfile', False): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure what the best way is of detecting a salt-ssh session. Advice gladly accepted
trying out your updated version and comparing to my updates, I've found 2 things so far:
Imagine we have:
/srv/salt/my_forumla/init.sls:
/srv/salt/my_forumla/another.sls:
/srv/salt/my_formula/saltcheck-tests/init.tst
/srv/salt/my_formula/saltcheck-tests/another.tst
If I run saltcheck.run_state_tests my_formula, only the init.tst will be run (if there is some saltcheck way of doing an include and I'm just missing it, then forgive me for being daft and not understanding how to do that). Obviously, I could use the "check_all" flag (but then If I discover the states that make up "my_formula" (by generating the low data and examining it), then that data can be used to pull all the corresponding The alternative would be to get saltcheck to understand an "include" directive so We use a lot of "meta" states that dynamically pull in other states (via map data) based on the minion OS/version/etc -- so being able to have my The example above isn't dynamic in that it is a hardcoded |
For 1 I think we'll need some saltdevs to respond. I suspect that's a bug. For now it's simple enough to not use url.create and to just manage the pathing in the module. For 2 that does look like a massive improvement! How does your code handle the case of a .tst file itself having Jinja markup and including a map.jinja? I had an issue when trying to parse lowstate that when I pulled the .sls and .tst files, it did not also get included map.jinja files and so tests were not rendered properly. See the pillar example in the saltcheck docstring. |
The I'm doing things like the following in all my
The map/defaults are cached by the generation of the sls low data (since they are used by the state), but in this example, the "conversion_functions.jinja" gets cached when the |
Yep @lomeroe, your In the case of salt-ssh, it turns out to be more difficult. The basic problem is that an ssh minion is running I think the |
What does this PR do?
supersedes #52434
cp.cache_master
with logic tocp.cache_dir
on used salt states)Previous Behavior
cp.cache_*
from a salt-ssh minion, was not able to locate test files and did not function.assertion_section
of a single depthcp.cache_master
takes more time and I/O than necessaryNew Behavior
assertion_section
can now be nested dicts or listscp.cache_dir
on needed state directoriesTests written?
No
Commits signed with GPG?
No