mirror of
https://github.com/opentffoundation/opentf.git
synced 2025-12-25 01:00:16 -05:00
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:
committed by
GitHub
parent
a9d1af85a9
commit
48abc52e46
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user