0

我想在远程服务器上做一些任务。但我没有得到有效的 JSON 响应。我尝试了各种方法来获得丰富的 JSON 响应,但它不起作用。

这是谷歌的意图,我只想通过谷歌助手部署在远程服务器上:

    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')
        });
    }

数字流量错误:

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" .
4

0 回答 0