request({
url: "https://xx.xxx.xxx.xxx:9999/run",
headers: {
'Accept': 'application/x-yaml',
'X-Auth-Token': "41b9539436faae8016c305c2f875b31e47a23d93",
'Content-type': 'application/json',
},
method: "POST",
json: true,
body: [{
"client": "local",
"tgt": "master_minion",
"fun": "cmd.script",
"kwarg": {"source": "salt://update-diff.py", "args":args},
"username": "salt",
"password": "salt",
"eauth": "pam"
}]
}
我正在向salt-api傳遞一個請求來運行腳本。我需要解析輸出。需要JSON輸出作爲salt-api的回報
輸出示例:
return:
- master_minion:
pid: 28796
retcode: 0
stderr: ''
stdout: " sadfh,smfsdhg\n sfgmsfgmsg\n sfgmsfgmsg\n-dkfadnfklad--->New123\n+dkfadnfklad--->New1232\n\
\ sdfjhs,dfhn\n sdfjhs,dfhn\n sdfjhs,dfhn"
我可以在JSON這些輸出?
欲陣列中的所有行象下面這樣:
預期輸出: [ 「sadfh,smfsdhg」, 「sfgmsfgmsg」, 「sfgmsfgmsg」, 「 - dkfadnfklad ---> New123」,」 + dkfadnfklad ---> New1232「,」sdfjhs,dfhn「,」sdfjhs,dfhn「,」sdfjhs,dfhn「]
任何建議?由於提前