Skip to content
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

List of states that support check_cmd? #19788

Closed
lorengordon opened this issue Jan 16, 2015 · 9 comments
Closed

List of states that support check_cmd? #19788

lorengordon opened this issue Jan 16, 2015 · 9 comments
Labels
Bug broken, incorrect, or confusing behavior P3 Priority 3 Platform Relates to OS, containers, platform-based utilities like FS, system based apps severity-medium 3rd level, incorrect or bad functionality, confusing and lacks a work around stale State-Module
Milestone

Comments

@lorengordon
Copy link
Contributor

Is there a list of states that support check_cmd? I was attempting to use it with cmd.run but the option appeared to be ignored. I checked the source for 2014.7 and develop, and check_cmd isn't present. The example in the documentation uses file.managed, so I looked at that as well and the check_cmd code was easy enough to spot.

@lorengordon
Copy link
Contributor Author

Ok, I no longer need this as I opened my eyes and realized I could write the cmd.run statement to perform the check itself and set an exit code that would force the state to succeed or fail.

But it still would be nice to have the list. I'm also not sure the documentation is correct. I looked again and it references file.replace but in the source the only function that accepts check_cmd is file.managed.

@jfindlay
Copy link
Contributor

From what I understand of the code, check_cmd should be available to any state. If it doesn't work, then what you've encountered might be a bug.

@jfindlay jfindlay added Bug broken, incorrect, or confusing behavior severity-low 4th level, cosemtic problems, work around exists labels Jan 20, 2015
@jfindlay jfindlay added this to the Under Review milestone Jan 20, 2015
@jfindlay jfindlay self-assigned this Jan 20, 2015
@lorengordon
Copy link
Contributor Author

Ok, let me know if you need more information. Like I said, I moved passed it, but I can try to recreate what I was trying.

@jfindlay
Copy link
Contributor

Thanks, @lorengordon.

@jfindlay
Copy link
Contributor

@lorengordon, if you have further problems with this, please comment here and I'll reopen the issue.

@ghost
Copy link

ghost commented Aug 19, 2016

Hi @jfindlay,

I am seeing a similar issue with the file state module, where the check_cmd appears not to be working.
I am running salt 2015.8.8 (Beryllium) on Ubuntu 16.04.1 LTS.

In this Gist, I have a state file, that should fail at every stage, because the check_cmd directive is contrary to the change made.
I have also included the debug output of calling salt-call --local -l debug state.sls test.file 2>&1 | less. This indicates the check_cmd is not being processed at all.

I have successfully tested the check_cmd with the pkg state module.

Cheers,
Neil

@jfindlay jfindlay removed their assignment Aug 19, 2016
@jfindlay jfindlay modified the milestones: Approved, Under Review Aug 19, 2016
@jfindlay jfindlay added State-Module severity-medium 3rd level, incorrect or bad functionality, confusing and lacks a work around P3 Priority 3 Platform Relates to OS, containers, platform-based utilities like FS, system based apps and removed severity-low 4th level, cosemtic problems, work around exists labels Aug 19, 2016
@jfindlay jfindlay reopened this Aug 19, 2016
@miromode
Copy link
Contributor

Also experiencing this problem with salt-call 2016.3.3 (Boron). I have a file.exists in an SLS with a check_cmd and the check command does not appear to run at all.

@gtmanfred
Copy link
Contributor

gtmanfred commented Nov 15, 2017

Does this work for file.managed?

Because if so, then this is working as expected, and the existance of the mod_run_check_cmd is keeping the global check_cmd from being run, instead it needs to be specified in the state.

Only state modules in salt.states.git salt.states.file and salt.states.cmd, which implement calls to their mod_run_check_cmd functions will get the check_cmd capability.

https://github.com/saltstack/salt/blob/2017.7/salt/states/file.py#L2446

Edit: looks like it works correctly for file.managed

@stale
Copy link

stale bot commented Mar 10, 2019

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.

@stale stale bot added the stale label Mar 10, 2019
@stale stale bot closed this as completed Mar 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug broken, incorrect, or confusing behavior P3 Priority 3 Platform Relates to OS, containers, platform-based utilities like FS, system based apps severity-medium 3rd level, incorrect or bad functionality, confusing and lacks a work around stale State-Module
Projects
None yet
Development

No branches or pull requests

4 participants