added comments and removed temp ones
This commit is contained in:
parent
86a087056e
commit
e67e03f73f
1 changed files with 3 additions and 8 deletions
|
|
@ -35,7 +35,7 @@ public function handle(Service $service, bool $deleteConfigurations, bool $delet
|
||||||
$commands[] = "docker volume rm -f $storage->name";
|
$commands[] = "docker volume rm -f $storage->name";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Execute all commands
|
// Execute volume deletion first, this must be done first otherwise volumes will not be deleted.
|
||||||
if (!empty($commands)) {
|
if (!empty($commands)) {
|
||||||
foreach ($commands as $command) {
|
foreach ($commands as $command) {
|
||||||
$result = instant_remote_process([$command], $server, false);
|
$result = instant_remote_process([$command], $server, false);
|
||||||
|
|
@ -46,22 +46,18 @@ public function handle(Service $service, bool $deleteConfigurations, bool $delet
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete networks if the flag is set
|
|
||||||
if ($deleteConnectedNetworks) {
|
if ($deleteConnectedNetworks) {
|
||||||
$uuid = $service->uuid;
|
$uuid = $service->uuid;
|
||||||
$service->delete_connected_networks($uuid);
|
$service->delete_connected_networks($uuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Command to remove the service itself
|
|
||||||
$commands[] = "docker rm -f $service->uuid";
|
$commands[] = "docker rm -f $service->uuid";
|
||||||
|
|
||||||
// Execute all commands
|
// Executing remaining commands
|
||||||
instant_remote_process($commands, $server, false);
|
instant_remote_process($commands, $server, false);
|
||||||
|
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
throw new \Exception($e->getMessage());
|
throw new \Exception($e->getMessage());
|
||||||
} finally {
|
} finally {
|
||||||
// Delete configurations if the flag is set
|
|
||||||
if ($deleteConfigurations) {
|
if ($deleteConfigurations) {
|
||||||
$service->delete_configurations();
|
$service->delete_configurations();
|
||||||
}
|
}
|
||||||
|
|
@ -77,7 +73,6 @@ public function handle(Service $service, bool $deleteConfigurations, bool $delet
|
||||||
$service->tags()->detach();
|
$service->tags()->detach();
|
||||||
$service->forceDelete();
|
$service->forceDelete();
|
||||||
|
|
||||||
// Run cleanup if images need to be deleted
|
|
||||||
if ($deleteImages) {
|
if ($deleteImages) {
|
||||||
CleanupDocker::run($server, true);
|
CleanupDocker::run($server, true);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue