{"action":"created","issue":{"url":"https://api.github.com/repos/saltstack/salt/issues/26191","labels_url":"https://api.github.com/repos/saltstack/salt/issues/26191/labels{/name}","comments_url":"https://api.github.com/repos/saltstack/salt/issues/26191/comments","events_url":"https://api.github.com/repos/saltstack/salt/issues/26191/events","html_url":"https://github.com/saltstack/salt/issues/26191","id":100176530,"number":26191,"title":"salt minion grains not working with compound ","user":{"login":"mimianddaniel","id":11415415,"avatar_url":"https://avatars.githubusercontent.com/u/11415415?v=3","gravatar_id":"","url":"https://api.github.com/users/mimianddaniel","html_url":"https://github.com/mimianddaniel","followers_url":"https://api.github.com/users/mimianddaniel/followers","following_url":"https://api.github.com/users/mimianddaniel/following{/other_user}","gists_url":"https://api.github.com/users/mimianddaniel/gists{/gist_id}","starred_url":"https://api.github.com/users/mimianddaniel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mimianddaniel/subscriptions","organizations_url":"https://api.github.com/users/mimianddaniel/orgs","repos_url":"https://api.github.com/users/mimianddaniel/repos","events_url":"https://api.github.com/users/mimianddaniel/events{/privacy}","received_events_url":"https://api.github.com/users/mimianddaniel/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/High%20Severity","name":"High Severity","color":"ff9143"},{"url":"https://api.github.com/repos/saltstack/salt/labels/P1","name":"P1","color":"2181ee"}],"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":2526,"closed_issues":2553,"state":"open","created_at":"2011-05-14T04:00:56Z","updated_at":"2015-09-08T17:09:47Z","due_on":null,"closed_at":null},"comments":4,"created_at":"2015-08-10T21:47:35Z","updated_at":"2015-09-08T17:18:09Z","closed_at":null,"body":"minions stopped responding to the grain matching with compount setting after restart :  \r\nSimple grain matching works, grains.items works.. but using -C, compound doesnt.  After restart of the minions it works fine then the following error, it stops working with the compound. \r\n\r\nWe have grains_cache enabled which seems to be the cause of this issue.  I will disable and see if that fixes the problem. \r\n```python-traceback\r\n[DEBUG   ] Exception while handling events\r\nTraceback (most recent call last):\r\n  File \"/opt/blue-python/2.7/lib/python2.7/site-packages/salt/minion.py\", line 1952, in _do_event_poll\r\n    self.handle_event(package)\r\n  File \"/opt/blue-python/2.7/lib/python2.7/site-packages/salt/minion.py\", line 1696, in handle_event\r\n    self.pillar_refresh(force_refresh=True)\r\n  File \"/opt/blue-python/2.7/lib/python2.7/site-packages/salt/minion.py\", line 1583, in pillar_refresh\r\n    self.module_refresh(force_refresh)\r\n  File \"/opt/blue-python/2.7/lib/python2.7/site-packages/salt/minion.py\", line 1564, in module_refresh\r\n    self.functions, self.returners, _ = self._load_modules(force_refresh)\r\n  File \"/opt/blue-python/2.7/lib/python2.7/site-packages/salt/minion.py\", line 951, in _load_modules\r\n    self.opts['grains'] = salt.loader.grains(self.opts, force_refresh)\r\n  File \"/opt/blue-python/2.7/lib/python2.7/site-packages/salt/loader.py\", line 545, in grains\r\n    with salt.utils.fopen(cfn, 'w+b') as fp_:\r\nUnboundLocalError: local variable 'cfn' referenced before assignment\r\n```\r\n2015.5.3 version. \r\n"},"comment":{"url":"https://api.github.com/repos/saltstack/salt/issues/comments/138638676","html_url":"https://github.com/saltstack/salt/issues/26191#issuecomment-138638676","issue_url":"https://api.github.com/repos/saltstack/salt/issues/26191","id":138638676,"user":{"login":"MrMarvin","id":100136,"avatar_url":"https://avatars.githubusercontent.com/u/100136?v=3","gravatar_id":"","url":"https://api.github.com/users/MrMarvin","html_url":"https://github.com/MrMarvin","followers_url":"https://api.github.com/users/MrMarvin/followers","following_url":"https://api.github.com/users/MrMarvin/following{/other_user}","gists_url":"https://api.github.com/users/MrMarvin/gists{/gist_id}","starred_url":"https://api.github.com/users/MrMarvin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MrMarvin/subscriptions","organizations_url":"https://api.github.com/users/MrMarvin/orgs","repos_url":"https://api.github.com/users/MrMarvin/repos","events_url":"https://api.github.com/users/MrMarvin/events{/privacy}","received_events_url":"https://api.github.com/users/MrMarvin/received_events","type":"User","site_admin":false},"created_at":"2015-09-08T17:18:09Z","updated_at":"2015-09-08T17:18:09Z","body":"A quick look at the code shows that for every call with `force_refresh` explicitly set, it will fail due to the unassigned `cfn` local variable. The following is the only ever assignment to it in this method.\r\n```\r\n    # if we hae no grains, lets try loading from disk (TODO: move to decorator?)\r\n    if not force_refresh:\r\n        if opts.get('grains_cache', False):\r\n            cfn = os.path.join(\r\n                opts['cachedir'],\r\n                'grains.cache.p'\r\n            )\r\n```\r\n"}}