{"action":"created","issue":{"url":"https://api.github.com/repos/saltstack/salt/issues/27016","labels_url":"https://api.github.com/repos/saltstack/salt/issues/27016/labels{/name}","comments_url":"https://api.github.com/repos/saltstack/salt/issues/27016/comments","events_url":"https://api.github.com/repos/saltstack/salt/issues/27016/events","html_url":"https://github.com/saltstack/salt/issues/27016","id":105841161,"number":27016,"title":"KeyError: 'rabbitmq_plugin.enabled' while trying to install rabbitmq & setup a plugin at one single pass","user":{"login":"pruiz","id":191225,"avatar_url":"https://avatars.githubusercontent.com/u/191225?v=3","gravatar_id":"","url":"https://api.github.com/users/pruiz","html_url":"https://github.com/pruiz","followers_url":"https://api.github.com/users/pruiz/followers","following_url":"https://api.github.com/users/pruiz/following{/other_user}","gists_url":"https://api.github.com/users/pruiz/gists{/gist_id}","starred_url":"https://api.github.com/users/pruiz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pruiz/subscriptions","organizations_url":"https://api.github.com/users/pruiz/orgs","repos_url":"https://api.github.com/users/pruiz/repos","events_url":"https://api.github.com/users/pruiz/events{/privacy}","received_events_url":"https://api.github.com/users/pruiz/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/High%20Severity","name":"High Severity","color":"ff9143"},{"url":"https://api.github.com/repos/saltstack/salt/labels/P2","name":"P2","color":"155fb5"},{"url":"https://api.github.com/repos/saltstack/salt/labels/Platform","name":"Platform","color":"fef2c0"},{"url":"https://api.github.com/repos/saltstack/salt/labels/State%20Module","name":"State Module","color":"006b75"}],"state":"open","locked":false,"assignee":null,"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":2585,"closed_issues":2640,"state":"open","created_at":"2011-05-14T04:00:56Z","updated_at":"2015-09-29T15:49:46Z","due_on":null,"closed_at":null},"comments":8,"created_at":"2015-09-10T16:01:38Z","updated_at":"2015-09-29T16:08:23Z","closed_at":null,"body":"Hi,\r\n\r\nIt looks like trying to install rabbitmq and then setting up some plugin/user/vhost/etc. against it inside the same highstate pass will fail miserably, even if 'reload_modules: True' is used.\r\n\r\nThis is a sample 'sample.sls' file which reproduces the issue using salt 2015.05.03 on CentOS-6.x.\r\n\r\n```yaml\r\nrabbitmq_plugin_rabbitmq_management:\r\n  rabbitmq_plugin:\r\n    - name: rabbitmq_management\r\n    - enabled\r\n    - runas: root\r\n    - require:\r\n      - pkg: rabbitmq-server\r\n      - file: rabbitmq-env-link\r\n      - file: rabbitmq-plugins-link\r\n      - service: rabbitmq-server\r\n\r\nrabbitmq-server:\r\n  pkg:\r\n    - latest\r\n    - reload_modules: True\r\n  service:\r\n    - running\r\n    - enable: True\r\n    - require:\r\n      - pkg: rabbitmq-server\r\n    - watch:\r\n      - pkg: rabbitmq-server\r\n\r\nrabbitmq-env-link:\r\n  file.symlink:\r\n    - name: /usr/local/bin/rabbitmq-env\r\n    - target: /usr/lib/rabbitmq/bin/rabbitmq-env\r\n    - require:\r\n      - pkg: rabbitmq-server\r\n\r\nrabbitmq-plugins-link:\r\n  file.symlink:\r\n    - name: /usr/local/bin/rabbitmq-plugins\r\n    - target: /usr/lib/rabbitmq/bin/rabbitmq-plugins\r\n    - require:\r\n      - pkg: rabbitmq-server\r\n      - file: rabbitmq-env-link\r\n```\r\n\r\nRunning this sls file using \"salt-call -l debug state.template sample.sls\" against a server _not_ having rabbitmq-server installed, throws the following output/error:\r\n\r\n```\r\n[DEBUG   ] Could not LazyLoad rabbitmq_plugin.enabled\r\n[ERROR   ] An un-handled exception was caught by salt's global exception handler:\r\nKeyError: 'rabbitmq_plugin.enabled'\r\nTraceback (most recent call last):\r\n  File \"/usr/bin/salt-call\", line 11, in <module>\r\n    salt_call()\r\n  File \"/usr/lib/python2.6/site-packages/salt/scripts.py\", line 227, in salt_call\r\n    client.run()\r\n  File \"/usr/lib/python2.6/site-packages/salt/cli/call.py\", line 69, in run\r\n    caller.run()\r\n  File \"/usr/lib/python2.6/site-packages/salt/cli/caller.py\", line 236, in run\r\n    ret = self.call()\r\n  File \"/usr/lib/python2.6/site-packages/salt/cli/caller.py\", line 138, in call\r\n    ret['return'] = func(*args, **kwargs)\r\n  File \"/usr/lib/python2.6/site-packages/salt/modules/state.py\", line 254, in template\r\n    ret = st_.state.call_high(high_state)\r\n  File \"/usr/lib/python2.6/site-packages/salt/state.py\", line 2067, in call_high\r\n    ret = dict(list(disabled.items()) + list(self.call_chunks(chunks).items()))\r\n  File \"/usr/lib/python2.6/site-packages/salt/state.py\", line 1623, 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 1769, in call_chunk\r\n    self._mod_init(low)\r\n  File \"/usr/lib/python2.6/site-packages/salt/state.py\", line 612, in _mod_init\r\n    self.states['{0}.{1}'.format(low['state'], low['fun'])]  # pylint: disable=W0106\r\n  File \"/usr/lib/python2.6/site-packages/salt/utils/lazy.py\", line 90, in __getitem__\r\n    raise KeyError(key)\r\nKeyError: 'rabbitmq_plugin.enabled'\r\nTraceback (most recent call last):\r\n  File \"/usr/bin/salt-call\", line 11, in <module>\r\n    salt_call()\r\n  File \"/usr/lib/python2.6/site-packages/salt/scripts.py\", line 227, in salt_call\r\n    client.run()\r\n  File \"/usr/lib/python2.6/site-packages/salt/cli/call.py\", line 69, in run\r\n    caller.run()\r\n  File \"/usr/lib/python2.6/site-packages/salt/cli/caller.py\", line 236, in run\r\n    ret = self.call()\r\n  File \"/usr/lib/python2.6/site-packages/salt/cli/caller.py\", line 138, in call\r\n    ret['return'] = func(*args, **kwargs)\r\n  File \"/usr/lib/python2.6/site-packages/salt/modules/state.py\", line 254, in template\r\n    ret = st_.state.call_high(high_state)\r\n  File \"/usr/lib/python2.6/site-packages/salt/state.py\", line 2067, in call_high\r\n    ret = dict(list(disabled.items()) + list(self.call_chunks(chunks).items()))\r\n  File \"/usr/lib/python2.6/site-packages/salt/state.py\", line 1623, 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 1769, in call_chunk\r\n    self._mod_init(low)\r\n  File \"/usr/lib/python2.6/site-packages/salt/state.py\", line 612, in _mod_init\r\n    self.states['{0}.{1}'.format(low['state'], low['fun'])]  # pylint: disable=W0106\r\n  File \"/usr/lib/python2.6/site-packages/salt/utils/lazy.py\", line 90, in __getitem__\r\n    raise KeyError(key)\r\nKeyError: 'rabbitmq_plugin.enabled'\r\n```\r\n\r\nHowever, moving state 'rabbitmq_plugin_rabbitmq_management' to the end of sample.sls, worksaround the issue.. Something weird, as requirements should (IMHO) produce always the same resulting states ordering.\r\n\r\nHere are the details from running environment:\r\n\r\n```\r\n[root@herma-test-01 ~]# cat /etc/redhat-release\r\nCentOS release 6.3 (Final)\r\n\r\n[root@herma-test-01 ~]# salt-call --versions-report\r\n           Salt: 2015.5.3\r\n         Python: 2.6.6 (r266:84292, Jul 23 2015, 15:22:56)\r\n         Jinja2: 2.2.1\r\n       M2Crypto: 0.20.2\r\n msgpack-python: 0.4.6\r\n   msgpack-pure: Not Installed\r\n       pycrypto: 2.0.1\r\n        libnacl: Not Installed\r\n         PyYAML: 3.10\r\n          ioflo: Not Installed\r\n          PyZMQ: 14.5.0\r\n           RAET: Not Installed\r\n            ZMQ: 4.0.5\r\n           Mako: Not Installed\r\n        Tornado: Not Installed\r\n```\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/saltstack/salt/issues/comments/144106157","html_url":"https://github.com/saltstack/salt/issues/27016#issuecomment-144106157","issue_url":"https://api.github.com/repos/saltstack/salt/issues/27016","id":144106157,"user":{"login":"jfindlay","id":702905,"avatar_url":"https://avatars.githubusercontent.com/u/702905?v=3","gravatar_id":"","url":"https://api.github.com/users/jfindlay","html_url":"https://github.com/jfindlay","followers_url":"https://api.github.com/users/jfindlay/followers","following_url":"https://api.github.com/users/jfindlay/following{/other_user}","gists_url":"https://api.github.com/users/jfindlay/gists{/gist_id}","starred_url":"https://api.github.com/users/jfindlay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jfindlay/subscriptions","organizations_url":"https://api.github.com/users/jfindlay/orgs","repos_url":"https://api.github.com/users/jfindlay/repos","events_url":"https://api.github.com/users/jfindlay/events{/privacy}","received_events_url":"https://api.github.com/users/jfindlay/received_events","type":"User","site_admin":false},"created_at":"2015-09-29T16:08:23Z","updated_at":"2015-09-29T16:08:23Z","body":"This may be similar to (part of) #26115."}}