Skip to content
Snippets Groups Projects
Commit 9fdc4e8c authored by xiaohua guan's avatar xiaohua guan Committed by Yas Naoi
Browse files

Issue #3247826 by Xiaohua Guan, yas: Delete and bulk delete security group...

Issue #3247826 by Xiaohua Guan, yas: Delete and bulk delete security group from Cloud Orchestrator master to workers (AWS Cloud)
parent 7cad306a
No related branches found
No related tags found
No related merge requests found
......@@ -19,22 +19,33 @@ class SecurityGroupDeleteForm extends AwsDeleteUpdateEntityForm {
$entity = $this->entity;
$this->ec2Service->setCloudContext($entity->getCloudContext());
if ($this->ec2Service->deleteSecurityGroup([
$form_state->setRedirect("view.{$entity->getEntityTypeId()}.list", ['cloud_context' => $entity->getCloudContext()]);
$result = $this->ec2Service->deleteSecurityGroup([
'GroupId' => $entity->getGroupId(),
]) !== NULL) {
$entity->delete();
]);
$this->messenger->addStatus($this->getDeletionMessage());
$this->logDeletionMessage();
$this->clearCacheValues($entity->getCacheTags());
$this->dispatchSubmitEvent($entity);
// If $result is NULL, some error should have occurred
// when calling the AWS API.
if ($result === NULL) {
$this->processOperationErrorStatus($entity, 'deleted');
return;
}
else {
$this->processOperationErrorStatus($entity, 'deleted');
if (!empty($result['SendToWorker'])) {
$this->messenger->addStatus($this->t('The @type @label has been deleted remotely.', [
'@type' => $entity->getEntityType()->getSingularLabel(),
'@label' => $entity->getName(),
]));
return;
}
$form_state->setRedirect("view.{$entity->getEntityTypeId()}.list", ['cloud_context' => $entity->getCloudContext()]);
$entity->delete();
$this->messenger->addStatus($this->getDeletionMessage());
$this->logDeletionMessage();
$this->clearCacheValues($entity->getCacheTags());
$this->dispatchSubmitEvent($entity);
}
}
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