opentofu/command/clistate
Alisdair McDiarmid 2d1976bbda clistate: Update clistate.Locker for command views
The clistate package includes a Locker interface which provides a simple
way for the local backend to lock and unlock state, while providing
feedback to the user if there is a delay while waiting for the lock.
Prior to this commit, the backend was responsible for initializing the
Locker, passing through direct access to the cli.Ui instance.

This structure prevented commands from implementing different
implementations of the state locker UI. In this commit, we:

- Move the responsibility of creating the appropriate Locker to the
  source of the Operation;
- Add the ability to set the context for a Locker via a WithContext
  method;
- Replace the Locker's cli.Ui and Colorize members with a StateLocker
  view;
- Implement views.StateLocker for human-readable UI;
- Update the Locker interface to return detailed diagnostics instead of
  errors, reducing its direct interactions with UI;
- Add a Timeout() method on Locker to allow the remote backend to
  continue to misuse the -lock-timeout flag to cancel pending runs.

When an Operation is created, the StateLocker field must now be
populated with an implementation of Locker. For situations where locking
is disabled, this can be a no-op locker.

This change has no significant effect on the operation of Terraform,
with the exception of slightly different formatting of errors when state
locking or unlocking fails.
2021-02-16 07:19:22 -05:00
..
local_state_lock_unix.go state: remove deprecated state package (#25490) 2020-08-11 11:43:01 -04:00
local_state_lock_windows.go state: remove deprecated state package (#25490) 2020-08-11 11:43:01 -04:00
local_state.go remove legacy types from command package 2020-12-02 12:33:18 -05:00
state_test.go clistate: Update clistate.Locker for command views 2021-02-16 07:19:22 -05:00
state.go clistate: Update clistate.Locker for command views 2021-02-16 07:19:22 -05:00