mirror of
https://github.com/opentffoundation/opentf.git
synced 2025-12-25 01:00:16 -05:00
backend: Backend.StateMgr takes context.Context
This adds a new context.Context argument to the Backend.StateMgr method, updates all of the implementations to match, and then updates all of the callers to pass in a context. A small number of callers don't yet have context plumbed to them so those use context.TODO() as a placeholder for now, so we can more easily find and fix them in later commits once we have contexts more thoroughly plumbed. Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
This commit is contained in:
@@ -79,7 +79,7 @@ func (b *Backend) DeleteWorkspace(name string, _ bool) error {
|
||||
}
|
||||
|
||||
// StateMgr manage the state, if the named state not exists, a new file will created
|
||||
func (b *Backend) StateMgr(name string) (statemgr.Full, error) {
|
||||
func (b *Backend) StateMgr(ctx context.Context, name string) (statemgr.Full, error) {
|
||||
log.Printf("[DEBUG] state manager, current workspace: %v", name)
|
||||
|
||||
c, err := b.client(name)
|
||||
@@ -88,7 +88,7 @@ func (b *Backend) StateMgr(name string) (statemgr.Full, error) {
|
||||
}
|
||||
stateMgr := remote.NewState(c, b.encryption)
|
||||
|
||||
ws, err := b.Workspaces(context.TODO())
|
||||
ws, err := b.Workspaces(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user