{"action":"closed","issue":{"url":"https://api.github.com/repos/saltstack/salt/issues/35226","repository_url":"https://api.github.com/repos/saltstack/salt","labels_url":"https://api.github.com/repos/saltstack/salt/issues/35226/labels{/name}","comments_url":"https://api.github.com/repos/saltstack/salt/issues/35226/comments","events_url":"https://api.github.com/repos/saltstack/salt/issues/35226/events","html_url":"https://github.com/saltstack/salt/issues/35226","id":169530865,"number":35226,"title":"Do not throw an exception when an invalid requisite is set","user":{"login":"mathieubouchard","id":2116756,"avatar_url":"https://avatars.githubusercontent.com/u/2116756?v=3","gravatar_id":"","url":"https://api.github.com/users/mathieubouchard","html_url":"https://github.com/mathieubouchard","followers_url":"https://api.github.com/users/mathieubouchard/followers","following_url":"https://api.github.com/users/mathieubouchard/following{/other_user}","gists_url":"https://api.github.com/users/mathieubouchard/gists{/gist_id}","starred_url":"https://api.github.com/users/mathieubouchard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mathieubouchard/subscriptions","organizations_url":"https://api.github.com/users/mathieubouchard/orgs","repos_url":"https://api.github.com/users/mathieubouchard/repos","events_url":"https://api.github.com/users/mathieubouchard/events{/privacy}","received_events_url":"https://api.github.com/users/mathieubouchard/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/saltstack/salt/labels/Bug","name":"Bug","color":"e11d21"},{"url":"https://api.github.com/repos/saltstack/salt/labels/Core","name":"Core","color":"fef2c0"},{"url":"https://api.github.com/repos/saltstack/salt/labels/Fixed%20Pending%20Verification","name":"Fixed Pending Verification","color":"d4c5f9"},{"url":"https://api.github.com/repos/saltstack/salt/labels/Medium%20Severity","name":"Medium Severity","color":"fad8c7"},{"url":"https://api.github.com/repos/saltstack/salt/labels/P4","name":"P4","color":"031a39"}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/saltstack/salt/milestones/13","html_url":"https://github.com/saltstack/salt/milestones/Approved","labels_url":"https://api.github.com/repos/saltstack/salt/milestones/13/labels","id":9265,"number":13,"title":"Approved","description":"All issues that are ready to be worked on, both bugs and features.","creator":{"login":"thatch45","id":507599,"avatar_url":"https://avatars.githubusercontent.com/u/507599?v=3","gravatar_id":"","url":"https://api.github.com/users/thatch45","html_url":"https://github.com/thatch45","followers_url":"https://api.github.com/users/thatch45/followers","following_url":"https://api.github.com/users/thatch45/following{/other_user}","gists_url":"https://api.github.com/users/thatch45/gists{/gist_id}","starred_url":"https://api.github.com/users/thatch45/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thatch45/subscriptions","organizations_url":"https://api.github.com/users/thatch45/orgs","repos_url":"https://api.github.com/users/thatch45/repos","events_url":"https://api.github.com/users/thatch45/events{/privacy}","received_events_url":"https://api.github.com/users/thatch45/received_events","type":"User","site_admin":false},"open_issues":3150,"closed_issues":3918,"state":"open","created_at":"2011-05-14T04:00:56Z","updated_at":"2016-08-15T08:59:29Z","due_on":null,"closed_at":null},"comments":2,"created_at":"2016-08-05T05:21:18Z","updated_at":"2016-08-15T08:59:29Z","closed_at":"2016-08-15T08:59:29Z","body":"### Description of Issue/Question\r\n\r\nWhen an invalid require tag is set, there are no safety check in the code and an exception will be raised instead of showing a nice explanation of what is going on. It makes it really difficult to diagnose what's wrong with the SLS file.\r\n\r\n### Setup\r\n\r\nExample SLS :\r\n```\r\n{% set pil = pillar['git'] %}\r\n\r\ngit:\r\n  pkg.installed:\r\n    - require:\r\n      - file: {{ pil }}\r\n```\r\n\r\nThe following exception will be raised :\r\n```\r\n    The minion function caused an exception: Traceback (most recent call last):\r\n      File \"/usr/lib/python2.6/site-packages/salt/minion.py\", line 1320, in _thread_return\r\n        return_data = executor.execute()\r\n      File \"/usr/lib/python2.6/site-packages/salt/executors/direct_call.py\", line 28, in execute\r\n        return self.func(*self.args, **self.kwargs)\r\n      File \"/usr/lib/python2.6/site-packages/salt/modules/state.py\", line 722, in highstate\r\n        whitelist=kwargs.get('whitelist')\r\n      File \"/usr/lib/python2.6/site-packages/salt/state.py\", line 3271, in call_highstate\r\n        os.umask(cumask)\r\n      File \"/usr/lib/python2.6/site-packages/salt/state.py\", line 2276, in call_high\r\n        return errors\r\n      File \"/usr/lib/python2.6/site-packages/salt/state.py\", line 1799, in call_chunks\r\n        running = self.call_chunk(low, running, chunks)\r\n      File \"/usr/lib/python2.6/site-packages/salt/state.py\", line 2066, in call_chunk\r\n        return running\r\n      File \"/usr/lib/python2.6/site-packages/salt/state.py\", line 1982, in call_chunk\r\n        requisites.append('prerequired')\r\n      File \"/usr/lib/python2.6/site-packages/salt/state.py\", line 1868, in check_requisite\r\n        if (fnmatch.fnmatch(chunk['name'], req_val) or\r\n      File \"/usr/lib64/python2.6/fnmatch.py\", line 43, in fnmatch\r\n        return fnmatchcase(name, pat)\r\n      File \"/usr/lib64/python2.6/fnmatch.py\", line 75, in fnmatchcase\r\n        res = translate(pat)\r\n      File \"/usr/lib64/python2.6/fnmatch.py\", line 90, in translate\r\n        c = pat[i]\r\n    KeyError: 0\r\n```\r\n\r\nThe line **1868** in **/usr/lib/python2.6/site-packages/salt/state.py** tries to compare two strings. In this case, a dictionary will be passed instead of a string. When the **fnmatch** method will try to match the values, it will access `req_val[0]`, which is not a valid key for the dictionary.\r\n\r\n### Steps to Reproduce Issue\r\n\r\nWrite an invalid SLS with a require on a dictionary.\r\n\r\n### Versions Report\r\nSalt Version:\r\n           Salt: 2016.3.2\r\n\r\nDependency Versions:\r\n           cffi: Not Installed\r\n       cherrypy: 3.2.2\r\n       dateutil: 1.4.1\r\n          gitdb: Not Installed\r\n      gitpython: Not Installed\r\n          ioflo: Not Installed\r\n         Jinja2: 2.2.1\r\n        libgit2: Not Installed\r\n        libnacl: Not Installed\r\n       M2Crypto: 0.20.2\r\n           Mako: Not Installed\r\n   msgpack-pure: Not Installed\r\n msgpack-python: 0.4.6\r\n   mysql-python: Not Installed\r\n      pycparser: Not Installed\r\n       pycrypto: 2.6.1\r\n         pygit2: Not Installed\r\n         Python: 2.6.6 (r266:84292, May 22 2015, 08:34:51)\r\n   python-gnupg: Not Installed\r\n         PyYAML: 3.10\r\n          PyZMQ: 14.5.0\r\n           RAET: Not Installed\r\n          smmap: Not Installed\r\n        timelib: Not Installed\r\n        Tornado: 4.2.1\r\n            ZMQ: 4.0.5\r\n\r\nSystem Versions:\r\n           dist: redhat 6.7 Santiago\r\n        machine: x86_64\r\n        release: 2.6.32-573.22.1.el6.x86_64\r\n         system: Linux\r\n        version: Red Hat Enterprise Linux Server 6.7 Santiago"}}
{"actor":{"display_login":"cachedout"}}