1
0
mirror of https://github.com/github/octodns.git synced 2024-05-11 05:55:00 +00:00

f-strings for cmds and processors

This commit is contained in:
Ross McFarland
2021-09-03 09:58:08 -07:00
parent bd8e9c9c14
commit 67e79481bd
3 changed files with 6 additions and 6 deletions

View File

@@ -25,7 +25,7 @@ class ArgumentParser(_Base):
super(ArgumentParser, self).__init__(*args, **kwargs)
def parse_args(self, default_log_level=INFO):
version = 'octoDNS {}'.format(__VERSION__)
version = f'octoDNS {__VERSION__}'
self.add_argument('--version', action='version', version=version,
help='Print octoDNS version and exit')
self.add_argument('--log-stream-stdout', action='store_true',

View File

@@ -53,13 +53,14 @@ def main():
try:
sources = [manager.providers[source] for source in args.source]
except KeyError as e:
raise Exception('Unknown source: {}'.format(e.args[0]))
raise Exception(f'Unknown source: {e.args[0]}')
zone = manager.get_zone(args.zone)
for source in sources:
source.populate(zone)
print('name,type,ttl,{},consistent'.format(','.join(args.server)))
servers = ','.join(args.server)
print(f'name,type,ttl,{servers},consistent')
resolvers = []
ip_addr_re = re.compile(r'^[\d\.]+$')
for server in args.server:

View File

@@ -29,10 +29,9 @@ class OwnershipProcessor(BaseProcessor):
# Then create and add an ownership TXT for each of them
record_name = record.name.replace('*', '_wildcard')
if record.name:
name = '{}.{}.{}'.format(self.txt_name, record._type,
record_name)
name = f'{self.txt_name}.{record._type}.{record_name}'
else:
name = '{}.{}'.format(self.txt_name, record._type)
name = f'{self.txt_name}.{record._type}'
txt = Record.new(desired, name, {
'type': 'TXT',
'ttl': 60,