mirror of
https://github.com/opentffoundation/opentf.git
synced 2025-12-25 01:00:16 -05:00
Add context propagation to Command Meta entrypoint methods (#2735)
Signed-off-by: James Humphries <james@james-humphries.co.uk>
This commit is contained in:
@@ -26,6 +26,7 @@ type WorkspaceDeleteCommand struct {
|
||||
}
|
||||
|
||||
func (c *WorkspaceDeleteCommand) Run(args []string) int {
|
||||
ctx := c.CommandContext()
|
||||
args = c.Meta.process(args)
|
||||
envCommandShowWarning(c.Ui, c.LegacyName)
|
||||
|
||||
@@ -57,7 +58,7 @@ func (c *WorkspaceDeleteCommand) Run(args []string) int {
|
||||
|
||||
var diags tfdiags.Diagnostics
|
||||
|
||||
backendConfig, backendDiags := c.loadBackendConfig(configPath)
|
||||
backendConfig, backendDiags := c.loadBackendConfig(ctx, configPath)
|
||||
diags = diags.Append(backendDiags)
|
||||
if diags.HasErrors() {
|
||||
c.showDiagnostics(diags)
|
||||
@@ -65,7 +66,7 @@ func (c *WorkspaceDeleteCommand) Run(args []string) int {
|
||||
}
|
||||
|
||||
// Load the encryption configuration
|
||||
enc, encDiags := c.EncryptionFromPath(configPath)
|
||||
enc, encDiags := c.EncryptionFromPath(ctx, configPath)
|
||||
diags = diags.Append(encDiags)
|
||||
if encDiags.HasErrors() {
|
||||
c.showDiagnostics(diags)
|
||||
@@ -73,7 +74,7 @@ func (c *WorkspaceDeleteCommand) Run(args []string) int {
|
||||
}
|
||||
|
||||
// Load the backend
|
||||
b, backendDiags := c.Backend(&BackendOpts{
|
||||
b, backendDiags := c.Backend(ctx, &BackendOpts{
|
||||
Config: backendConfig,
|
||||
}, enc.State())
|
||||
diags = diags.Append(backendDiags)
|
||||
@@ -105,7 +106,7 @@ func (c *WorkspaceDeleteCommand) Run(args []string) int {
|
||||
return 1
|
||||
}
|
||||
|
||||
currentWorkspace, err := c.Workspace()
|
||||
currentWorkspace, err := c.Workspace(ctx)
|
||||
if err != nil {
|
||||
c.Ui.Error(fmt.Sprintf("Error selecting workspace: %s", err))
|
||||
return 1
|
||||
@@ -205,7 +206,7 @@ func (c *WorkspaceDeleteCommand) Run(args []string) int {
|
||||
|
||||
func (c *WorkspaceDeleteCommand) AutocompleteArgs() complete.Predictor {
|
||||
return completePredictSequence{
|
||||
c.completePredictWorkspaceName(),
|
||||
c.completePredictWorkspaceName(c.CommandContext()),
|
||||
complete.PredictDirs(""),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user