salt: Boto_route53.present errors out, error: Useage of _record before assignment of _record

Description of Issue/Question

When trying to assign a dns entry in route53 to my box via boto_route53.present I’ve run into an issue where it fails out.

Setup

SLS File:

setup.internal.domain:
  boto_route53.present:
    - name: {{ grains['internal_domain'] }}
    - value: {{ grains.get('ipv4')[0] }}
    - zone: DOMAIN.TLD
    - ttl: 60
    - record_type: A
    - region: us-east-1
    - profile: 
        keyid: {{ salt['pillar.get']('awskeyid','failure') }}
        key: {{ salt['pillar.get']('awskey','failure') }}

Steps to Reproduce Issue

Error is:

    Apr 01 15:27:16 nhendrickson-test-box.linode-nj1.backtrace.io salt-minion[3891]:   File "/usr/lib/python2.7/dist-packages/salt/state.py", line 1933, in call
    Apr 01 15:27:16 nhendrickson-test-box.linode-nj1.backtrace.io salt-minion[3891]:     **cdata['kwargs'])
    Apr 01 15:27:16 nhendrickson-test-box.linode-nj1.backtrace.io salt-minion[3891]:   File "/usr/lib/python2.7/dist-packages/salt/loader.py", line 1939, in wrapper
    Apr 01 15:27:16 nhendrickson-test-box.linode-nj1.backtrace.io salt-minion[3891]:     return f(*args, **kwargs)
    Apr 01 15:27:16 nhendrickson-test-box.linode-nj1.backtrace.io salt-minion[3891]:   File "/usr/lib/python2.7/dist-packages/salt/states/boto_route53.py", line 185, in present
    Apr 01 15:27:16 nhendrickson-test-box.linode-nj1.backtrace.io salt-minion[3891]:     private_zone, identifier)
    Apr 01 15:27:16 nhendrickson-test-box.linode-nj1.backtrace.io salt-minion[3891]:   File "/usr/lib/python2.7/dist-packages/salt/modules/boto_route53.py", line 533, in get_record
    Apr 01 15:27:16 nhendrickson-test-box.linode-nj1.backtrace.io salt-minion[3891]:     if _record:
    Apr 01 15:27:16 nhendrickson-test-box.linode-nj1.backtrace.io salt-minion[3891]: UnboundLocalError: local variable '_record' referenced before assignment

Reproduce:

sudo salt 'target_name' state.apply states.network.internal-dns
or
sudo salt 'target_name' state.highstate

Versions Report

Salt Version: Salt: 2019.2.0

Dependency Versions: cffi: 1.12.1 cherrypy: unknown dateutil: 2.6.1 docker-py: Not Installed gitdb: 2.0.3 gitpython: 2.1.8 ioflo: Not Installed Jinja2: 2.10 libgit2: 0.26.0 libnacl: Not Installed M2Crypto: Not Installed Mako: 1.0.7 msgpack-pure: Not Installed msgpack-python: 0.5.6 mysql-python: Not Installed pycparser: 2.17 pycrypto: 2.6.1 pycryptodome: Not Installed pygit2: 0.26.2 Python: 2.7.15rc1 (default, Nov 12 2018, 14:31:15) python-gnupg: 0.4.1 PyYAML: 3.12 PyZMQ: 16.0.2 RAET: Not Installed smmap: 2.0.3 timelib: Not Installed Tornado: 4.5.3 ZMQ: 4.2.5

System Versions: dist: Ubuntu 18.04 bionic locale: UTF-8 machine: x86_64 release: 4.15.0-43-generic system: Linux version: Ubuntu 18.04 bionic

About this issue

  • Original URL
  • State: open
  • Created 5 years ago
  • Reactions: 3
  • Comments: 17 (4 by maintainers)

Most upvoted comments

@waynew So oddly enough forgot to update this. My issue was from my pillar being down and my state not getting access to AWS creds. If others are having it that’s odd.