mirror of
https://github.com/linux-system-roles/network.git
synced 2026-07-23 19:07:45 +00:00
library: drop unused "ip_is_present" variable
We don't care whether a 'ip' or 'bond' setting is entirely omitted or whether some fields are set by the user. Omitting a setting should make use of some default values, but that's it. No need to track whether the setting is actually specified by the user.
This commit is contained in:
parent
c1b62f01d0
commit
efe4201f86
2 changed files with 0 additions and 24 deletions
|
|
@ -621,7 +621,6 @@ class ArgValidator_DictIP(ArgValidatorDict):
|
|||
),
|
||||
],
|
||||
default_value = lambda: {
|
||||
'ip_is_present': False,
|
||||
'dhcp4': True,
|
||||
'dhcp4_send_hostname': None,
|
||||
'gateway4': None,
|
||||
|
|
@ -636,8 +635,6 @@ class ArgValidator_DictIP(ArgValidatorDict):
|
|||
)
|
||||
|
||||
def _validate_post(self, value, name, result):
|
||||
if 'ip_is_present' not in result:
|
||||
result['ip_is_present'] = True
|
||||
if result['dhcp4'] is None:
|
||||
result['dhcp4'] = result['dhcp4_send_hostname'] is not None or not any([a for a in result['address'] if a['is_v4']])
|
||||
if result['auto6'] is None:
|
||||
|
|
@ -661,14 +658,8 @@ class ArgValidator_DictBond(ArgValidatorDict):
|
|||
default_value = ArgValidator.MISSING,
|
||||
)
|
||||
|
||||
def _validate_post(self, value, name, result):
|
||||
if 'bond_is_present' not in result:
|
||||
result['bond_is_present'] = True
|
||||
return result
|
||||
|
||||
def get_default_bond(self):
|
||||
return {
|
||||
'bond_is_present': False,
|
||||
'mode': ArgValidator_DictBond.VALID_MODES[0],
|
||||
'miimon': None,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -147,7 +147,6 @@ class TestValidator(unittest.TestCase):
|
|||
'dhcp4': True,
|
||||
'address': [],
|
||||
'route_metric6': None,
|
||||
'ip_is_present': False,
|
||||
'dhcp4_send_hostname': None,
|
||||
'dns': [],
|
||||
'dns_search': [],
|
||||
|
|
@ -193,7 +192,6 @@ class TestValidator(unittest.TestCase):
|
|||
'dns': [],
|
||||
'dns_search': [],
|
||||
'route_metric6': None,
|
||||
'ip_is_present': False,
|
||||
'dhcp4_send_hostname': None,
|
||||
},
|
||||
'mac': None,
|
||||
|
|
@ -241,7 +239,6 @@ class TestValidator(unittest.TestCase):
|
|||
'name': 'prod1',
|
||||
'parent': None,
|
||||
'ip': {
|
||||
'ip_is_present': True,
|
||||
'dhcp4': False,
|
||||
'route_metric6': None,
|
||||
'route_metric4': None,
|
||||
|
|
@ -295,7 +292,6 @@ class TestValidator(unittest.TestCase):
|
|||
'name': 'prod1',
|
||||
'parent': None,
|
||||
'ip': {
|
||||
'ip_is_present': False,
|
||||
'dhcp4': True,
|
||||
'auto6': True,
|
||||
'address': [],
|
||||
|
|
@ -324,7 +320,6 @@ class TestValidator(unittest.TestCase):
|
|||
'name': 'prod.100',
|
||||
'parent': 'prod1',
|
||||
'ip': {
|
||||
'ip_is_present': True,
|
||||
'dhcp4': False,
|
||||
'route_metric6': None,
|
||||
'route_metric4': None,
|
||||
|
|
@ -385,7 +380,6 @@ class TestValidator(unittest.TestCase):
|
|||
'name': 'prod2',
|
||||
'parent': None,
|
||||
'ip': {
|
||||
'ip_is_present': True,
|
||||
'dhcp4': False,
|
||||
'route_metric6': None,
|
||||
'route_metric4': None,
|
||||
|
|
@ -414,7 +408,6 @@ class TestValidator(unittest.TestCase):
|
|||
'name': 'prod2-slave1',
|
||||
'parent': None,
|
||||
'ip': {
|
||||
'ip_is_present': False,
|
||||
'dhcp4': True,
|
||||
'auto6': True,
|
||||
'address': [],
|
||||
|
|
@ -467,7 +460,6 @@ class TestValidator(unittest.TestCase):
|
|||
'name': 'bond1',
|
||||
'parent': None,
|
||||
'ip': {
|
||||
'ip_is_present': False,
|
||||
'dhcp4': True,
|
||||
'route_metric6': None,
|
||||
'route_metric4': None,
|
||||
|
|
@ -490,7 +482,6 @@ class TestValidator(unittest.TestCase):
|
|||
'type': 'bond',
|
||||
'slave_type': None,
|
||||
'bond': {
|
||||
'bond_is_present': False,
|
||||
'mode': 'balance-rr',
|
||||
'miimon': None,
|
||||
},
|
||||
|
|
@ -513,7 +504,6 @@ class TestValidator(unittest.TestCase):
|
|||
'name': 'bond1',
|
||||
'parent': None,
|
||||
'ip': {
|
||||
'ip_is_present': False,
|
||||
'dhcp4': True,
|
||||
'route_metric6': None,
|
||||
'route_metric4': None,
|
||||
|
|
@ -536,7 +526,6 @@ class TestValidator(unittest.TestCase):
|
|||
'type': 'bond',
|
||||
'slave_type': None,
|
||||
'bond': {
|
||||
'bond_is_present': True,
|
||||
'mode': 'active-backup',
|
||||
'miimon': None,
|
||||
},
|
||||
|
|
@ -572,7 +561,6 @@ class TestValidator(unittest.TestCase):
|
|||
'dhcp4_send_hostname': None,
|
||||
'gateway4': None,
|
||||
'gateway6': None,
|
||||
'ip_is_present': False,
|
||||
'route_metric4': None,
|
||||
'route_metric6': None,
|
||||
'dns': [],
|
||||
|
|
@ -618,7 +606,6 @@ class TestValidator(unittest.TestCase):
|
|||
'dns': [],
|
||||
'dns_search': [ ],
|
||||
'route_metric6': None,
|
||||
'ip_is_present': False,
|
||||
'dhcp4_send_hostname': None,
|
||||
},
|
||||
'mac': None,
|
||||
|
|
@ -658,7 +645,6 @@ class TestValidator(unittest.TestCase):
|
|||
'dns': [],
|
||||
'dns_search': [ ],
|
||||
'route_metric6': None,
|
||||
'ip_is_present': True,
|
||||
'dhcp4_send_hostname': None,
|
||||
},
|
||||
'mac': None,
|
||||
|
|
@ -700,7 +686,6 @@ class TestValidator(unittest.TestCase):
|
|||
'dns': [],
|
||||
'dns_search': [ 'aa', 'bb' ],
|
||||
'route_metric6': None,
|
||||
'ip_is_present': True,
|
||||
'dhcp4_send_hostname': None,
|
||||
},
|
||||
'mac': None,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue