diff options
author | James Falcon <therealfalcon@gmail.com> | 2021-08-13 15:34:16 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-13 15:34:16 -0500 |
commit | 65607405aed2fb5e7797bb181dc947025c10f346 (patch) | |
tree | 2b01bb7804682a5c16bcd2bfda81efb3c610bcf1 /tools | |
parent | f516a7d37c1654addc02485e681b4358d7e7c0db (diff) | |
download | vyos-cloud-init-65607405aed2fb5e7797bb181dc947025c10f346.tar.gz vyos-cloud-init-65607405aed2fb5e7797bb181dc947025c10f346.zip |
Only invoke hotplug socket when functionality is enabled (#952)
Alters hotplug hook to have a query mechanism checking if the
functionality is enabled. This allows us to avoid using the hotplug
socket and service when hotplug is disabled.
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/hook-hotplug | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/tools/hook-hotplug b/tools/hook-hotplug index 34e95929..ced268b3 100755 --- a/tools/hook-hotplug +++ b/tools/hook-hotplug @@ -8,12 +8,17 @@ is_finished() { [ -e /run/cloud-init/result.json ] } -if is_finished; then +hotplug_enabled() { + [ "$(cloud-init devel hotplug-hook -s "${SUBSYSTEM}" query)" == "enabled" ] +} + +if is_finished && hotplug_enabled; then # open cloud-init's hotplug-hook fifo rw exec 3<>/run/cloud-init/hook-hotplug-cmd env_params=( - --devpath="${DEVPATH}" --subsystem="${SUBSYSTEM}" + handle + --devpath="${DEVPATH}" --udevaction="${ACTION}" ) # write params to cloud-init's hotplug-hook fifo |