-
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
watch_in does not match on the name parameter as documented #9061
Comments
Thanks for the report. As far as I know, your first example should definitely be working. Additionally, it definitely looks to me like we should not be silently failing on |
Can you please post your version info? |
|
FWIW, I'm seeing this exact same issue. $ salt --versions-report |
I'm able to reproduce this, and not just on watch_in, but require_in as well. All |
Under the hood, all '_in' requisites are changed to extends of their corresponding type. For example, a require_in for a given state extends the target of the require_in with a 'require' requisite, pointing back at the state where the require_in was located. When these extends are reconciled, only the ID declarations are examined to see if there is a state matching the requisite's target, meaning that these '_in' requisites cannot point to a 'name' override in the same way as their counterparts are able to. For more info, see saltstack#9061. This commit modifies the extend reconciliation behavior. If there is no ID declaration matching the requisite's target, then salt.state.find_name() is used to search the high data for an ID declaration with a 'name' param matching the requisite target. If a match is found, then the extend is reconciled against that matching ID. If no match is found, then the requisite is not found the appropriate error is returned.
Under the hood, all '_in' requisites are changed to extends of their corresponding type. For example, a require_in for a given state extends the target of the require_in with a 'require' requisite, pointing back at the state where the require_in was located. When these extends are reconciled, only the ID declarations are examined to see if there is a state matching the requisite's target, meaning that these '_in' requisites cannot point to a 'name' override in the same way as their counterparts are able to. For more info, see #9061. This commit modifies the extend reconciliation behavior. If there is no ID declaration matching the requisite's target, then salt.state.find_name() is used to search the high data for an ID declaration with a 'name' param matching the requisite target. If a match is found, then the extend is reconciled against that matching ID. If no match is found, then the requisite is not found the appropriate error is returned.
With this in
nginx/init.sls
:... and this in
webapp/deploy.sls
:... an error is raised:
But if I change the
nginx
declaration to have that exact ID:then it works. This is inconsistent with Requisites documentation which states “Requisites match on both the ID Declaration and the name parameter.” The requisite is not matching on the name parameter.
Worse (because it was harder to troubleshoot), the
watch_in
onservice: nginx
did not raise an error when I had that originalnginx-systemwide
state declaration and this other one:where, you guessed it, one of the users was named
nginx
. Of course thisnginx
didn't have anyservice
state, sowatch_in
onservice: nginx
should have raised a clear error, something like “Can't applywatch_in
toservice: nginx
becausenginx
has noservice
state”. But it didn't raise any error; it just silently failed to reload my nginx service when changing the file.The text was updated successfully, but these errors were encountered: