summaryrefslogtreecommitdiff
path: root/src/conf_mode/host_name.py
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2019-02-16 15:31:28 +0100
committerChristian Poessinger <christian@poessinger.com>2019-02-16 15:31:28 +0100
commit63fa48bd836c8268e48108592987b63abdaef5d0 (patch)
tree9ef52dcad50caeab6908b2b310b445f9c0b46dd4 /src/conf_mode/host_name.py
parent18a76f695e44079e638ffc86799e6cb952810316 (diff)
downloadvyos-1x-63fa48bd836c8268e48108592987b63abdaef5d0.tar.gz
vyos-1x-63fa48bd836c8268e48108592987b63abdaef5d0.zip
hostname: additional test case fixes
Diffstat (limited to 'src/conf_mode/host_name.py')
-rwxr-xr-xsrc/conf_mode/host_name.py11
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']