Skip to content

Commit

Permalink
Legacy executors are executors after all
Browse files Browse the repository at this point in the history
This fixes a bug where pre-0.9 executors fail to recover after an
upgrade.

The bug is that legacyExecutorWrappers didn't get updated with
ExecStreaming function, and thus failed to implement the Executor
function. Sadly, this meant that all recovery attempts fail, as the
runtime check in
https://github.com/hashicorp/nomad/blob/b312aacbc961dfd976b6a402d22d80b45176a962/drivers/shared/executor/utils.go#L103-L110
.
  • Loading branch information
Mahmood Ali authored and tgross committed Nov 10, 2020
1 parent 0ef8f69 commit d075faa
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions drivers/shared/executor/legacy_executor_wrapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ type legacyExecutorWrapper struct {
logger hclog.Logger
}

// validate that legacyExecutorWrapper is an executor
var _ Executor = (*legacyExecutorWrapper)(nil)

func (l *legacyExecutorWrapper) Launch(launchCmd *ExecCommand) (*ProcessState, error) {
return nil, fmt.Errorf("operation not supported for legacy exec wrapper")
}
Expand Down Expand Up @@ -133,6 +136,11 @@ func (l *legacyExecutorWrapper) Exec(deadline time.Time, cmd string, args []stri
return l.client.Exec(deadline, cmd, args)
}

func (l *legacyExecutorWrapper) ExecStreaming(ctx context.Context, cmd []string, tty bool,
stream drivers.ExecTaskStream) error {
return fmt.Errorf("operation not supported for legacy exec wrapper")
}

type pre09ExecutorRPC struct {
client *rpc.Client
logger hclog.Logger
Expand Down

0 comments on commit d075faa

Please sign in to comment.