cloudinit-userdata doesn't handle lists in runcmd properly

Bug #1759398 reported by Heather Lanigan
18
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Canonical Juju
Fix Released
Critical
Ben Hoyt

Bug Description

Doesn't work:
$ cat cloudinit-userdata.yaml
cloudinit-userdata: |
  write_files:
  - content: |
        net.ipv4.conf.all.rp_filter=2
        net.ipv4.conf.default.rp_filter=2
    path: /etc/sysctl.d/99-rp_filter.conf
  postruncmd:
  - [ "sysctl", "-p", "/etc/sysctl.d/99-rp_filter.conf" ]

Replacing the last line does work:
 - sysctl -p /etc/sysctl.d/99-rp_filter.conf

We're forcing pre and post runcmds to be strings. Per the cloudinit docs
(http://cloudinit.readthedocs.io/en/latest/topics/examples.html#run-commands-on-first-boot)
they can also be a list of strings.

Tags: cpe-onsite
Changed in juju:
status: New → Triaged
importance: Undecided → Medium
tags: added: cpe-onsite
Revision history for this message
Felipe Reyes (freyes) wrote :
Download full text (6.8 KiB)

I'm running juju 2.9.34 and jujud is crashing because this reason:

022-08-29 18:43:02 DEBUG juju.cloudconfig.cloudinit network_ubuntu.go:147 generating netplan from network.InterfaceInfos{network.InterfaceInfo{DeviceIndex:0, MACAddress:"00:16:3e:7a:f2:c3", ProviderId:"",
 ProviderSubnetId:"", ProviderNetworkId:"", ProviderSpaceId:"", ProviderVLANId:"", ProviderAddressId:"", AvailabilityZones:[]string(nil), VLANTag:0, InterfaceName:"eth0", ParentInterfaceName:"br11", Interf
aceType:"", Disabled:false, NoAutoStart:false, ConfigType:"dhcp", Addresses:network.ProviderAddresses(nil), ShadowAddresses:network.ProviderAddresses(nil), DNSServers:network.ProviderAddresses(nil), MTU:0,
 DNSSearchDomains:[]string(nil), GatewayAddress:, Routes:[]network.Route(nil), IsDefaultGateway:false, VirtualPortType:"", Origin:"provider"}, network.InterfaceInfo{DeviceIndex:0, MACAddress:"00:16:3e:97:e
b:16", ProviderId:"", ProviderSubnetId:"", ProviderNetworkId:"", ProviderSpaceId:"", ProviderVLANId:"", ProviderAddressId:"", AvailabilityZones:[]string(nil), VLANTag:0, InterfaceName:"eth1", ParentInterfa
ceName:"br11", InterfaceType:"", Disabled:false, NoAutoStart:false, ConfigType:"dhcp", Addresses:network.ProviderAddresses(nil), ShadowAddresses:network.ProviderAddresses(nil), DNSServers:network.ProviderA
ddresses(nil), MTU:0, DNSSearchDomains:[]string(nil), GatewayAddress:, Routes:[]network.Route(nil), IsDefaultGateway:false, VirtualPortType:"", Origin:"provider"}}
2022-08-29 18:43:02 DEBUG juju.service discovery.go:67 discovered init system "systemd" from series "focal"
panic: interface conversion: interface {} is []interface {}, not string

goroutine 5734 [running]:
github.com/juju/juju/cloudconfig.(*unixConfigure).ConfigureJuju(0xc000a9f4d0)
        /build/snapcraft-juju-89be21f465fb3a03c6faac0678176741/parts/juju/build/cloudconfig/userdatacfg_unix.go:260 +0x16a7
github.com/juju/juju/cloudconfig.(*unixConfigure).Configure(0xc000eb2300?)
        /build/snapcraft-juju-89be21f465fb3a03c6faac0678176741/parts/juju/build/cloudconfig/userdatacfg_unix.go:130 +0x2f
github.com/juju/juju/cloudconfig/providerinit.configureCloudinit(0xc000eb2300, {0x622b1c8?, 0xc0019f2c60?})
        /build/snapcraft-juju-89be21f465fb3a03c6faac0678176741/parts/juju/build/cloudconfig/providerinit/providerinit.go:38 +0xb7
github.com/juju/juju/cloudconfig/providerinit.ComposeUserData(0xc000eb2300, {0x622b1c8?, 0xc0019f2c60?}, {0x61a7f00, 0x91251f8})
        /build/snapcraft-juju-89be21f465fb3a03c6faac0678176741/parts/juju/build/cloudconfig/providerinit/providerinit.go:60 +0x8f
github.com/juju/juju/provider/lxd.(*environ).getContainerSpec(_, {_, {_, _}}, {_, _}, {{0xc002bad890, 0x24}, {0x0, 0x0, ...}, ...})
        /build/snapcraft-juju-89be21f465fb3a03c6faac0678176741/parts/juju/build/provider/lxd/environ_broker.go:219 +0x4f1
github.com/juju/juju/provider/lxd.(*environ).newContainer(_, {_, _}, {{0xc002bad890, 0x24}, {0x0, 0x0, 0x0, 0x0, 0x0, ...}, ...}, ...)
        /build/snapcraft-juju-89be21f465fb3a03c6faac0678176741/parts/juju/build/provider/lxd/environ_broker.go:121 +0x35e
github.com/juju/juju/provider/lxd.(*environ).StartInstance(_, {_, _}, {{0xc002bad890, 0x24}, {0x0, 0x0, 0x0, 0x0, 0x0, ...

Read more...

Revision history for this message
Ian Booth (wallyworld) wrote :

Changing to critical due to the panic

Changed in juju:
milestone: none → 2.9.34
importance: Medium → Critical
Ben Hoyt (benhoyt)
Changed in juju:
assignee: nobody → Ben Hoyt (benhoyt)
Revision history for this message
Ben Hoyt (benhoyt) wrote :
Ben Hoyt (benhoyt)
Changed in juju:
status: Triaged → Fix Committed
Changed in juju:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.