Skip to content

Commit

Permalink
Add support for specifying -4 option to nsupdate
Browse files Browse the repository at this point in the history
In our environment, our DNS server requires passing the "-4" argument to
the nsupdate command. This change adds support for configuring OSIA to
use this option when using the nsupdate dns provider.
  • Loading branch information
accorvin committed Jul 12, 2022
1 parent 647a226 commit 6631a89
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions osia/installer/dns/nsupdate.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,18 @@

class NSUpdate(DNSUtil):
"""Implementation of DNSUtil specific for nsupdate dns provider"""
def __init__(self, key_file=None, server=None, zone=None, **kwargs):
def __init__(self, key_file=None, server=None, zone=None, ipv4_only=False, **kwargs):
super().__init__(**kwargs)
self.key_file = key_file
self.server = server
self.zone = zone
self.ipv4_only = ipv4_only

def _exec_nsupdate(self, string: str):
with Popen(["nsupdate", "-k", self.key_file], stdin=PIPE, universal_newlines=True) as nsu:
nsupdate_args = ["nsupdate", "-k", self.key_file]
if self.ipv4_only:
nsupdate_args.append('-4')
with Popen(nsupdate_args, stdin=PIPE, universal_newlines=True) as nsu:
nsu.communicate(string)
self.modified = True

Expand Down

0 comments on commit 6631a89

Please sign in to comment.