mirror of
https://github.com/xcat2/confluent.git
synced 2024-11-21 17:11:58 +00:00
Add ipv6 support to genesis
This commit is contained in:
parent
a4de3b93ec
commit
8eb242cba0
@ -121,7 +121,7 @@ class HTTPSClient(client.HTTPConnection, object):
|
||||
authed = False
|
||||
rsp.read()
|
||||
with open('/etc/confluent/confluent.apikey', 'w+') as akfile:
|
||||
akfile.write()
|
||||
akfile.write('')
|
||||
self.stdheaders['CONFLUENT_APIKEY'] = get_apikey(
|
||||
self.node, self.host)
|
||||
raise Exception(rsp.read())
|
||||
|
@ -99,13 +99,30 @@ tpm2_pcrextend 15:sha256=2fbe96c50dde38ce9cd2764ddb79c216cfbcd3499568b1125450e60
|
||||
ifidx=$(cat /tmp/confluent.ifidx)
|
||||
ifname=$(ip link |grep ^$ifidx:|awk '{print $2}')
|
||||
ifname=${ifname%:}
|
||||
autoconfigmethod=$(grep ipv6_method /etc/confluent/confluent.deploycfg |awk '{print $2}')
|
||||
if [ "$autoconfigmethod" = "static" ]; then
|
||||
ipaddr=$(grep ^ipv6_address: /etc/confluent/confluent.deploycfg)
|
||||
ipaddr=${ipaddr#ipv6_address: }
|
||||
ipgw=$(grep ^ipv6_gateway: /etc/confluent/confluent.deploycfg)
|
||||
ipgw=${ipgw#ipv6_gateway: }
|
||||
if [ "$ipgw" = "null" ]; then
|
||||
ipgw=""
|
||||
fi
|
||||
ipnm=$(grep ^prefix: /etc/confluent/confluent.deploycfg)
|
||||
ipnm=${ipnm#prefix: }
|
||||
echo "Setting up $ifname as static at $ipaddr/$ipnm"
|
||||
ip addr add dev $ifname $ipaddr/$ipnm
|
||||
if [ ! -z "$ipgw" ]; then
|
||||
ip route add default via $ipgw
|
||||
fi
|
||||
fi
|
||||
autoconfigmethod=$(grep ipv4_method /etc/confluent/confluent.deploycfg |awk '{print $2}')
|
||||
if [ "$autoconfigmethod" = "dhcp" ]; then
|
||||
echo -n "Attempting to use dhcp to bring up $ifname..."
|
||||
dhclient $ifname
|
||||
echo "Complete:"
|
||||
ip addr show dev $ifname
|
||||
else
|
||||
elif [ "$autocinfigmethtod" = "static" ]; then
|
||||
v4addr=$(grep ^ipv4_address: /etc/confluent/confluent.deploycfg)
|
||||
v4addr=${v4addr#ipv4_address: }
|
||||
v4gw=$(grep ^ipv4_gateway: /etc/confluent/confluent.deploycfg)
|
||||
|
@ -204,7 +204,7 @@ def snoop(handler, byehandler=None, protocol=None, uuidlookup=None):
|
||||
msecs = int(currtime * 1000 % 1000)
|
||||
reply = 'HTTP/1.1 200 OK\r\nNODENAME: {0}\r\nCURRTIME: {1}\r\nCURRMSECS: {2}\r\n'.format(node, seconds, msecs)
|
||||
if '%' in peer[0]:
|
||||
iface = peer[0].split('%', 1)[1]
|
||||
iface = socket.getaddrinfo(peer[0], 0, socket.AF_INET6, socket.SOCK_DGRAM)[0][-1][-1]
|
||||
reply += 'MGTIFACE: {0}\r\n'.format(
|
||||
peer[0].split('%', 1)[1])
|
||||
ncfg = netutil.get_nic_config(
|
||||
|
@ -110,7 +110,13 @@ def handle_request(env, start_response):
|
||||
yield dumper(res)
|
||||
elif env['PATH_INFO'] == '/self/deploycfg':
|
||||
if 'HTTP_CONFLUENT_MGTIFACE' in env:
|
||||
ncfg = netutil.get_nic_config(cfg, nodename, ifidx=env['HTTP_CONFLUENT_MGTIFACE'])
|
||||
nicname = env['HTTP_CONFLUENT_MGTIFACE']
|
||||
try:
|
||||
ifidx = int(nicname)
|
||||
except ValueError:
|
||||
with open('/sys/class/net/{}/ifindex'.format(nicname), 'r') as nici:
|
||||
ifidx = int(nici.read())
|
||||
ncfg = netutil.get_nic_config(cfg, nodename, ifidx=ifidx)
|
||||
else:
|
||||
myip = env.get('HTTP_X_FORWARDED_HOST', None)
|
||||
if ']' in myip:
|
||||
@ -158,7 +164,7 @@ def handle_request(env, start_response):
|
||||
continue
|
||||
k, v = line.split('=', 1)
|
||||
if k == 'KEYMAP':
|
||||
keymap = v
|
||||
keymap = v.replace('"', '')
|
||||
needlocalectl = False
|
||||
if not needlocalectl:
|
||||
needlocalectl = True
|
||||
@ -176,7 +182,7 @@ def handle_request(env, start_response):
|
||||
k, v = line.split('=', 1)
|
||||
if k == 'LANG':
|
||||
needlocalectl = False
|
||||
currlocale = v
|
||||
currlocale = v.replace('"', '')
|
||||
except IOError:
|
||||
pass
|
||||
if needlocalectl:
|
||||
|
Loading…
Reference in New Issue
Block a user