1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
--- a/cloudinit/net/cmdline.py
+++ b/cloudinit/net/cmdline.py
@@ -86,7 +86,7 @@
else:
proto = 'static'
- if proto not in ('static', 'dhcp'):
+ if proto not in ('static', 'dhcp', 'dhcp6'):
raise ValueError("Unexpected value for PROTO: %s" % proto)
iface = {
@@ -98,12 +98,15 @@
if name in mac_addrs:
iface['mac_address'] = mac_addrs[name]
- # originally believed there might be IPV6* values
- for v, pre in (('ipv4', 'IPV4'),):
+ # Handle both IPv4 and IPv6 values
+ for v, pre in (('ipv4', 'IPV4'), ('ipv6', 'IPV6')):
# if no IPV4ADDR or IPV6ADDR, then go on.
if pre + "ADDR" not in data:
continue
- subnet = {'type': proto, 'control': 'manual'}
+ if pre + "PROTO" in data:
+ subnet = {'type': data[pre + 'PROTO'], 'control': 'manual'}
+ else:
+ subnet = {'type': proto, 'control': 'manual'}
# these fields go right on the subnet
for key in ('NETMASK', 'BROADCAST', 'GATEWAY'):
|