node.js - res.render() is not calling in nodejs -
i working nodejs + ansible module. while need call ansible script via nodejs, after completed ansible taks, render result , viewed in frontend.
now, ansible tasks working fine, not ansible result , viewed in frontend. not called res.render
method. goes aborted
my code:
app.post('/create', function (req, res) { var playbook = new ansible.playbook().playbook("remove") var command = playbook.inventory('inventories/remove/hosts').verbose('v'); var promise = command.exec(); promise.then(function (successresult) { tmp += "delete magento process"; tmp += successresult.output; installmagento(req, res); }, function (error) { tmp += error; installmagento(req, res); }); }); function installmagento(req, res) { var playbook = new ansible.playbook().playbook("install"); var command = playbook.inventory('inventories/install/hosts'); var promise = command.exec(); promise.then(function (successresult) { tmp += "create magento serup"; tmp += successresult.output; fs.unlink('roles/install/vars/main.yml', function (err) { if (!err) { console.log('delete docker_variables.yml file '); } else { console.log('not delete docker_variables.yml file'); } }); res.render("result", {data: tmp, title: " setup report"}); }, function (error) { tmp += error; res.render("result", {data: tmp, title: " setup report"}); }); }
this code print console log result console.log('delete docker_variables.yml file ');
not calling res.render().
note: our ansible script take minimum 30min complete task
suggest me how fix this.
Comments
Post a Comment