diff options
author | Christian Poessinger <christian@poessinger.com> | 2019-02-16 15:31:28 +0100 |
---|---|---|
committer | Daniil Baturin <daniil@baturin.org> | 2019-05-20 06:11:02 +0200 |
commit | 8bd504636bb978c2fdeda088e81b5e9a897a34d7 (patch) | |
tree | 175e7be48916661e1cb1cc6834bbb2c9c84c83d2 /src/conf_mode | |
parent | b657528166b30cb8030396172128fff39ef82fd1 (diff) | |
download | vyos-1x-8bd504636bb978c2fdeda088e81b5e9a897a34d7.tar.gz vyos-1x-8bd504636bb978c2fdeda088e81b5e9a897a34d7.zip |
hostname: additional test case fixes
Conflicts:
src/tests/test_host_name.py
Diffstat (limited to 'src/conf_mode')
-rwxr-xr-x | src/conf_mode/host_name.py | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/conf_mode/host_name.py b/src/conf_mode/host_name.py index 4b6ce76b0..0f8d3b719 100755 --- a/src/conf_mode/host_name.py +++ b/src/conf_mode/host_name.py @@ -35,7 +35,6 @@ config_file_hosts = '/etc/hosts' config_file_resolv = '/etc/resolv.conf' config_tmpl_hosts = """ -### Autogenerated by host_name.py ### 127.0.0.1 localhost {{ hostname }}{% if domain_name %}.{{ domain_name }}{% endif %} # The following lines are desirable for IPv6 capable hosts @@ -85,7 +84,6 @@ default_config_data = { } def get_config(): - """Get configuration""" conf = Config() hosts = copy.deepcopy(default_config_data) @@ -102,8 +100,8 @@ def get_config(): return hosts def verify(config): - """Verify configuration""" - # check for invalid host + if config is None: + return None # pattern $VAR(@) "^[[:alnum:]][-.[:alnum:]]*[[:alnum:]]$" ; "invalid host name $VAR(@)" hostname_regex = re.compile("^[A-Za-z0-9][-.A-Za-z0-9]*[A-Za-z0-9]$") @@ -128,7 +126,6 @@ def verify(config): return None def generate(config): - """Generate configuration files""" if config is None: return None @@ -158,7 +155,9 @@ def generate(config): return None def apply(config): - """Apply configuration""" + if config is None: + return None + fqdn = config['hostname'] if config['domain_name']: fqdn += '.' + config['domain_name'] |