From 05f4490b67bada7d91d64a861357f592294b6c75 Mon Sep 17 00:00:00 2001 From: Jeffrey Townsend Date: Mon, 28 Nov 2016 08:34:59 -0800 Subject: [PATCH] - Set NETREQUIRED as a class variable for easier overrides. - Allow NETAUTO=up --- .../src/python/onl/bootconfig/__init__.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/packages/base/all/vendor-config-onl/src/python/onl/bootconfig/__init__.py b/packages/base/all/vendor-config-onl/src/python/onl/bootconfig/__init__.py index f43a1610..61a00774 100755 --- a/packages/base/all/vendor-config-onl/src/python/onl/bootconfig/__init__.py +++ b/packages/base/all/vendor-config-onl/src/python/onl/bootconfig/__init__.py @@ -97,8 +97,8 @@ class OnlBootConfig(object): class OnlBootConfigNet(OnlBootConfig): - def __init(self): - self.netrequired = False + + NET_REQUIRED = False def netauto_set(self): self.delete('NETIP') @@ -125,21 +125,21 @@ class OnlBootConfigNet(OnlBootConfig): if netip: if not self.is_ip_address(netip): raise ValueError("NETIP=%s is not a valid ip-address" % (netup)) - elif self.netrequired: + elif self.NET_REQUIRED: raise ValueError("No IP configuration set for the management interface.") netmask = self.keys.get('NETMASK', None) if netmask: if not self.is_netmask(netmask): raise ValueError("NETMASK=%s is not a valid netmask." % (netmask)) - elif self.netrequired: + elif self.NET_REQUIRED: raise ValueError("No Netmask configured for the management interface.") netgw = self.keys.get('NETGW', None) if netgw: if not self.is_ip_address(netgw): raise ValueError("NETGW=%s is not a valid ip-address." % (netgw)) - elif self.netrequired: + elif self.NET_REQUIRED: raise ValueError("No gateway configured for the management interface.") if netip and netmask and netgw: @@ -149,8 +149,10 @@ class OnlBootConfigNet(OnlBootConfig): elif netip or netmask or netgw: raise ValueError("Incomplete static network configuration. NETIP, NETMASK, and NETGW must all be set.") - elif self.keys['NETAUTO'] != 'dhcp': + elif self.keys['NETAUTO'] not in ['dhcp', 'up']: raise ValueError("The NETAUTO value '%s' is invalid." % self.keys['NETAUTO']) + elif self.keys['NETAUTO'] == 'up' && self.NET_REQUIRED: + raise ValueError("NETAUTO is 'up' but non-local networking is required.") if 'NETDEV' not in self.keys: self.keys['NETDEV'] = 'ma1'