canonical / cloud-init

Official upstream for the cloud-init: cloud instance initialization

Home Page:https://cloud-init.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

cloud-init-hotplugd.{service,socket} error: argument -s/--subsystem: invalid choice: '"net"'

aciba90 opened this issue · comments

Bug report

Cloud-init's hotplugd socket / service dance fails with the following error when adding a new NIC and cloud-init devel hoplug-hook handle is not triggered:

● cloud-init-hotplugd.service - cloud-init hotplug hook daemon
     Loaded: loaded (/lib/systemd/system/cloud-init-hotplugd.service; static; vendor preset: enabled)
     Active: failed (Result: exit-code) since Thu 2024-02-15 10:11:02 UTC; 5min ago
TriggeredBy: ● cloud-init-hotplugd.socket
    Process: 1198 ExecStart=/bin/bash -c read args <&3; echo "args=$args";                          exec /usr/bin/cloud-init devel hotplug-hook $args;                          exit 0 (code=exited, status=2)
   Main PID: 1198 (code=exited, status=2)

Feb 15 10:11:01 ip-192-168-6-156 systemd[1]: Started cloud-init hotplug hook daemon.
Feb 15 10:11:01 ip-192-168-6-156 cloud-init-hotplugd[1198]: args=--subsystem="net"         handle         --devpath="/devices/pci0000:00/0000:00:06.0/net/ens6"         --udevaction="add"
Feb 15 10:11:02 ip-192-168-6-156 cloud-init-hotplugd[1198]: usage: /usr/bin/cloud-init devel hotplug-hook [-h] -s {net} {query,handle} ...
Feb 15 10:11:02 ip-192-168-6-156 cloud-init-hotplugd[1198]: /usr/bin/cloud-init devel hotplug-hook: error: argument -s/--subsystem: invalid choice: '"net"' (choose from 'net')
Feb 15 10:11:02 ip-192-168-6-156 systemd[1]: cloud-init-hotplugd.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
Feb 15 10:11:02 ip-192-168-6-156 systemd[1]: cloud-init-hotplugd.service: Failed with result 'exit-code'.

I think the culprit might be the latest changes on hook-hotplug: #4772

Steps to reproduce the problem

  • Launch an instance with hotplug enabled.
  • Add NIC.
  • systemctl status cloud-init-hoplugd.service

The following test triggers the issue:

CLOUD_INIT_CLOUD_INIT_SOURCE=<cloud-init-from-tip-of-main.deb> CLOUD_INIT_PLATFORM= ec2 CLOUD_INIT_OS_IMAGE=focal tox -e integration-tests -- --pdb tests/integration_tests/modules/test_hotplug.py::test_multi_nic_hotplug

Environment details

  • Cloud-init version: tip of main.
  • Operating System Distribution: Ubuntu Focal.
  • Cloud provider, platform or installer type: AWS.

cloud-init logs

cloud-init.tar.gz

For #4772 the quotes were already present in the original code but I escaped them as they were, after my change, inside of other quotes.

I guess you're right that these variables don't need to be/shouldn't be quoted as they contain only single-word values (i.e. no spaces to cause the Shell to othewise split them up).