Skip to content

Exception when calling create method on openstack cloud provider from reactor sls #20932

Closed

Description

@dtoubelis

This is my version of salt:

root@saltmaster:~# salt --versions-report
           Salt: 2014.7.1
         Python: 2.7.6 (default, Mar 22 2014, 22:59:56)
         Jinja2: 2.7.2
       M2Crypto: 0.21.1
 msgpack-python: 0.3.0
   msgpack-pure: Not Installed
       pycrypto: 2.6.1
        libnacl: Not Installed
         PyYAML: 3.10
          ioflo: Not Installed
          PyZMQ: 14.0.1
           RAET: Not Installed
            ZMQ: 4.0.4
           Mako: 0.9.1

and I'm getting this exception in openstack cloud provider:

[DEBUG   ] local variable 'data' referenced before assignment
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/salt/utils/process.py", line 184, in _thread_target
    func(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/salt/client/mixins.py", line 39, in low
    ret = l_fun(*f_call.get('args', ()), **f_call.get('kwargs', {}))
  File "/usr/lib/python2.7/dist-packages/salt/runners/cloud.py", line 141, in create
    info = client.create(provider, instances, **create_kwargs)
  File "/usr/lib/python2.7/dist-packages/salt/cloud/__init__.py", line 392, in create
    mapper.create(vm_))
  File "/usr/lib/python2.7/dist-packages/salt/cloud/__init__.py", line 1193, in create
    output = self.clouds[func](vm_)
  File "/usr/lib/python2.7/dist-packages/salt/cloud/clouds/openstack.py", line 754, in create
    update_args=(vm_, data, vm_['floating']),
UnboundLocalError: local variable 'data' referenced before assignment 

This is the rendered reactor.sls that is executed:

autoscale_launch:
  runner.cloud.create:
  - private_ips: [172.31.0.3, 10.209.164.79, 172.30.0.3]
  - extra:
      access_ip: 104.239.149.99
      created: '2015-02-23T09:18:06Z'
      disk_config: MANUAL
      flavorId: general1-1
      hostId: 97127ff37f52f8b82eb813e48538d4d9d0c39b6efb007146f5c76bda
      imageId: a1558fdc-3182-4a0f-b48a-aa900a5826c3
      key_name: saltmaster
      metadata: {}
      password: null
      tenantId: '999999'
      updated: '2015-02-23T09:18:33Z'
      uri: https://dfw.servers.api.rackspacecloud.com/v2/945708/servers/41b275ac-6bd9-4ed8-9d26-7a4a5b96f8c3
  - {ssh_username: root}
  - {image: null}
  - {_uuid: null}
  - public_ips: [104.239.149.99, '2001:4800:7819:105:be76:4eff:fe05:de92']
  - {name: dfw-test-06}
  - {instance_id: 41b275ac-6bd9-4ed8-9d26-7a4a5b96f8c3}
  - {instances: dfw-test-06}
  - {provider: rackspace-dfw}
  - {id: 41b275ac-6bd9-4ed8-9d26-7a4a5b96f8c3}
  - {size: null}

This SLS is created by python script that is triggering installation of salt minion to an openstack instance that was created by other means.

This is relevan provider configuration:

rackspace-dfw:

  provider: openstack

  # conigure Rackspace with openstack plugin
  identity_url: https://identity.api.rackspacecloud.com/v2.0/tokens
  compute_name: cloudServersOpenStack
  protocol: ipv4

  # ssh configuration
  ssh_key_name: saltmaster
  ssh_key_file: /root/.ssh/saltmaster.pem
  ssh_interface: private_ips

  # authentication credentials
  user: <user-name>
  apikey: <api-key>
  tenant: <tenant-id>

  # region
  compute_region: DFW

  # minion configuration
  minion:
    master: saltmaster.example.com

Activity

  1. added
    bug
    severity-low
    on Feb 23, 2015
  2. added this to the Approved milestone on Feb 23, 2015
  3. jfindlay commented on Feb 23, 2015

    @jfindlay
    Contributor

    @dtoubelis, thanks for the report.

  4. dtoubelis commented on Feb 25, 2015

    @dtoubelis
    Author

    There is an if...else... statement at around line 609 in openstack.py and it seems that data variable is first declared in that block but only in the else part of it, so it is not defined if instance_id is provided in the request.

  5. gtmanfred commented on Feb 26, 2015

    @gtmanfred
    Contributor

    hrm... I will have to look at this next week.

  6. added
    RIoT
    on Jun 9, 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

    RIoTSalt-Cloudbugseverity-low

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions