mirror of
				https://github.com/github/octodns.git
				synced 2024-05-11 05:55:00 +00:00 
			
		
		
		
	Merge pull request #675 from snh/powerdns-sort
PowerDNS: Delete records before creating or modifying records
This commit is contained in:
		@@ -6,6 +6,7 @@ from __future__ import absolute_import, division, print_function, \
 | 
			
		||||
    unicode_literals
 | 
			
		||||
 | 
			
		||||
from requests import HTTPError, Session
 | 
			
		||||
from operator import itemgetter
 | 
			
		||||
import logging
 | 
			
		||||
 | 
			
		||||
from ..record import Create, Record
 | 
			
		||||
@@ -381,6 +382,12 @@ class PowerDnsBaseProvider(BaseProvider):
 | 
			
		||||
        for change in changes:
 | 
			
		||||
            class_name = change.__class__.__name__
 | 
			
		||||
            mods.append(getattr(self, '_mod_{}'.format(class_name))(change))
 | 
			
		||||
 | 
			
		||||
        # Ensure that any DELETE modifications always occur before any REPLACE
 | 
			
		||||
        # modifications. This ensures that an A record can be replaced by a
 | 
			
		||||
        # CNAME record and vice-versa.
 | 
			
		||||
        mods.sort(key=itemgetter('changetype'))
 | 
			
		||||
 | 
			
		||||
        self.log.debug('_apply:   sending change request')
 | 
			
		||||
 | 
			
		||||
        try:
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user