From 4088e47f92ebf39935b90443c5d30218911f30d9 Mon Sep 17 00:00:00 2001 From: rainzm Date: Mon, 26 Apr 2021 18:56:46 +0800 Subject: [PATCH] fix(ansibleserver): add LF for privateKey if not --- pkg/ansibleserver/models/ansibleplaybooks_validator.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/ansibleserver/models/ansibleplaybooks_validator.go b/pkg/ansibleserver/models/ansibleplaybooks_validator.go index 90b2da5c84..ed9608e460 100644 --- a/pkg/ansibleserver/models/ansibleplaybooks_validator.go +++ b/pkg/ansibleserver/models/ansibleplaybooks_validator.go @@ -87,6 +87,10 @@ func (v *ValidatorAnsiblePlaybook) Validate(data *jsonutils.JSONDict) error { } } } + // add LF for privateKey + if len(pb.PrivateKey) > 0 && pb.PrivateKey[len(pb.PrivateKey)-1] != 10 { + pb.PrivateKey = append(pb.PrivateKey, 10) + } pbJson := jsonutils.Marshal(pb) if serialized := pbJson.String(); len(serialized) > PlaybookMaxBytes { return httperrors.NewBadRequestError("playbook too big, got %d bytes, exceeding %d",