Make every VM create announce itself

Defect

just lab up printed nothing when it created a VM and the notification never appeared. notify_vm_up returned at once when SIM_NOTIFY_CMD was unset, with no log line, so a skipped alert left no trace. The OpenShift Local lane never called it at all.

Fix

Every create now logs VM up: <instance>, <base>, <machine type>, down by <time> and then raises a notification: SIM_NOTIFY_CMD when set, else notify-send, else osascript. If none exists, the log line says so. A notifier failure or output is logged and never fails up. The title is the owner (or gitlab-simulation when none is set) followed by : VM up. Both lanes share one announce_vm_up in gce/notify.sh.

sequenceDiagram
    participant U as just lab up
    participant N as announce_vm_up
    participant C as notifier
    U->>N: VM exists (instance, base, type, down by)
    N->>N: log VM up line
    alt SIM_NOTIFY_CMD set
        N->>C: run it with title and body
    else notify-send or osascript on PATH
        N->>C: run the default
    else none
        N->>N: log that the line is the only announcement
    end
    C-->>N: failure or output is logged, up continues

Proof

  • tests/run.sh: 632 passed, 0 failed. New cases cover an unset SIM_NOTIFY_CMD with a stub notify-send on PATH, an unset one with no notifier (logs the line and the reason), and the OpenShift Local lane calling announce_vm_up.
  • gce/engine-selftest.sh passes. With the previous engine files the new notify cases fail and with this change they pass.
Edited by Andrew Dunn

Merge request reports

Loading
Loading