Skip to main content

Upload history and rollback

Every config upload and config transfer records an upload cache: what was uploaded, and what the destination looked like before. ewx-cli config upload-history lists, inspects and reverts those caches. Recording can be disabled per run with --no-history-cache, and a cache can be labelled with --name.

Listing caches​

ewx-cli config upload-history list # everything
ewx-cli config upload-history list --days 7 # last week
Wed Jul 5 09:03:53 2023 | demo/enrx_org_002 -> demo/enrx_org_001
Wed Jul 5 10:03:53 2023 | demo/enrx_org_001 -> demo/enrx_org_002 (name: test_transfer)
Wed Jul 5 12:03:53 2023 | LOCAL -> demo/enrx_org_002

LOCAL means the source was a local directory (config upload).

Filtering with patterns​

inspect, revert and purge take up to three pattern arguments. Their meaning depends on how many you give:

ArgumentsInterpreted as
noneall caches
<name>substring of the cache name
<source> <destination>source and destination namespace
<source> <destination> <name>both namespaces and a name substring

? means "any", a bare project prefix matches every namespace of that project, and namespace aliases are accepted:

ewx-cli config upload-history inspect ? # any named cache
ewx-cli config upload-history inspect demo ? # any cache with demo as source project
ewx-cli config upload-history inspect LOCAL ? # uploads from a local directory
ewx-cli config upload-history inspect ? demo/enrx_org_002 test # into enrx_org_002, name contains "test"

The command lists the matching caches, you pick one by number, and inspect prints the same overview the upload showed, plus whether the cache can still be used to revert.

Reverting an upload​

ewx-cli config upload-history revert demo/enrx_org_001 demo/enrx_org_002

After picking a cache the CLI verifies the revert is safe, then shows the plan and asks for confirmation:

CHANNEL CLASSIFIERS
======================
AIR_PRESSURE -> Revert

FLOWS
=====================================================
test_flow (ID: 5669265948540928) -> Remove

RULES
=====================================
chain_flow -> Revert

-> Do you wish to continue? [y/N]:

Revert restores a configuration to its state before the upload; Remove deletes a configuration the upload created. A cache cannot be used to revert when:

  • a configuration from the upload no longer exists on the destination,
  • a configuration gained dependencies that did not exist at upload time,
  • a configuration was modified since the upload,
  • reverting would leave broken dependencies, or
  • the upload was reverted before.

The verification can take a while; the CLI says so while it runs. A reverted cache stays inspectable but cannot be reverted again. --dry-run runs all checks and prints the plan without changing anything, leaving the cache usable.

Cleaning up​

ewx-cli config upload-history purge <patterns> deletes caches matching the same pattern rules.