saltstack/salt — pull request #9290 by jeroennijhof (2013-12-16 16:08:58+00:00)
Title: fix check_state_result

Running salt-call on the minion with the state.highstate command will return retcode 2 if you are using the pkg.installed function.
```
----------
State: - pkg
Name: apache2
Function: installed
Result: True
Comment: Package apache2 is already installed
Changes:
----------
State: - file
Name: /etc/apache2
Function: directory
Result: True
Comment: Directory /etc/apache2 is in the correct state
Changes:

Summary
------------
Succeeded: 2
Failed: 0
------------
Total: 2
root@chef-client:/usr/share/pyshared/salt/utils# echo $?
2
```
This is cause by the comparison in function check_state_result(): host.find('_|-') == 4. After debugging I was able to get the following output:
```
{'pkg_|-apache2_|-apache2_|-installed': {'comment': 'Package apache2 is already installed', '__run_num__': 0, 'changes': {}, 'name': 'apache2', 'result': True}
```
As you can see it is missing a host name but the value is still a dict and should return. So my suggestion is to match 3 or higher.