| 1 | # Paired with cloud-init-hotplugd.socket to read from the FIFO |
| 2 | # hook-hotplug-cmd which is created during a udev network |
| 3 | # add or remove event as processed by 90-cloud-init-hook-hotplug.rules. |
| 4 | |
| 5 | # On start, read args from the FIFO, process and provide structured arguments |
| 6 | # to `cloud-init devel hotplug-hook` which will setup or teardown network |
| 7 | # devices as configured by user-data. |
| 8 | |
| 9 | # Known bug with an enforcing SELinux policy: LP: #1936229 |
| 10 | # cloud-init-hotplud.service will read args from file descriptor 3 |
| 11 | |
| 12 | [Unit] |
| 13 | Description=Cloud-init: Hotplug Hook |
| 14 | After=cloud-init-hotplugd.socket |
| 15 | After=cloud-init.target |
| 16 | Requires=cloud-init-hotplugd.socket |
| 17 | ConditionPathExists=!/etc/cloud/cloud-init.disabled |
| 18 | ConditionKernelCommandLine=!cloud-init=disabled |
| 19 | ConditionEnvironment=!KERNEL_CMDLINE=cloud-init=disabled |
| 20 | |
| 21 | [Service] |
| 22 | Type=oneshot |
| 23 | ExecStart=/bin/bash -c 'read args <&3; echo "args=$args"; \ |
| 24 | exec /usr/bin/cloud-init devel hotplug-hook $args; \ |
| 25 | exit 0' |
| 26 | SyslogIdentifier=cloud-init-hotplugd |
| 27 | TimeoutStopSec=5 |