mirror of
https://github.com/xcat2/confluent.git
synced 2024-12-25 12:41:39 +00:00
Add DNS information
Enable setting DNS servers in the deployment.
This commit is contained in:
parent
21327af140
commit
149e41c33c
@ -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',
|
||||
},
|
||||
}
|
||||
|
@ -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':
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user