Skip to content

Commit

Permalink
feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
sclevine committed Nov 26, 2024
1 parent 5556a03 commit df1b765
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions lib/autoupdate/agent/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ type Revision struct {
}

// NewRevision create a Revision.
// A revision with no version must not have flags.
// If version is not set, no flags are returned.
// This ensures that all Revisions without versions are zero-valued.
func NewRevision(version string, flags InstallFlags) Revision {
if version != "" {
return Revision{
Expand All @@ -104,11 +105,11 @@ func NewRevisionFromDir(dir string) (Revision, error) {
parts := strings.Split(dir, "_")
var out Revision
if len(parts) == 0 {
return out, fmt.Errorf("dir name empty")
return out, trace.Errorf("dir name empty")
}
out.Version = parts[0]
if out.Version == "" {
return out, fmt.Errorf("version missing in dir %q", dir)
return out, trace.Errorf("version missing in dir %s", dir)
}
switch flags := parts[1:]; len(flags) {
case 2:
Expand All @@ -126,7 +127,7 @@ func NewRevisionFromDir(dir string) (Revision, error) {
case 0:
return out, nil
}
return out, fmt.Errorf("invalid flag in %q", dir)
return out, trace.Errorf("invalid flag in %s", dir)
}

// Dir returns the directory path name of a Revision.
Expand Down
2 changes: 1 addition & 1 deletion lib/autoupdate/agent/updater.go
Original file line number Diff line number Diff line change
Expand Up @@ -700,7 +700,7 @@ func (u *Updater) update(ctx context.Context, cfg *UpdateConfig, target Revision
if ok := revertConfig(ctx); ok {
u.Log.WarnContext(ctx, "Teleport updater encountered a configuration error and successfully reverted the installation.")
}
return trace.Errorf("failed to validate configuration for new version %q of Teleport: %w", target, err)
return trace.Errorf("failed to validate configuration for new version %s of Teleport: %w", target, err)
}

// Restart Teleport if necessary.
Expand Down

0 comments on commit df1b765

Please sign in to comment.