Skip to content

Commit f426c15

Browse files
committed
backwards compatibility for version of cli older than v0.18.0
1 parent c80a64d commit f426c15

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

authority/ssh.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,13 @@ func (a *Authority) GetSSHConfig(ctx context.Context, typ string, data map[strin
101101
if err != nil {
102102
return nil, err
103103
}
104+
105+
// Backwards compatibility for version of the cli older than v0.18.0
106+
if o.Name == "step_includes.tpl" && (data == nil || data["Version"] != "v2") {
107+
o.Type = templates.File
108+
o.Path = strings.TrimPrefix(o.Path, "${STEPPATH}/")
109+
}
110+
104111
output = append(output, o)
105112
}
106113
return output, nil

templates/templates.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,8 @@ func (o *Output) Write() error {
271271
case PrependLine:
272272
return fileutil.PrependLine(path, o.Content, 0600)
273273
default:
274-
return errors.Errorf("unexpected output template type %s", string(o.Type))
274+
// Default to using a Snippet type if the type is not known.
275+
return fileutil.WriteSnippet(path, o.Content, 0600)
275276
}
276277
}
277278

0 commit comments

Comments
 (0)