yahoo-eng-team team mailing list archive
-
yahoo-eng-team team
-
Mailing list archive
-
Message #82734
[Bug 1880177] [NEW] cloud init netplan fails to apply (v2 18.04 cloud image)
Public bug reported:
Hi,
I have been running up against this for a while and haven't found a work around no matter how much I change the format of the source yaml.
Environment:
- vSphere deploying using Terraform and the VMWare Guest Info datasource (https://github.com/vmware/cloud-init-vmware-guestinfo)
- Ubuntu 18.04 Cloud image
- Cloud-init v. 19.4-33-gbb4131a2-0ubuntu1~18.04.1
Issue:
When cloud init tries to apply the network configuration (using v2
syntax) it results in the following error from netplan:
Stderr: /etc/netplan/50-cloud-init.yaml:10:13: Error in network definition: malformed address '10.1.400.140/24', must be X.X.X.X/NN or X:X:X:X:X:X:X:X/NN
- 10.1.400.140/24
It is obvious why the error is happening because when you check the
resulting yaml file it is wrongly indented:
# This file is generated from information provided by the datasource. Changes
# to it will not persist across an instance reboot. To disable cloud-init's
# network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
network:
ethernets:
ens192:
addresses:
- 10.1.1.50/24
dhcp4: false
gateway4: null
nameservers:
addresses: []
set-name: TEST
ens224:
addresses:
- 10.2.2.14/24
dhcp4: false
gateway4: 10.2.2.254
nameservers:
addresses:
- 10.2.2.254
set-name: MGMT
ens256:
addresses:
- 192.168.1.14/24
dhcp4: false
gateway4: 192.168.1.254
nameservers:
addresses:
- 192.168.1.254
set-name: TEST2
version: 2
However the input yaml from the VMware datasource looks correct:
#vmware-rpctool "info-get guestinfo.metadata" | base64 -d
network:
version: 2
ethernets:
ens192:
dhcp4: false
set-name: TEST
addresses: [10.1.1.50/24]
gateway4:
nameservers:
addresses: []
ens224:
dhcp4: false
set-name: MGMT
addresses: [10.2.2.14/24]
gateway4: 10.2.2.254
nameservers:
addresses: [10.2.2.254]
ens256:
dhcp4: false
set-name: TEST2
addresses: [192.168.1.14/24]
gateway4: 192.168.1.254
nameservers:
addresses: [192.168.1.254]
local-hostname: server.mgmt
instance-id: server.mgmt
And cloud init seems to interpret it correctly to json (from cloud-
init.log):
{
'ens192': {
'dhcp4': False,
'set-name': 'TEST',
'addresses': [
'10.1.1.50/24'
],
'gateway4': None,
'nameservers': {
'addresses': [
]
}
},
'ens224': {
'dhcp4': False,
'set-name': 'MGMT',
'addresses': [
'10.2.2.14/24'
],
'gateway4': '10.2.2.254',
'nameservers': {
'addresses': [
'10.2.2.254'
]
}
},
'ens256': {
'dhcp4': False,
'set-name': 'TEST2',
'addresses': [
'192.168.1.14/24'
],
'gateway4': '192.168.1.254',
'nameservers': {
'addresses': [
'192.168.1.254'
]
}
}
}
However it seems the conversion from the json into netplan yaml malforms
the yaml slightly causing the netplan apply to fail. Full Error below
from cloud-init.log
2020-05-22 12:47:12,682 - netplan.py[DEBUG]: V2 to V2 passthrough
2020-05-22 12:47:12,683 - util.py[DEBUG]: Writing to /etc/netplan/50-cloud-init.yaml - wb: [644] 1047 bytes
2020-05-22 12:47:12,684 - util.py[DEBUG]: Running command ['netplan', 'generate'] with allowed return codes [0] (shell=False, capture=True)
2020-05-22 12:47:12,764 - util.py[WARNING]: failed stage init-local
2020-05-22 12:47:12,764 - util.py[DEBUG]: failed stage init-local
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/cloudinit/cmd/main.py", line 653, in status_wrapper
ret = functor(name, args)
File "/usr/lib/python3/dist-packages/cloudinit/cmd/main.py", line 362, in main_init
init.apply_network_config(bring_up=bool(mode != sources.DSMODE_LOCAL))
File "/usr/lib/python3/dist-packages/cloudinit/stages.py", line 710, in apply_network_config
return self.distro.apply_network_config(netcfg, bring_up=bring_up)
File "/usr/lib/python3/dist-packages/cloudinit/distros/__init__.py", line 178, in apply_network_config
dev_names = self._write_network_config(netconfig)
File "/usr/lib/python3/dist-packages/cloudinit/distros/debian.py", line 115, in _write_network_config
return self._supported_write_network_config(netconfig)
File "/usr/lib/python3/dist-packages/cloudinit/distros/__init__.py", line 93, in _supported_write_network_config
renderer.render_network_config(network_config)
File "/usr/lib/python3/dist-packages/cloudinit/net/renderer.py", line 56, in render_network_config
templates=templates, target=target)
File "/usr/lib/python3/dist-packages/cloudinit/net/netplan.py", line 235, in render_network_state
self._netplan_generate(run=self._postcmds)
File "/usr/lib/python3/dist-packages/cloudinit/net/netplan.py", line 242, in _netplan_generate
util.subp(self.NETPLAN_GENERATE, capture=True)
File "/usr/lib/python3/dist-packages/cloudinit/util.py", line 2102, in subp
cmd=args)
cloudinit.util.ProcessExecutionError: Unexpected error while running command.
Command: ['netplan', 'generate']
Exit code: 1
Reason: -
Stdout:
Stderr: /etc/netplan/50-cloud-init.yaml:10:13: Error in network definition: malformed address '10.2.2.14/24', must be X.X.X.X/NN or X:X:X:X:X:X:X:X/NN
- 10.2.2.14/24
** Affects: cloud-init
Importance: Undecided
Status: New
** Attachment added: "cloud-init-logs"
https://bugs.launchpad.net/bugs/1880177/+attachment/5375626/+files/cloud-init-logs
--
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to cloud-init.
https://bugs.launchpad.net/bugs/1880177
Title:
cloud init netplan fails to apply (v2 18.04 cloud image)
Status in cloud-init:
New
Bug description:
Hi,
I have been running up against this for a while and haven't found a work around no matter how much I change the format of the source yaml.
Environment:
- vSphere deploying using Terraform and the VMWare Guest Info datasource (https://github.com/vmware/cloud-init-vmware-guestinfo)
- Ubuntu 18.04 Cloud image
- Cloud-init v. 19.4-33-gbb4131a2-0ubuntu1~18.04.1
Issue:
When cloud init tries to apply the network configuration (using v2
syntax) it results in the following error from netplan:
Stderr: /etc/netplan/50-cloud-init.yaml:10:13: Error in network definition: malformed address '10.1.400.140/24', must be X.X.X.X/NN or X:X:X:X:X:X:X:X/NN
- 10.1.400.140/24
It is obvious why the error is happening because when you check the
resulting yaml file it is wrongly indented:
# This file is generated from information provided by the datasource. Changes
# to it will not persist across an instance reboot. To disable cloud-init's
# network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
network:
ethernets:
ens192:
addresses:
- 10.1.1.50/24
dhcp4: false
gateway4: null
nameservers:
addresses: []
set-name: TEST
ens224:
addresses:
- 10.2.2.14/24
dhcp4: false
gateway4: 10.2.2.254
nameservers:
addresses:
- 10.2.2.254
set-name: MGMT
ens256:
addresses:
- 192.168.1.14/24
dhcp4: false
gateway4: 192.168.1.254
nameservers:
addresses:
- 192.168.1.254
set-name: TEST2
version: 2
However the input yaml from the VMware datasource looks correct:
#vmware-rpctool "info-get guestinfo.metadata" | base64 -d
network:
version: 2
ethernets:
ens192:
dhcp4: false
set-name: TEST
addresses: [10.1.1.50/24]
gateway4:
nameservers:
addresses: []
ens224:
dhcp4: false
set-name: MGMT
addresses: [10.2.2.14/24]
gateway4: 10.2.2.254
nameservers:
addresses: [10.2.2.254]
ens256:
dhcp4: false
set-name: TEST2
addresses: [192.168.1.14/24]
gateway4: 192.168.1.254
nameservers:
addresses: [192.168.1.254]
local-hostname: server.mgmt
instance-id: server.mgmt
And cloud init seems to interpret it correctly to json (from cloud-
init.log):
{
'ens192': {
'dhcp4': False,
'set-name': 'TEST',
'addresses': [
'10.1.1.50/24'
],
'gateway4': None,
'nameservers': {
'addresses': [
]
}
},
'ens224': {
'dhcp4': False,
'set-name': 'MGMT',
'addresses': [
'10.2.2.14/24'
],
'gateway4': '10.2.2.254',
'nameservers': {
'addresses': [
'10.2.2.254'
]
}
},
'ens256': {
'dhcp4': False,
'set-name': 'TEST2',
'addresses': [
'192.168.1.14/24'
],
'gateway4': '192.168.1.254',
'nameservers': {
'addresses': [
'192.168.1.254'
]
}
}
}
However it seems the conversion from the json into netplan yaml
malforms the yaml slightly causing the netplan apply to fail. Full
Error below from cloud-init.log
2020-05-22 12:47:12,682 - netplan.py[DEBUG]: V2 to V2 passthrough
2020-05-22 12:47:12,683 - util.py[DEBUG]: Writing to /etc/netplan/50-cloud-init.yaml - wb: [644] 1047 bytes
2020-05-22 12:47:12,684 - util.py[DEBUG]: Running command ['netplan', 'generate'] with allowed return codes [0] (shell=False, capture=True)
2020-05-22 12:47:12,764 - util.py[WARNING]: failed stage init-local
2020-05-22 12:47:12,764 - util.py[DEBUG]: failed stage init-local
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/cloudinit/cmd/main.py", line 653, in status_wrapper
ret = functor(name, args)
File "/usr/lib/python3/dist-packages/cloudinit/cmd/main.py", line 362, in main_init
init.apply_network_config(bring_up=bool(mode != sources.DSMODE_LOCAL))
File "/usr/lib/python3/dist-packages/cloudinit/stages.py", line 710, in apply_network_config
return self.distro.apply_network_config(netcfg, bring_up=bring_up)
File "/usr/lib/python3/dist-packages/cloudinit/distros/__init__.py", line 178, in apply_network_config
dev_names = self._write_network_config(netconfig)
File "/usr/lib/python3/dist-packages/cloudinit/distros/debian.py", line 115, in _write_network_config
return self._supported_write_network_config(netconfig)
File "/usr/lib/python3/dist-packages/cloudinit/distros/__init__.py", line 93, in _supported_write_network_config
renderer.render_network_config(network_config)
File "/usr/lib/python3/dist-packages/cloudinit/net/renderer.py", line 56, in render_network_config
templates=templates, target=target)
File "/usr/lib/python3/dist-packages/cloudinit/net/netplan.py", line 235, in render_network_state
self._netplan_generate(run=self._postcmds)
File "/usr/lib/python3/dist-packages/cloudinit/net/netplan.py", line 242, in _netplan_generate
util.subp(self.NETPLAN_GENERATE, capture=True)
File "/usr/lib/python3/dist-packages/cloudinit/util.py", line 2102, in subp
cmd=args)
cloudinit.util.ProcessExecutionError: Unexpected error while running command.
Command: ['netplan', 'generate']
Exit code: 1
Reason: -
Stdout:
Stderr: /etc/netplan/50-cloud-init.yaml:10:13: Error in network definition: malformed address '10.2.2.14/24', must be X.X.X.X/NN or X:X:X:X:X:X:X:X/NN
- 10.2.2.14/24
To manage notifications about this bug go to:
https://bugs.launchpad.net/cloud-init/+bug/1880177/+subscriptions
Follow ups