saltstack/salt — pull request #16868 by hvnsweeting (2014-10-24 08:22:32+00:00)
Title: fix state.py requisite sls problem, fix #12480

3 & 4 commits fix #12480

The first and second commits fix things that I think they are bugs:

1. According to https://salt.readthedocs.org/en/latest/ref/states/highstate.html#requisite-reference , requisite must matching stateID, not state's name, because name is not unique. Counter example:

````
ls etc/passwd:
cmd:
- run

barid:
cmd:
- run
- name: echo bar
- require:
- cmd: ls /etc/passwd

another_state:
cmd:
- run
- name: ls /etc/passwd
- require:
- cmd: barid
============
local:
----------
ID: ls etc/passwd
Function: cmd.run
Result: True
Comment: Command "ls etc/passwd" run
Changes:
----------
pid:
2255
retcode:
0
stderr:

stdout:
etc/passwd
----------
ID: another_state
Function: cmd.run
Name: ls /etc/passwd
Result: False
Comment: Recursive requisite found
Changes:
----------
ID: barid
Function: cmd.run
Name: echo bar
Result: False
Comment: One or more requisite failed
Changes:
````

2. Only compare string, not matching shell pattern. I don't know why fnmatch is used in many place. Do salt want to support require multiple stateIDs by just ``require: - file: /etc/*`` ?
Counter example:

````

test_ls:
cmd:
- run
- name: ls /etc/passwd
- require:
- file: /tmp/test*

/tmp/test_zero:
file:
- managed

/tmp/test_one:
file:
- managed
- require:
- cmd: test_ls
====

local:
----------
ID: /tmp/test_zero
Function: file.managed
Result: True
Comment: File /tmp/test_zero is in the correct state
Changes:
----------
ID: /tmp/test_one
Function: file.managed
Result: False
Comment: Recursive requisite found
Changes:
----------
ID: test_ls
Function: cmd.run
Name: ls /etc/passwd
Result: False
Comment: One or more requisite failed
Changes:

Summary
------------
Succeeded: 1
Failed: 2
------------
Total: 3

````