Skip to content

Salt-cloud CLI 2015.8 borks out with global name '__opts__' is not defined  #27956

Closed

Description

@The-Loeki

Using the cloudstack driver to create a single minion, the VM gets created & starts responding, but then salt-cloud borks out:

[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>'}
[INFO    ] Salt installed on dodacloud3
[INFO    ] Created Cloud VM 'dodacloud3'
[DEBUG   ] 'dodacloud3' VM creation details:<snipped>
[DEBUG   ] Sending event - data = {'profile': 'dodacloud-profile', 'event': 'created instance', '_stamp': '2015-10-14T20:07:49.792801', 'name': 'dodacloud3', 'provider': 'aurora-ams:cloudstack'}
[ERROR   ] There was a profile error: global name '__opts__' is not defined
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/salt/cloud/cli.py", line 276, in run
    self.config.get('names')
  File "/usr/lib/python2.7/site-packages/salt/cloud/__init__.py", line 1403, in run_profile
    ret[name] = self.create(vm_)
  File "/usr/lib/python2.7/site-packages/salt/cloud/__init__.py", line 1260, in create
    conf_path = '/'.join(__opts__['conf_file'].split('/')[:-1])
NameError: global name '__opts__' is not defined

That line reads:

                # a small pause makes the sync work reliably
                time.sleep(3)

                mopts_ = salt.config.DEFAULT_MINION_OPTS
                conf_path = '/'.join(__opts__['conf_file'].split('/')[:-1])
                mopts_.update(
                    salt.config.minion_config(
                        os.path.join(conf_path,
                                     'minion')
                    )
                )

                client = salt.client.get_local_client(mopts=mopts_)

The one obvious remark here is: shouldn't it be something like os.path.dirname(__opts__['conf_file'])?

The other is; Shouldn't salt-cloud CLI provide it's own __opts__? Or is it supposed to be mopts_ that delivers conf_file?

Activity

  1. changed the title [-]Salt-cloud 2015.8 borks out with global name '__opts__' is not defined [/-] [+]Salt-cloud CLI 2015.8 borks out with global name '__opts__' is not defined [/+] on Oct 14, 2015
  2. techhat commented on Oct 14, 2015

    @techhat
    Contributor

    Looks like it should be self.opts.

  3. added
    bug
    severity-medium
    P1
    RIoT
    on Oct 14, 2015
  4. The-Loeki commented on Oct 14, 2015

    @The-Loeki
    ContributorAuthor

    Well, tested it here and that works too :D tnx

  5. added this to the Approved milestone on Oct 14, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1RIoTSalt-Cloudbugseverity-medium

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions