Skip to content

Commit 6631a89

Browse files
committed
Add support for specifying -4 option to nsupdate
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.
1 parent 647a226 commit 6631a89

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

Diff for: osia/installer/dns/nsupdate.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,18 @@
2222

2323
class NSUpdate(DNSUtil):
2424
"""Implementation of DNSUtil specific for nsupdate dns provider"""
25-
def __init__(self, key_file=None, server=None, zone=None, **kwargs):
25+
def __init__(self, key_file=None, server=None, zone=None, ipv4_only=False, **kwargs):
2626
super().__init__(**kwargs)
2727
self.key_file = key_file
2828
self.server = server
2929
self.zone = zone
30+
self.ipv4_only = ipv4_only
3031

3132
def _exec_nsupdate(self, string: str):
32-
with Popen(["nsupdate", "-k", self.key_file], stdin=PIPE, universal_newlines=True) as nsu:
33+
nsupdate_args = ["nsupdate", "-k", self.key_file]
34+
if self.ipv4_only:
35+
nsupdate_args.append('-4')
36+
with Popen(nsupdate_args, stdin=PIPE, universal_newlines=True) as nsu:
3337
nsu.communicate(string)
3438
self.modified = True
3539

0 commit comments

Comments
 (0)