Skip to content
Snippets Groups Projects
Commit 29d4157d authored by baldwinlouie's avatar baldwinlouie Committed by Yas Naoi
Browse files

Issue #3186140 by baldwinlouie, yas: Fix an Internal Server Error when a K8s...

Issue #3186140 by baldwinlouie, yas: Fix an Internal Server Error when a K8s cloud service provider is deleted using the bulk delete form
parent a262ccac
No related branches found
No related tags found
No related merge requests found
......@@ -82,14 +82,28 @@ function k8s_cloud_config_update(CloudConfig $cloud_config) {
}
/**
* Implements hook_cloud_config_delete().
*/
function k8s_cloud_config_delete(CloudConfig $cloud_config) {
* Implements hook_cloud_config_predelete().
*/
function k8s_cloud_config_predelete(CloudConfig $cloud_config) {
// NOTE: Using hook_entity_predelete() to make sure the K8s CloudConfigPlugin
// is still available to clear out the K8s entities.
// This is to fix an issue using bulk operation to delete AWS and K8s
// cloud service providers.
// See https://www.drupal.org/project/cloud/issues/3186140
if ($cloud_config->bundle() === 'k8s') {
/** @var \Drupal\k8s\Service\K8sServiceInterface $k8s_service */
$k8s_service = \Drupal::service('k8s');
$k8s_service->setCloudContext($cloud_config->getCloudContext());
$k8s_service->clearAllEntities();
}
}
/**
* Implements hook_cloud_config_delete().
*/
function k8s_cloud_config_delete(CloudConfig $cloud_config) {
if ($cloud_config->bundle() === 'k8s') {
// Make sure to delete the cache to clear out the menu system.
K8sService::clearCacheValue();
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment