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

require_in overrides excludes #6237

Closed
josmardias opened this issue Jul 19, 2013 · 19 comments
Closed

require_in overrides excludes #6237

josmardias opened this issue Jul 19, 2013 · 19 comments
Labels
Bug broken, incorrect, or confusing behavior Confirmed Salt engineer has confirmed bug/feature - often including a MCVE Core relates to code central or existential to Salt severity-low 4th level, cosemtic problems, work around exists
Milestone

Comments

@josmardias
Copy link
Contributor

I'm using Fedora 19

$ salt --versions-report
           Salt: 0.15.3
         Python: 2.7.5 (default, Jul  8 2013, 09:48:59)
         Jinja2: 2.6
       M2Crypto: 0.21.1
 msgpack-python: 0.1.13
   msgpack-pure: Not Installed
       pycrypto: 2.6
         PyYAML: 3.10
          PyZMQ: 13.0.0
            ZMQ: 3.2.3

State:

test1:
  file.managed:
    - name: /tmp/nothing

test2:
  file.managed:
    - name: /tmp/nothing2
    - require:
      - file: test1

exclude:
  - id: test1

Output

$ sudo salt-call state.highstate
[INFO    ] Configuration file path: /etc/salt/minion
[INFO    ] Executing command 'ps -efH' in directory '/root'
[INFO    ] Loading fresh modules for state activity
[INFO    ] Fetching file 'salt://top.sls'
[INFO    ] Creating module dir '/var/cache/salt/minion/extmods/modules'
[INFO    ] Syncing modules for environment 'base'
[INFO    ] Loading cache from salt://_modules, for base)
[INFO    ] Caching directory '_modules/' for environment 'base'
[INFO    ] Creating module dir '/var/cache/salt/minion/extmods/states'
[INFO    ] Syncing states for environment 'base'
[INFO    ] Loading cache from salt://_states, for base)
[INFO    ] Caching directory '_states/' for environment 'base'
[INFO    ] Creating module dir '/var/cache/salt/minion/extmods/grains'
[INFO    ] Syncing grains for environment 'base'
[INFO    ] Loading cache from salt://_grains, for base)
[INFO    ] Caching directory '_grains/' for environment 'base'
[INFO    ] Creating module dir '/var/cache/salt/minion/extmods/renderers'
[INFO    ] Syncing renderers for environment 'base'
[INFO    ] Loading cache from salt://_renderers, for base)
[INFO    ] Caching directory '_renderers/' for environment 'base'
[INFO    ] Creating module dir '/var/cache/salt/minion/extmods/returners'
[INFO    ] Syncing returners for environment 'base'
[INFO    ] Loading cache from salt://_returners, for base)
[INFO    ] Caching directory '_returners/' for environment 'base'
[INFO    ] Creating module dir '/var/cache/salt/minion/extmods/outputters'
[INFO    ] Syncing outputters for environment 'base'
[INFO    ] Loading cache from salt://_outputters, for base)
[INFO    ] Caching directory '_outputters/' for environment 'base'
[INFO    ] Loading fresh modules for state activity
[INFO    ] Fetching file 'salt://test.sls'
local:
----------
    State: - file
    Name:      /tmp/nothing2
    Function:  managed
        Result:    False
        Comment:   The following requisites were not found:
                   require: {'file': 'test1'}

        Changes:    
@thatch45
Copy link
Contributor

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.

@josmardias
Copy link
Contributor Author

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.

@jhenry82
Copy link

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.

@basepi
Copy link
Contributor

basepi commented Oct 18, 2013

Thanks for pointing this out, @jhenry82. I'm guessing that it's just an edge case that was not considered when we implemented exclude.

@basepi basepi modified the milestones: Approved, Outstanding Bugs Apr 21, 2014
@rallytime rallytime added severity-medium 3rd level, incorrect or bad functionality, confusing and lacks a work around Core relates to code central or existential to Salt P4 Priority 4 and removed Low Severity labels Aug 25, 2015
@elx-will
Copy link

elx-will commented Oct 6, 2016

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

@thatch45 thatch45 added severity-low 4th level, cosemtic problems, work around exists and removed severity-medium 3rd level, incorrect or bad functionality, confusing and lacks a work around labels Oct 6, 2016
@thatch45
Copy link
Contributor

thatch45 commented Oct 6, 2016

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.....

@elx-will
Copy link

elx-will commented Oct 6, 2016

What would be the recommended workaround?

@thatch45
Copy link
Contributor

thatch45 commented Oct 6, 2016

I would say to make a state that does not include the intended exclusion in the first place.

@disaster123
Copy link

+1 for a fix. Still don't understand how to work around this. I've the same issue like @jhenry82

@stale
Copy link

stale bot commented Sep 16, 2018

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 Sep 16, 2018
@disaster123
Copy link

this issue is still valid

@stale
Copy link

stale bot commented Sep 17, 2018

Thank you for updating this issue. It is no longer marked as stale.

@stale stale bot removed the stale label Sep 17, 2018
@waynew waynew changed the title exclude leads to "requisites were not found" require_in Dec 6, 2019
@waynew waynew changed the title require_in require_in overrides excludes Dec 6, 2019
@waynew
Copy link
Contributor

waynew commented Dec 6, 2019

@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.

@frogunder frogunder removed the P4 Priority 4 label Dec 19, 2019
@stale
Copy link

stale bot commented Jan 19, 2020

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 Jan 19, 2020
@disaster123
Copy link

Still valid

@stale
Copy link

stale bot commented Jan 19, 2020

Thank you for updating this issue. It is no longer marked as stale.

@stale stale bot removed the stale label Jan 19, 2020
@sagetherage
Copy link
Contributor

@waynew is there a PR or another ticket for changing requistes/excludes?

@waynew waynew added the Confirmed Salt engineer has confirmed bug/feature - often including a MCVE label Feb 28, 2020
@waynew
Copy link
Contributor

waynew commented Feb 28, 2020

@sagetherage this is the ticket for the buggy behavior and #55550 is the ticket to enhance the documentation/error messaging.

@waynew waynew removed their assignment Feb 28, 2020
digitalkram added a commit to ssc-services/uai-builder that referenced this issue Jun 16, 2021
@dwoz
Copy link
Contributor

dwoz commented Aug 30, 2023

@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.

@dwoz dwoz closed this as completed Aug 30, 2023
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 Confirmed Salt engineer has confirmed bug/feature - often including a MCVE Core relates to code central or existential to Salt severity-low 4th level, cosemtic problems, work around exists
Projects
None yet
Development

No branches or pull requests