diff --git a/netinterface.py b/netinterface.py index abdfc9c4..086f5df8 100644 --- a/netinterface.py +++ b/netinterface.py @@ -130,6 +130,10 @@ def isStatic6(self): """ Returns true if an IPv6 static interface configuration is represented. """ return self.modev6 == self.Static + def isDynamic(self): + """ Returns true if a dynamic interface configuration is represented. """ + return self.mode == self.DHCP or self.modev6 == self.DHCP or self.modev6 == self.Autoconf + def isVlan(self): return self.vlan is not None diff --git a/netutil.py b/netutil.py index 00af6861..1719e336 100644 --- a/netutil.py +++ b/netutil.py @@ -92,7 +92,7 @@ def writeResolverFile(configuration, filename): for iface in configuration: settings = configuration[iface] - if settings.isStatic4() and settings.dns: + if (not settings.isDynamic()) and settings.dns: if settings.dns: for server in settings.dns: outfile.write("nameserver %s\n" % server) diff --git a/tui/installer/screens.py b/tui/installer/screens.py index feec2f6e..f0ef4490 100644 --- a/tui/installer/screens.py +++ b/tui/installer/screens.py @@ -895,7 +895,7 @@ def ns_callback((enabled, )): for entry in [ns1_entry, ns2_entry, ns3_entry]: entry.setFlags(FLAG_DISABLED, enabled) - hide_rb = answers['net-admin-configuration'].isStatic4() + hide_rb = not answers['net-admin-configuration'].isDynamic() # HOSTNAME: hn_title = Textbox(len("Hostname Configuration"), 1, "Hostname Configuration") @@ -1025,7 +1025,7 @@ def nsvalue(answers, id): answers['manual-nameservers'][1].append(ns2_entry.value()) if ns3_entry.value() != '': answers['manual-nameservers'][1].append(ns3_entry.value()) - if 'net-admin-configuration' in answers and answers['net-admin-configuration'].isStatic4(): + if 'net-admin-configuration' in answers and not answers['net-admin-configuration'].isDynamic(): answers['net-admin-configuration'].dns = answers['manual-nameservers'][1] else: answers['manual-nameservers'] = (False, None) @@ -1126,7 +1126,7 @@ def dhcp_change(): for x in [ ntp1_field, ntp2_field, ntp3_field ]: x.setFlags(FLAG_DISABLED, not dhcp_cb.value()) - hide_cb = answers['net-admin-configuration'].isStatic4() + hide_cb = not answers['net-admin-configuration'].isDynamic() gf = GridFormHelp(tui.screen, 'NTP Configuration', 'ntpconf', 1, 4) text = TextboxReflowed(60, "Please specify details of the NTP servers you wish to use (e.g. pool.ntp.org)?")