1
0
mirror of https://github.com/github/octodns.git synced 2024-05-11 05:55:00 +00:00
Files
github-octodns/octodns/cmds/sync.py
Guillaume Gelin 31105cc472 Implement octodns-sync --source
It can be useful to only synchronize zones that use a certain source. For
example, in a situation where some zones use a dynamic source and others don't,
you probably want to synchronize those with a dynamic source regularly, and
only synchronize the others when a change is made.

Although we only synchronize the zones that use a given source, we still want
to synchronize all sources to avoid deleting records that would live in another
source of the zone.
2020-08-27 16:16:24 +02:00

45 lines
1.6 KiB
Python
Executable File

#!/usr/bin/env python
'''
Octo-DNS Multiplexer
'''
from __future__ import absolute_import, division, print_function, \
unicode_literals
from octodns.cmds.args import ArgumentParser
from octodns.manager import Manager
def main():
parser = ArgumentParser(description=__doc__.split('\n')[1])
parser.add_argument('--config-file', required=True,
help='The Manager configuration file to use')
parser.add_argument('--doit', action='store_true', default=False,
help='Whether to take action or just show what would '
'change')
parser.add_argument('--force', action='store_true', default=False,
help='Acknowledge that significant changes are being '
'made and do them')
parser.add_argument('zone', nargs='*', default=[],
help='Limit sync to the specified zone(s)')
parser.add_argument('--source', default=[], action='append',
help='Limit sync to zones with the specified '
'source(s) (all sources will be synchronized for the '
'selected zones)')
parser.add_argument('--target', default=[], action='append',
help='Limit sync to the specified target(s)')
args = parser.parse_args()
manager = Manager(args.config_file)
manager.sync(eligible_zones=args.zone, eligible_sources=args.source,
eligible_targets=args.target, dry_run=not args.doit,
force=args.force)
if __name__ == '__main__':
main()