Skip to content

Commit

Permalink
Fix commands not working (#15)
Browse files Browse the repository at this point in the history
Also improved output handling
  • Loading branch information
dave-lang authored Nov 4, 2024
1 parent 5e59d5f commit 1f0e695
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
3 changes: 1 addition & 2 deletions docker/command.cgi
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use strict;
use warnings;

require './docker-lib.pl';
#ui_print_header(undef, &text('index_title'), "", undef, 1, 1);

&ReadParse();
&error_setup(text('command_err'));

Expand All @@ -26,5 +26,4 @@ if ($command == 'restart') {

&error($err) if ($err);

&webmin_log(ucfirst($command), 'docker container', $in{'container'});
&redirect("");
6 changes: 4 additions & 2 deletions docker/docker-lib.pl
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,14 @@ sub container_command
return "Command not allowed";
}

my ($code, $result) = docker_command($command . ' ' . $container);
my ($code, $result) = docker_command('container ' . $command . ' ' . $container);
if ($code != 0) {
&webmin_log('Failed ' . $command, 'docker container', $in{'container'});
return $result;
}

return $result;
&webmin_log(ucfirst($command), 'docker container', $in{'container'});
return "" # successful commands only return the container name
}

sub circular_grid
Expand Down
6 changes: 2 additions & 4 deletions tools/dind/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
version: '3.5'
services:
webmin:
container_name: alpine
image: alpine:latest
restart: on-failure
command: ["sleep","infinity"]
container_name: syslog_appliance_alpine
image: rsyslog/syslog_appliance_alpine

0 comments on commit 1f0e695

Please sign in to comment.