From d88e79ac8cffc247b50180004b507dade94ecea9 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Thu, 2 Mar 2017 16:36:19 +0100 Subject: [PATCH] module: fix default value for dhcp4_send_hostname We should not set "dhcp4_send_hostname" unless it is explicitly present in the configuration. That is because initscripts don't support this parameter and issue a warning. --- library/network_connections.py | 4 +--- library/test_network_connections.py | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/library/network_connections.py b/library/network_connections.py index 123251c..9c7e8c3 100755 --- a/library/network_connections.py +++ b/library/network_connections.py @@ -619,9 +619,7 @@ class ArgValidator_DictIP(ArgValidatorDict): 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: result['auto6'] = not any([a for a in result['address'] if not a['is_v4']]) - if result['dhcp4_send_hostname'] is None: - result['dhcp4_send_hostname'] = False - else: + if result['dhcp4_send_hostname'] is not None: if not result['dhcp4']: raise ValidationError(name, '"dhcp4_send_hostname" is only valid if "dhcp4" is enabled') return result diff --git a/library/test_network_connections.py b/library/test_network_connections.py index 5a8029c..d7c7afc 100755 --- a/library/test_network_connections.py +++ b/library/test_network_connections.py @@ -272,7 +272,7 @@ class TestValidator(unittest.TestCase): 'dns_search': [ 'aa', 'bb' ], 'route_metric6': None, 'ip_is_present': True, - 'dhcp4_send_hostname': False, + 'dhcp4_send_hostname': None, }, 'mac': None, 'master': None,