fix: docker compose validation

This commit is contained in:
Andras Bacsai
2024-03-14 09:21:48 +01:00
parent 695d3b82b5
commit c8d48ccbff
4 changed files with 38 additions and 7 deletions

View File

@@ -38,8 +38,12 @@ class Configuration extends Component
}
public function check_status()
{
dispatch_sync(new ContainerStatusJob($this->service->server));
$this->dispatch('refresh')->self();
$this->dispatch('serviceStatusChanged');
try {
dispatch_sync(new ContainerStatusJob($this->service->server));
$this->dispatch('refresh')->self();
$this->dispatch('serviceStatusChanged');
} catch (\Exception $e) {
return handleError($e, $this);
}
}
}

View File

@@ -41,7 +41,6 @@ class StackForm extends Component
}
public function saveCompose($raw)
{
$this->service->docker_compose_raw = $raw;
$this->submit();
}
@@ -55,6 +54,10 @@ class StackForm extends Component
{
try {
$this->validate();
$isValid = validateComposeFile($this->service->docker_compose_raw, $this->service->server->id);
if ($isValid !== 'OK') {
throw new \Exception("Invalid docker-compose file.\n$isValid");
}
$this->service->save();
$this->service->saveExtraFields($this->fields);
$this->service->parse();