update cleanup

This commit is contained in:
Andras Bacsai 2023-11-06 20:58:03 +01:00
parent 9007a645a6
commit ca0535c285

View File

@ -7,6 +7,7 @@
use App\Models\ApplicationDeploymentQueue;
use App\Models\Service;
use App\Models\ServiceApplication;
use App\Models\ServiceDatabase;
use App\Models\StandaloneMariadb;
use App\Models\StandaloneMongodb;
use App\Models\StandaloneMysql;
@ -40,7 +41,7 @@ private function cleanup_ssh()
Storage::delete($file);
}
} catch (\Throwable $e) {
echo "Error: {$e->getMessage()}\n";
echo "Error in cleaning ssh: {$e->getMessage()}\n";
}
}
private function cleanup_in_progress_application_deployments()
@ -208,5 +209,16 @@ private function cleanup_stucked_resources()
} catch (\Throwable $e) {
echo "Error in serviceApplications: {$e->getMessage()}\n";
}
try {
$serviceDatabases = ServiceDatabase::all();
foreach ($serviceDatabases as $service) {
if (!data_get($service, 'service')) {
ray('ServiceDatabase without service', $service->name);
$service->delete();
}
}
} catch (\Throwable $e) {
echo "Error in ServiceDatabases: {$e->getMessage()}\n";
}
}
}