Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Function change_ip throws error if the zone does not have any A records #136

Open
bigbigblake opened this issue Mar 1, 2019 · 1 comment

Comments

@bigbigblake
Copy link

If you have a zone that does not actually contain any A records this function will fail.

my_zones = get_all_zones()

oldIP = ['10.1.2.3', '10.1.2.4']
newIP = ['10.1.2.6', '10.1.2.8']

for zone in my_zones:
    if (zone.name != 'problem zone'):
        changedRecords = change_ip(zone, oldIP, newIP, v6=False, publish=True)

The utility fails with this error:

Traceback (most recent call last):
File "C:/Users/blahblah/PycharmProjects/DynReader/DynModifier.py", line 26, in
changedRecords = change_ip(zone, oldIP, newIP, v6=False, publish=True)
File "C:\Users\blahblah\PycharmProjects\DynReader\venv\lib\site-packages\dyn\tm\tools.py", line 30, in change_ip
records = records['aaaa_records'] if v6 else records['a_records']
KeyError: 'a_records'

@bigbigblake
Copy link
Author

Additionally the publish=True does not seem to work correctly in this iteration. Right after i run the change_ip i have to do a zone.publish() for it to actually write to DYN.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant