cozy / cozy-controller

Cozy Module and Apps deployer
cozy.io
GNU Affero General Public License v3.0
5 stars 13 forks source link

Error when restarting controller after stack update #152

Open clochix opened 8 years ago

clochix commented 8 years ago

Each time I try to manually update the stack, I get an error message:

cozy-monitor update-all-cozy-stack info - Update all cozy stack ... error - An error occured: error - Update all cozy stack failed. [Error: Cannot update stack: The controller can't be restarted. You should configure the command in /etc/cozy/controller.json.]

Here's the configuration: $ grep 'restart_cmd' /etc/cozy/controller.json "restart_cmd": "/bin/systemctl restart cozy"

The controller logs:

Sep 2 07:44:40 cozy- cozy-controller[222]: [2016-09-02 07:44:40:231] warn - controllers:applications | Can't restart the controller Sep 2 07:44:40 cozy- cozy-controller[222]: [2016-09-02 07:44:40:231] warn - controllers:applications | Can't restart the controller Sep 2 07:44:40 cozy- cozy-controller[222]: [2016-09-02 07:44:40:234] warn - controllers:applications | Error: Command failed: /bin/sh -c /bin/systemctl restart cozy Sep 2 07:44:40 cozy- cozy-controller[222]: at ChildProcess.exithandler (child_process.js:213:12) Sep 2 07:44:40 cozy- cozy-controller[222]: at emitTwo (events.js:87:13) Sep 2 07:44:40 cozy- cozy-controller[222]: at ChildProcess.emit (events.js:172:7) Sep 2 07:44:40 cozy- cozy-controller[222]: at maybeClose (internal/child_process.js:827:16) Sep 2 07:44:40 cozy- cozy-controller[222]: at Socket. (internal/child_process.js:319:11) Sep 2 07:44:40 cozy- cozy-controller[222]: at emitOne (events.js:77:13) Sep 2 07:44:40 cozy- cozy-controller[222]: at Socket.emit (events.js:169:7) Sep 2 07:44:40 cozy- cozy-controller[222]: at Pipe._onclose (net.js:477:12) Sep 2 07:44:40 cozy- cozy-controller[222]: [2016-09-02 07:44:40:235] warn - controllers:applications | Error: Command failed: /bin/sh -c /bin/systemctl restart cozy Sep 2 07:44:40 cozy- cozy-controller[222]: at ChildProcess.exithandler (child_process.js:213:12) Sep 2 07:44:40 cozy- cozy-controller[222]: at emitTwo (events.js:87:13) Sep 2 07:44:40 cozy- cozy-controller[222]: at ChildProcess.emit (events.js:172:7) Sep 2 07:44:40 cozy- cozy-controller[222]: at maybeClose (internal/child_process.js:827:16) Sep 2 07:44:40 cozy- cozy-controller[222]: at Socket. (internal/child_process.js:319:11) Sep 2 07:44:40 cozy- cozy-controller[222]: at emitOne (events.js:77:13) Sep 2 07:44:40 cozy- cozy-controller[222]: at Socket.emit (events.js:169:7) Sep 2 07:44:40 cozy- cozy-controller[222]: at Pipe._onclose (net.js:477:12) Sep 2 07:44:40 cozy- cozy-controller[222]: [2016-09-02 07:44:40:236] error - controllers:applications | The controller can't be restarted. You should configure the command in /etc/cozy/controller.json. Sep 2 07:44:40 cozy- cozy-controller[222]: [2016-09-02 07:44:40:237] error - controllers:applications | The controller can't be restarted. You should configure the command in /etc/cozy/controller.json. Sep 2 07:44:40 cozy- cozy-controller[222]: Sending error to client: Sep 2 07:44:40 cozy- cozy-controller[222]: Error: Cannot update stack: The controller can't be restarted. You should configure the command in /etc/cozy/controller.json. Sep 2 07:44:40 cozy- cozy-controller[222]: at /usr/lib/node_modules/cozy-controller/build/server/controllers/applications.js:330:23 Sep 2 07:44:40 cozy- cozy-controller[222]: at /usr/lib/node_modules/cozy-controller/build/server/controllers/applications.js:87:14 Sep 2 07:44:40 cozy- cozy-controller[222]: at ChildProcess.exithandler (child_process.js:220:5) Sep 2 07:44:40 cozy- cozy-controller[222]: at emitTwo (events.js:87:13) Sep 2 07:44:40 cozy- cozy-controller[222]: at ChildProcess.emit (events.js:172:7) Sep 2 07:44:40 cozy- cozy-controller[222]: at maybeClose (internal/child_process.js:827:16) Sep 2 07:44:40 cozy- cozy-controller[222]: at Socket. (internal/child_process.js:319:11) Sep 2 07:44:40 cozy- cozy-controller[222]: at emitOne (events.js:77:13) Sep 2 07:44:40 cozy- cozy-controller[222]: at Socket.emit (events.js:169:7) Sep 2 07:44:40 cozy- cozy-controller[222]: at Pipe._onclose (net.js:477:12) Sep 2 07:44:40 cozy- cozy-controller[222]: [Fri, 02 Sep 2016 07:44:40 GMT] - POST /apps/update-stack - 400 - 111716.997 ms - 962

Running in console /bin/sh -c /bin/systemctl restart cozy only display an help message. Running /bin/sh -c "/bin/systemctl restart cozy" seems to work. Is there an issue with the way we escape command arguments?