Skip to content

Commit

Permalink
catch error if no dns domains exist
Browse files Browse the repository at this point in the history
For digital ocean.  Fixes #33452
  • Loading branch information
Daniel Wallace committed Jul 13, 2016
1 parent 019671d commit 37b0943
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions salt/cloud/clouds/digital_ocean.py
Original file line number Diff line number Diff line change
Expand Up @@ -769,7 +769,7 @@ def destroy(name, call=None):
log.debug('Deleting DNS records for {0}.'.format(name))
destroy_dns_records(name)

# Until the "to do" from line 748 is taken care of, we don't need this logic.
# Until the "to do" from line 754 is taken care of, we don't need this logic.
# if delete_dns_record:
# log.debug('Deleting DNS records for {0}.'.format(name))
# destroy_dns_records(name)
Expand Down Expand Up @@ -845,7 +845,12 @@ def destroy_dns_records(fqdn):
'''
domain = '.'.join(fqdn.split('.')[-2:])
hostname = '.'.join(fqdn.split('.')[:-2])
response = query(method='domains', droplet_id=domain, command='records')
# TODO: remove this when the todo on 754 is available
try:
response = query(method='domains', droplet_id=domain, command='records')
except SaltCloudSystemExit:
log.debug('Failed to find domains.')
return False
log.debug("found DNS records: {0}".format(pprint.pformat(response)))
records = response['domain_records']

Expand Down

0 comments on commit 37b0943

Please sign in to comment.