我想在远程服务器上执行一些任务。但是我没有得到有效的JSON响应。我尝试了各种方法来获取丰富的JSON响应,但无法正常工作。
这是Google的意图,我只想通过Google助手部署在远程服务器上:
async DoDeployIntent() {
const status = await doFullDeploy();
console.log(status);
this.tell(status);
}
//Here is ssh connection
ssh.connect({
host: '35.239.181.109',
port: 22,
username: 'common_dkumar',
passphrase: '12345',
privateKey: './ssh/id_rsa'
});
//Here is Async function:
const doFullDeploy = async () => {
return JSON.stringify(ssh.execCommand('sudo php bin/magento s:up', {cwd: '/var/www/html'}).then(function (result) {
if (result.stdout) {
return JSON.stringify('Deploy Success');
}
if (result.stderr) {
return JSON.stringify('Deploy Failed');
}
}))
}
我的问题是,在完成或失败的任务上我没有得到有效的JSON丰富响应。我也尝试了以下操作,但是没有收到有效的JSON响应。
const doFullDeploy = async () => {
var Client = require('ssh2').Client;
var conn = new Client();
return conn.on('ready', function () {
conn.exec('sudo php /var/www/html/bin/magento deploy:mode:show', function (err, stream) {
return JSON.stringify('Maintence Mode Enable Failed');
});
}).connect({
host: '35.239.181.109',
port: 22,
username: 'common_dkumar',
passphrase: '12345',
privateKey: require('fs').readFileSync('./ssh/id_rsa')
});
}
Digi流错误:
Failed to parse Dialogflow response into AppResponse because of
invalid platform response: Could not find a RichResponse or
SystemIntent in the platform response for agentId:
54e79a5d-97f9-49f4-981d-da0528d9e8fa and intentId:
181fa007-e5b8-4866-b8ca-6fbcb53c4f6b. WebhookStatus: message: "Webhook
execution successful" .