Closed josmardias closed 1 year ago
Yes, exclude will remove the item that is being excluded making it impossible to find, you have created a state, then told salt to remove it, resulting it is not being available to be required. Exclude does not rip out requisites.
And it should not ript out? At least with me, i'm using it to "patch" some machines. For example, in production i want to a worker machine to have mongos installed, but in development i will not use mongos, so i'm doing something like this:
base:
'roles:worker':
- match: grain
- php
- mongodb.mongos
'roles:nomongos':
- match: grain
- mongodb.nomongos
and my nomongos.sls
exclude:
- sls: mongodb.mongos
In production my minion is someting like this:
grains:
project: rockpigeon
roles:
- worker
In devel, my minion is like this:
grains:
project: rockpigeon
roles:
- worker
- nomongos
I'm doing this, cause worker with mongos is the default behavior, and i get problems before in separate them, in other words, forcing the minion to use a "mongos" grain.
CentOS 6.4 64-bit
Salt: 0.16.3
Python: 2.6.6 (r266:84292, Jun 18 2012, 14:18:47)
Jinja2: 2.2.1
M2Crypto: 0.20.2
msgpack-python: 0.1.9.final
msgpack-pure: Not Installed
pycrypto: 2.0.1
PyYAML: 3.10
PyZMQ: 13.0.2
ZMQ: 3.2.3
I too am experiencing what I perceive as a bug in exclude with requisites, but a little different. Note the require_in clause instead of require.
test1:
file.managed:
- name: /tmp/nothing
- require_in:
- file: /tmp/nothing2
test2:
file.managed:
- name: /tmp/nothing2
exclude:
- id: test1
When I run a highstate I get an error like this:
----------
State: - file
Name: /tmp/nothing2
Function: managed
Result: False
Comment: The following requisites were not found:
require:
file: /tmp/nothing
Changes:
I believe that excluding the test1 SLS should exclude everything that SLS does, including the require_in. But it seems like the require_in is added to /tmp/nothing2 before the test1 SLS is ripped out, causing a failure.
Thanks for pointing this out, @jhenry82. I'm guessing that it's just an edge case that was not considered when we implemented exclude.
Was this bug ever fixed? I'm experiencing it now with the below salt --versions-report:
gesadmin@ny5kmduatinit01:~ $ salt --versions-report Salt Version: Salt: 2015.8.8.2
Dependency Versions: Jinja2: 2.8 M2Crypto: Not Installed Mako: Not Installed PyYAML: 3.10 PyZMQ: 14.3.1 Python: 2.7.5 (default, Nov 20 2015, 02:00:19) RAET: Not Installed Tornado: 4.2.1 ZMQ: 3.2.5 cffi: Not Installed cherrypy: Not Installed dateutil: 2.5.3 gitdb: Not Installed gitpython: Not Installed ioflo: Not Installed libgit2: Not Installed libnacl: Not Installed msgpack-pure: Not Installed msgpack-python: 0.4.8 mysql-python: 1.2.3 pycparser: Not Installed pycrypto: 2.6.1 pygit2: Not Installed python-gnupg: Not Installed smmap: Not Installed timelib: 0.2.4
System Versions: dist: centos 7.2.1511 Core machine: x86_64 release: 3.10.0-327.el7.x86_64 system: CentOS Linux 7.2.1511 Core
This has not been fixed and I am leaning towards not fixing it. I worry that having an exclude do this may result in unwanted side effects.....
What would be the recommended workaround?
I would say to make a state that does not include the intended exclusion in the first place.
+1 for a fix. Still don't understand how to work around this. I've the same issue like @jhenry82
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.
this issue is still valid
Thank you for updating this issue. It is no longer marked as stale.
@josmardias your original issue is expected behavior, though the documentation isn't very clear. I've opened #55550 to track updating the docs/error message.
@jhenry82 this is a proper bug - if an exclude remove a state that has require_in
then we should go ahead and just and remove the requisite, too.
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.
Still valid
Thank you for updating this issue. It is no longer marked as stale.
@waynew is there a PR or another ticket for changing requistes/excludes?
@sagetherage this is the ticket for the buggy behavior and #55550 is the ticket to enhance the documentation/error messaging.
@josmardias @disaster123 This issue is very old and has never gotten much traction. If this is still a priority for you please open a new issue against one of the currently supported versions.
I'm using Fedora 19
State:
Output