summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xcloudinit/net/cmdline.py12
-rw-r--r--tests/unittests/test_net.py2
2 files changed, 10 insertions, 4 deletions
diff --git a/cloudinit/net/cmdline.py b/cloudinit/net/cmdline.py
index bfb40aae..64e1c699 100755
--- a/cloudinit/net/cmdline.py
+++ b/cloudinit/net/cmdline.py
@@ -101,9 +101,12 @@ def _klibc_to_config_entry(content, mac_addrs=None):
provided here. There is no good documentation on this unfortunately.
DEVICE=<name> is expected/required and PROTO should indicate if
- this is 'static' or 'dhcp' or 'dhcp6' (LP: #1621507).
+ this is 'none' (static) or 'dhcp' or 'dhcp6' (LP: #1621507).
note that IPV6PROTO is also written by newer code to address the
possibility of both ipv4 and ipv6 getting addresses.
+
+ Full syntax is documented at:
+ https://git.kernel.org/pub/scm/libs/klibc/klibc.git/plain/usr/kinit/ipconfig/README.ipconfig
"""
if mac_addrs is None:
@@ -122,9 +125,9 @@ def _klibc_to_config_entry(content, mac_addrs=None):
if data.get('filename'):
proto = 'dhcp'
else:
- proto = 'static'
+ proto = 'none'
- if proto not in ('static', 'dhcp', 'dhcp6'):
+ if proto not in ('none', 'dhcp', 'dhcp6'):
raise ValueError("Unexpected value for PROTO: %s" % proto)
iface = {
@@ -144,6 +147,9 @@ def _klibc_to_config_entry(content, mac_addrs=None):
# PROTO for ipv4, IPV6PROTO for ipv6
cur_proto = data.get(pre + 'PROTO', proto)
+ # ipconfig's 'none' is called 'static'
+ if cur_proto == 'none':
+ cur_proto = 'static'
subnet = {'type': cur_proto, 'control': 'manual'}
# only populate address for static types. While the rendered config
diff --git a/tests/unittests/test_net.py b/tests/unittests/test_net.py
index 01119e0a..001ad010 100644
--- a/tests/unittests/test_net.py
+++ b/tests/unittests/test_net.py
@@ -81,7 +81,7 @@ DHCP6_EXPECTED_1 = {
STATIC_CONTENT_1 = """
DEVICE='eth1'
-PROTO='static'
+PROTO='none'
IPV4ADDR='10.0.0.2'
IPV4BROADCAST='10.0.0.255'
IPV4NETMASK='255.255.255.0'