summaryrefslogtreecommitdiff
path: root/src/conf_mode
diff options
context:
space:
mode:
Diffstat (limited to 'src/conf_mode')
-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']