Skip to content

Commit

Permalink
fix: Unable to run container exec node with templated command #31
Browse files Browse the repository at this point in the history
  • Loading branch information
naimo84 committed Apr 23, 2022
1 parent 9236d56 commit d5320a5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/docker-container-actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ module.exports = function (RED: Red) {
}
this.status({});

executeAction(containerId, options, cmd, client, action, this, msg, image, {
executeAction(containerId, options, client, action, this, msg, image, {
cmd: cmd,
pullimage: n.pullimage,
stream: n.stream,
Expand All @@ -35,7 +35,7 @@ module.exports = function (RED: Red) {
});


async function executeAction(containerId: string, options: any, cmd: string, client: Dockerode, action: string, node: Node, msg, image, config) {
async function executeAction(containerId: string, options: any, client: Dockerode, action: string, node: Node, msg, image, config) {
let container = client.getContainer(containerId);
debug(`action: ${action}`)
debug(`containerId: ${containerId}`)
Expand Down Expand Up @@ -84,7 +84,7 @@ module.exports = function (RED: Red) {

case 'exec':
let execOptions = {
Cmd: ['sh', '-c', cmd],
Cmd: ['sh', '-c', options],
AttachStdout: true,
AttachStderr: true
};
Expand Down Expand Up @@ -558,7 +558,7 @@ module.exports = function (RED: Red) {

case 'archive-info':
// https://docs.docker.com/engine/api/v1.40/#operation/ContainerArchiveInfo
container.infoArchive({ 'path': cmd })
container.infoArchive({ 'path': config.cmd })
.then(res => {
node.status({ fill: 'green', shape: 'dot', text: containerId + ' killed' });
node.send(Object.assign(msg, { payload: res }));
Expand Down

0 comments on commit d5320a5

Please sign in to comment.