mirror of
https://github.com/github/octodns.git
synced 2024-05-11 05:55:00 +00:00
Rework supports_warn_or_except to msg and fallback
This commit is contained in:
@@ -52,10 +52,11 @@ class BaseProvider(BaseSource):
|
||||
for record in desired.records:
|
||||
if record._type == 'PTR' and len(record.values) > 1:
|
||||
# replace with a single-value copy
|
||||
self.supports_warn_or_except('does not support multi-value '
|
||||
'PTR records; will use only {} '
|
||||
'for {}'.format(record.value,
|
||||
record.fqdn))
|
||||
msg = 'multi-value PTR records not supported for {}' \
|
||||
.format(record.fqdn)
|
||||
fallback = 'falling back to single value, {}' \
|
||||
.format(record.value)
|
||||
self.supports_warn_or_except(msg, fallback)
|
||||
record = record.copy()
|
||||
record.values = [record.value]
|
||||
|
||||
@@ -78,10 +79,10 @@ class BaseProvider(BaseSource):
|
||||
'''
|
||||
return []
|
||||
|
||||
def supports_warn_or_except(self, msg):
|
||||
def supports_warn_or_except(self, msg, fallback):
|
||||
if self.strict_supports:
|
||||
raise ProviderException('{}: {}'.format(self.id, msg))
|
||||
self.log.warning(msg)
|
||||
self.log.warning('{}; {}'.format(msg, fallback))
|
||||
|
||||
def plan(self, desired, processors=[]):
|
||||
self.log.info('plan: desired=%s', desired.name)
|
||||
|
Reference in New Issue
Block a user