restore_config
restore_config
Section titled “restore_config”Restore controller state from a backup_config envelope.
Side effects:
- Diffs the envelope against current controller state and applies an ordered create/delete plan. Deletes run first (firewall_rules, port_forwards, wlans, dhcp_leases, port_profiles, networks); creates run second in the reverse order. No update path in this version: drifted fields show up as a delete + create pair (or stay put when names match).
- Cross-controller restore: if the envelope’s
controllerdiffers from the target, the restore proceeds and the response includes a warning. - Stripped secrets: if
secrets_stripped: true, every restored WLAN whosex_passphrasestill equals the sentinel is forced toenabled=Falseso a known-string SSID is never broadcast. The operator must reset each passphrase and re-enable manually. - Mutates controller state. Use dry_run=True to preview the change without applying.
- Rollback: if any sub-step fails, all prior creates are reverted
in reverse order and the response includes
partialandrolled_backkeys. Deletes that already ran are NOT undone (no copy was kept); the response reports them so the operator can re-run withdry_runto inspect the residual gap.
Schema validation: schema != "1" returns an error envelope and
no action is taken.
Example
Section titled “Example”restore_config(backup_json=snapshot, dry_run=True)Parameters
Section titled “Parameters”| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
backup_json | string | yes | — | The envelope JSON string from backup_config. |
controller | string | no | ”default” | Name of the UniFi controller to target. Defaults to "default". |
dry_run | boolean | no | false | Preview the change without applying it. Returns the predicted change set. |