{"action":"opened","issue":{"url":"https://api.github.com/repos/saltstack/salt/issues/27956","labels_url":"https://api.github.com/repos/saltstack/salt/issues/27956/labels{/name}","comments_url":"https://api.github.com/repos/saltstack/salt/issues/27956/comments","events_url":"https://api.github.com/repos/saltstack/salt/issues/27956/events","html_url":"https://github.com/saltstack/salt/issues/27956","id":111485584,"number":27956,"title":"Salt-cloud 2015.8 borks out with global name '__opts__' is not defined  ","user":{"login":"The-Loeki","id":426731,"avatar_url":"https://avatars.githubusercontent.com/u/426731?v=3","gravatar_id":"","url":"https://api.github.com/users/The-Loeki","html_url":"https://github.com/The-Loeki","followers_url":"https://api.github.com/users/The-Loeki/followers","following_url":"https://api.github.com/users/The-Loeki/following{/other_user}","gists_url":"https://api.github.com/users/The-Loeki/gists{/gist_id}","starred_url":"https://api.github.com/users/The-Loeki/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/The-Loeki/subscriptions","organizations_url":"https://api.github.com/users/The-Loeki/orgs","repos_url":"https://api.github.com/users/The-Loeki/repos","events_url":"https://api.github.com/users/The-Loeki/events{/privacy}","received_events_url":"https://api.github.com/users/The-Loeki/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-10-14T20:29:19Z","updated_at":"2015-10-14T20:29:19Z","closed_at":null,"body":"Using the `cloudstack` driver to create a single minion, the VM gets created & starts responding, but then `salt-cloud` borks out:\r\n\r\n```\r\n[DEBUG   ] Sending event - data = {'host': u'<an ip>', 'name': 'dodacloud3', '_stamp': '2015-10-14T20:07:49.710208', 'event': 'dodacloud3 has been deployed at <an ip>'}\r\n[INFO    ] Salt installed on dodacloud3\r\n[INFO    ] Created Cloud VM 'dodacloud3'\r\n[DEBUG   ] 'dodacloud3' VM creation details:\r\n[DEBUG   ] Sending event - data = {'profile': 'dodacloud-profile', 'event': 'created instance', '_stamp': '2015-10-14T20:07:49.792801', 'name': 'dodacloud3', 'provider': 'aurora-ams:cloudstack'}\r\n[ERROR   ] There was a profile error: global name '__opts__' is not defined\r\nTraceback (most recent call last):\r\n  File \"/usr/lib/python2.7/site-packages/salt/cloud/cli.py\", line 276, in run\r\n    self.config.get('names')\r\n  File \"/usr/lib/python2.7/site-packages/salt/cloud/__init__.py\", line 1403, in run_profile\r\n    ret[name] = self.create(vm_)\r\n  File \"/usr/lib/python2.7/site-packages/salt/cloud/__init__.py\", line 1260, in create\r\n    conf_path = '/'.join(__opts__['conf_file'].split('/')[:-1])\r\nNameError: global name '__opts__' is not defined\r\n```\r\n\r\nThat line reads:\r\n```python\r\n                # a small pause makes the sync work reliably\r\n                time.sleep(3)\r\n\r\n                mopts_ = salt.config.DEFAULT_MINION_OPTS\r\n                conf_path = '/'.join(__opts__['conf_file'].split('/')[:-1])\r\n                mopts_.update(\r\n                    salt.config.minion_config(\r\n                        os.path.join(conf_path,\r\n                                     'minion')\r\n                    )\r\n                )\r\n\r\n                client = salt.client.get_local_client(mopts=mopts_)\r\n```\r\n\r\nThe one obvious remark here is: shouldn't it be something like `os.path.dirname(__opts__['conf_file'])`?\r\n\r\nThe other is; Shouldn't `salt-cloud` CLI provide it's own `__opts__`? Or is it supposed to be `mopts_` that delivers `conf_file`?\r\n"}}