diff --git a/confluent_server/confluent/config/attributes.py b/confluent_server/confluent/config/attributes.py index 2165538c..42fd6beb 100644 --- a/confluent_server/confluent/config/attributes.py +++ b/confluent_server/confluent/config/attributes.py @@ -484,4 +484,7 @@ node = { 'description': ('Fingerprint of the SSH key of the OS running on the ' 'system.'), }, + 'services.dns': { + 'description': 'DNS Server or servers to provide to node', + }, } diff --git a/confluent_server/confluent/selfservice.py b/confluent_server/confluent/selfservice.py index df7774e7..1c48bca7 100644 --- a/confluent_server/confluent/selfservice.py +++ b/confluent_server/confluent/selfservice.py @@ -59,7 +59,8 @@ def handle_request(env, start_response): ncfg = netutil.get_nic_config(cfg, nodename, serverip=myip) if ncfg['prefix']: ncfg['ipv4_netmask'] = netutil.cidr_to_mask(ncfg['prefix']) - deployinfo = cfg.get_node_attributes(nodename, ('deployment.*', 'crypted.rootpassword')) + deployinfo = cfg.get_node_attributes( + nodename, ('deployment.*', 'crypted.rootpassword', 'services.*')) deployinfo = deployinfo.get(nodename, {}) profile = deployinfo.get( 'deployment.pendingprofile', {}).get('value', '') @@ -85,6 +86,10 @@ def handle_request(env, start_response): currtzvintage = time.time() ncfg['timezone'] = currtz break + ncfg['nameservers'] = [] + for dns in deployinfo.get( + 'services.dns', {}).get('value', '').split(','): + ncfg['nameservers'].append(dns) start_response('200 OK', (('Content-Type', retype),)) yield dumper(ncfg) elif env['PATH_INFO'] == '/self/sshcert': diff --git a/misc/confluent-initqueue.sh.rh8 b/misc/confluent-initqueue.sh.rh8 index 41fc30b6..74e44d22 100644 --- a/misc/confluent-initqueue.sh.rh8 +++ b/misc/confluent-initqueue.sh.rh8 @@ -60,4 +60,18 @@ else v4nm=${v4nm#ipv4_netmask: } echo ip=$v4addr::$v4gw:$v4nm:$nodename:$ifname:none >> /etc/cmdline.d/01-confluent.conf fi +nameserversec=0 +while read -r entry; do + if [ $nameserversec = 1 ]; then + if [[ $entry == "-"* ]]; then + echo nameserver=${entry#- } >> /etc/cmdline.d/01-confluent.conf + continue + fi + fi + nameserversec=0 + if [ ${entry%:*} = "nameservers" ]; then + nameserversec=1 + continue + fi +done < /tmp/confluent.deploycfg