backwards compatibility for version of cli older than v0.18.0

This commit is contained in:
max furman 2021-11-12 13:12:11 -08:00
parent c80a64d0e6
commit f426c152a9
2 changed files with 9 additions and 1 deletions

View file

@ -101,6 +101,13 @@ func (a *Authority) GetSSHConfig(ctx context.Context, typ string, data map[strin
if err != nil {
return nil, err
}
// Backwards compatibility for version of the cli older than v0.18.0
if o.Name == "step_includes.tpl" && (data == nil || data["Version"] != "v2") {
o.Type = templates.File
o.Path = strings.TrimPrefix(o.Path, "${STEPPATH}/")
}
output = append(output, o)
}
return output, nil

View file

@ -271,7 +271,8 @@ func (o *Output) Write() error {
case PrependLine:
return fileutil.PrependLine(path, o.Content, 0600)
default:
return errors.Errorf("unexpected output template type %s", string(o.Type))
// Default to using a Snippet type if the type is not known.
return fileutil.WriteSnippet(path, o.Content, 0600)
}
}