bug: add error handling for missing state lock config in S3, HTTP and OSS backends (#1977)

Signed-off-by: g0dfl3sh <alex1trendler@gmail.com>
Signed-off-by: Alexandru Trendler <117138249+g0dfl3sh@users.noreply.github.com>
Co-authored-by: Oleksandr Levchenkov <ollevche@gmail.com>
This commit is contained in:
Alexandru Trendler
2024-09-20 19:29:36 +03:00
committed by GitHub
parent a9d1af85a9
commit 48abc52e46
12 changed files with 274 additions and 0 deletions

View File

@@ -95,6 +95,15 @@ func (c *UnlockCommand) Run(args []string) int {
_, isLocal := stateMgr.(*statemgr.Filesystem)
if optionalLocker, ok := stateMgr.(statemgr.OptionalLocker); ok {
// Now we can safely call IsLockingEnabled() on optionalLocker
if !optionalLocker.IsLockingEnabled() {
c.Ui.Error("Locking is disabled for this backend")
return 1
}
}
// Proceed with unlocking logic if locking is enabled
if !force {
// Forcing this doesn't do anything, but doesn't break anything either,
// and allows us to run the basic command test too.