Merge pull request #2206 from maurobender/fix_schduled_tasks_executing_using_host_environment

Fix scheduled tasks being executed using host environment variables
This commit is contained in:
Andras Bacsai 2024-05-15 08:58:50 +02:00 committed by GitHub
commit 5b8a923cb5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -93,7 +93,7 @@ public function handle(): void
foreach ($this->containers as $containerName) { foreach ($this->containers as $containerName) {
if (count($this->containers) == 1 || str_starts_with($containerName, $this->task->container . '-' . $this->resource->uuid)) { if (count($this->containers) == 1 || str_starts_with($containerName, $this->task->container . '-' . $this->resource->uuid)) {
$cmd = 'sh -c "' . str_replace('"', '\"', $this->task->command) . '"'; $cmd = "sh -c '" . str_replace("'", "'\''", $this->task->command) . "'";
$exec = "docker exec {$containerName} {$cmd}"; $exec = "docker exec {$containerName} {$cmd}";
$this->task_output = instant_remote_process([$exec], $this->server, true); $this->task_output = instant_remote_process([$exec], $this->server, true);
$this->task_log->update([ $this->task_log->update([