mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
fix(ansibleserver): don't init privateKey for ansibleplaybook if it already have one
This commit is contained in:
@@ -186,10 +186,12 @@ func (apb *SAnsiblePlaybook) runPlaybook(ctx context.Context, userCred mcclient.
|
||||
|
||||
// init private key
|
||||
pb := apb.Playbook.Copy()
|
||||
if k, err := mcclient_modules.Sshkeypairs.FetchPrivateKey(ctx, userCred); err != nil {
|
||||
return err
|
||||
} else {
|
||||
pb.PrivateKey = []byte(k)
|
||||
if len(pb.PrivateKey) == 0 {
|
||||
if k, err := mcclient_modules.Sshkeypairs.FetchPrivateKey(ctx, userCred); err != nil {
|
||||
return err
|
||||
} else {
|
||||
pb.PrivateKey = []byte(k)
|
||||
}
|
||||
}
|
||||
pb.OutputWriter(&ansiblePlaybookOutputWriter{apb})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user