mirror of
				https://github.com/github/octodns.git
				synced 2024-05-11 05:55:00 +00:00 
			
		
		
		
	Some codestyle review changes.
This commit is contained in:
		@@ -52,9 +52,6 @@ class TransipProvider(BaseProvider):
 | 
				
			|||||||
        self.account = account
 | 
					        self.account = account
 | 
				
			||||||
        self.key = key
 | 
					        self.key = key
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        self._zones = None
 | 
					 | 
				
			||||||
        self._zone_records = {}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        self._currentZone = {}
 | 
					        self._currentZone = {}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def populate(self, zone, target=False, lenient=False):
 | 
					    def populate(self, zone, target=False, lenient=False):
 | 
				
			||||||
@@ -72,7 +69,6 @@ class TransipProvider(BaseProvider):
 | 
				
			|||||||
                self.log.warning(
 | 
					                self.log.warning(
 | 
				
			||||||
                    'populate: (%s) Zone %s not found in account ',
 | 
					                    'populate: (%s) Zone %s not found in account ',
 | 
				
			||||||
                    e.fault.faultcode, zone.name)
 | 
					                    e.fault.faultcode, zone.name)
 | 
				
			||||||
                exists = False
 | 
					 | 
				
			||||||
                return exists
 | 
					                return exists
 | 
				
			||||||
            elif e.fault.faultcode == '102' and target is True:
 | 
					            elif e.fault.faultcode == '102' and target is True:
 | 
				
			||||||
                self.log.warning('populate: Transip can\'t create new zones')
 | 
					                self.log.warning('populate: Transip can\'t create new zones')
 | 
				
			||||||
@@ -115,9 +111,6 @@ class TransipProvider(BaseProvider):
 | 
				
			|||||||
        changes = plan.changes
 | 
					        changes = plan.changes
 | 
				
			||||||
        self.log.debug('apply: zone=%s, changes=%d', desired.name,
 | 
					        self.log.debug('apply: zone=%s, changes=%d', desired.name,
 | 
				
			||||||
                       len(changes))
 | 
					                       len(changes))
 | 
				
			||||||
        # for change in changes:
 | 
					 | 
				
			||||||
        #    class_name = change.__class__.__name__
 | 
					 | 
				
			||||||
        #    getattr(self, '_apply_{}'.format(class_name))(change)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        self._currentZone = plan.desired
 | 
					        self._currentZone = plan.desired
 | 
				
			||||||
        try:
 | 
					        try:
 | 
				
			||||||
@@ -265,24 +258,24 @@ class TransipProvider(BaseProvider):
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def _data_for_MX(self, _type, records):
 | 
					    def _data_for_MX(self, _type, records):
 | 
				
			||||||
        values = []
 | 
					        _values = []
 | 
				
			||||||
        for record in records:
 | 
					        for record in records:
 | 
				
			||||||
            preference, exchange = record['content'].split(" ", 1)
 | 
					            preference, exchange = record['content'].split(" ", 1)
 | 
				
			||||||
            values.append({
 | 
					            _values.append({
 | 
				
			||||||
                'preference': preference,
 | 
					                'preference': preference,
 | 
				
			||||||
                'exchange': self._parse_to_fqdn(exchange)
 | 
					                'exchange': self._parse_to_fqdn(exchange)
 | 
				
			||||||
            })
 | 
					            })
 | 
				
			||||||
        return {
 | 
					        return {
 | 
				
			||||||
            'ttl': self._get_lowest_ttl(records),
 | 
					            'ttl': self._get_lowest_ttl(records),
 | 
				
			||||||
            'type': _type,
 | 
					            'type': _type,
 | 
				
			||||||
            'values': values
 | 
					            'values': _values
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def _data_for_SRV(self, _type, records):
 | 
					    def _data_for_SRV(self, _type, records):
 | 
				
			||||||
        values = []
 | 
					        _values = []
 | 
				
			||||||
        for record in records:
 | 
					        for record in records:
 | 
				
			||||||
            priority, weight, port, target = record['content'].split(' ', 3)
 | 
					            priority, weight, port, target = record['content'].split(' ', 3)
 | 
				
			||||||
            values.append({
 | 
					            _values.append({
 | 
				
			||||||
                'port': port,
 | 
					                'port': port,
 | 
				
			||||||
                'priority': priority,
 | 
					                'priority': priority,
 | 
				
			||||||
                'target': self._parse_to_fqdn(target),
 | 
					                'target': self._parse_to_fqdn(target),
 | 
				
			||||||
@@ -292,14 +285,14 @@ class TransipProvider(BaseProvider):
 | 
				
			|||||||
        return {
 | 
					        return {
 | 
				
			||||||
            'type': _type,
 | 
					            'type': _type,
 | 
				
			||||||
            'ttl': self._get_lowest_ttl(records),
 | 
					            'ttl': self._get_lowest_ttl(records),
 | 
				
			||||||
            'values': values
 | 
					            'values': _values
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def _data_for_SSHFP(self, _type, records):
 | 
					    def _data_for_SSHFP(self, _type, records):
 | 
				
			||||||
        values = []
 | 
					        _values = []
 | 
				
			||||||
        for record in records:
 | 
					        for record in records:
 | 
				
			||||||
            algorithm, fp_type, fingerprint = record['content'].split(' ', 2)
 | 
					            algorithm, fp_type, fingerprint = record['content'].split(' ', 2)
 | 
				
			||||||
            values.append({
 | 
					            _values.append({
 | 
				
			||||||
                'algorithm': algorithm,
 | 
					                'algorithm': algorithm,
 | 
				
			||||||
                'fingerprint': fingerprint.lower(),
 | 
					                'fingerprint': fingerprint.lower(),
 | 
				
			||||||
                'fingerprint_type': fp_type
 | 
					                'fingerprint_type': fp_type
 | 
				
			||||||
@@ -308,14 +301,14 @@ class TransipProvider(BaseProvider):
 | 
				
			|||||||
        return {
 | 
					        return {
 | 
				
			||||||
            'type': _type,
 | 
					            'type': _type,
 | 
				
			||||||
            'ttl': self._get_lowest_ttl(records),
 | 
					            'ttl': self._get_lowest_ttl(records),
 | 
				
			||||||
            'values': values
 | 
					            'values': _values
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def _data_for_CAA(self, _type, records):
 | 
					    def _data_for_CAA(self, _type, records):
 | 
				
			||||||
        values = []
 | 
					        _values = []
 | 
				
			||||||
        for record in records:
 | 
					        for record in records:
 | 
				
			||||||
            flags, tag, value = record['content'].split(' ', 2)
 | 
					            flags, tag, value = record['content'].split(' ', 2)
 | 
				
			||||||
            values.append({
 | 
					            _values.append({
 | 
				
			||||||
                'flags': flags,
 | 
					                'flags': flags,
 | 
				
			||||||
                'tag': tag,
 | 
					                'tag': tag,
 | 
				
			||||||
                'value': value
 | 
					                'value': value
 | 
				
			||||||
@@ -324,16 +317,16 @@ class TransipProvider(BaseProvider):
 | 
				
			|||||||
        return {
 | 
					        return {
 | 
				
			||||||
            'type': _type,
 | 
					            'type': _type,
 | 
				
			||||||
            'ttl': self._get_lowest_ttl(records),
 | 
					            'ttl': self._get_lowest_ttl(records),
 | 
				
			||||||
            'values': values
 | 
					            'values': _values
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def _data_for_TXT(self, _type, records):
 | 
					    def _data_for_TXT(self, _type, records):
 | 
				
			||||||
        values = []
 | 
					        _values = []
 | 
				
			||||||
        for record in records:
 | 
					        for record in records:
 | 
				
			||||||
            values.append(record['content'].replace(';', '\\;'))
 | 
					            _values.append(record['content'].replace(';', '\\;'))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return {
 | 
					        return {
 | 
				
			||||||
            'type': _type,
 | 
					            'type': _type,
 | 
				
			||||||
            'ttl': self._get_lowest_ttl(records),
 | 
					            'ttl': self._get_lowest_ttl(records),
 | 
				
			||||||
            'values': values
 | 
					            'values': _values
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user