mirror of
https://github.com/opentofu/opentofu.git
synced 2026-02-18 18:17:54 -05:00
Ensure that the state locking is configured correctly
This is necessary because calling the Meta.extendedFlagSet was having this side-effect to set the stateLock=true. Now that we move away from it but we still don't have a unified way to handle the default cases for the stateLocking attributes, we will do this for the moment and unify it later. Signed-off-by: Andrei Ciobanu <andrei.ciobanu@opentofu.org>
This commit is contained in:
parent
e0fb51030b
commit
ac0c8f1777
2 changed files with 12 additions and 0 deletions
|
|
@ -65,6 +65,13 @@ func (c *ConsoleCommand) Run(rawArgs []string) int {
|
|||
// operation, but there is no clear path to pass this value down, so we
|
||||
// continue to mutate the Meta object state for now.
|
||||
c.Meta.input = args.ViewOptions.InputEnabled
|
||||
|
||||
// TODO meta-refactor: when the stateLock and stateLockTimeout are extracted to be configured separately, remove
|
||||
// these and use a common way to configure this
|
||||
// The stateLock=true is here this way because this command used before meta.extendedFlagSet which did the same
|
||||
// and left for the command to configure flags for this if needed.
|
||||
c.Meta.stateLock = true
|
||||
|
||||
c.GatherVariables(args.Vars)
|
||||
|
||||
configPath := c.WorkingDir.NormalizePath(c.WorkingDir.RootModuleDir())
|
||||
|
|
|
|||
|
|
@ -115,6 +115,11 @@ func TestConsole_multiline_interactive(t *testing.T) {
|
|||
if diff := cmp.Diff(got, tc.expected); diff != "" {
|
||||
t.Fatalf("unexpected output. For input: %s\n%s", tc.input, diff)
|
||||
}
|
||||
|
||||
// TODO meta-refactor: remove this assertion once the stateLock from Meta is removed
|
||||
if !c.Meta.stateLock {
|
||||
t.Errorf("stateLock should always be nil for this command")
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue