When deleting an EC2 cloud service provider, a 500 error is thrown when trying to delete launch templates.
TypeError: Argument 1 passed to Drupal/aws_cloud/Service/Ec2/Ec2Service::addMockHandler() must be an instance of Aws/Ec2/Ec2Client, null given, called in /app/docroot/modules/contrib/cloud/modules/cloud_service_providers/aws_cloud/src/Service/Ec2/Ec2Service.php on line 242 in Drupal/aws_cloud/Service/Ec2/Ec2Service->addMockHandler() (line 257 of modules/contrib/cloud/modules/cloud_service_providers/aws_cloud/src/Service/Ec2/Ec2Service.php)

| Comment | File | Size | Author |
|---|---|---|---|
| #17 | 3108467-17.patch | 4.6 KB | pranali.addweb |
Comments
Comment #2
jigish.addweb commentedComment #3
baldwinlouie commentedThank you Jigish for the patch. I tested this and found some issues with it. For background, here is what I'm testing with
I tested two use cases:
Deletedirectory on a Cloud Service providers. See this screenshot:In this use case, the function
aws_cloud_form_cloud_config_aws_ec2_delete_form_submitexecuted and I was able to delete my Cloud Server Templates and the corresponding Launch Templates.Apply to selected itemin the Cloud Service Provider list form. See screenshot:aws_cloud_form_cloud_config_aws_ec2_delete_form_submitwas not called. Rather, the following function inside CloudConfig was called.Can you look into why the second Use Case is not working?
Comment #4
jigish.addweb commentedComment #5
jigish.addweb commented@baldwinlouie
Thank you for testing the patch. I have fixed issue which you have reported.
Please test new patch file.
Thanks
Comment #6
baldwinlouie commented@jigish, Thank you for the patch. The updated code fixed the error.
I did a code review of the patch and I have the following comment
This code can be refactored into a common function that can be shared with the
Delete Launchtemplatecode inaws_cloud_form_cloud_config_aws_ec2_delete_form_submitComment #7
jigish.addweb commentedComment #8
jigish.addweb commented@baldwinlouie
Thank you for testing the patch.
I have refactored the code as your previous comment.
Please review new patch file.
Thanks
Comment #9
baldwinlouie commented@jigish, Thank you for the refactoring. It looks good to me now.
Comment #10
yas@baldwinlouie
Thank you for your review. I'll merge the patch to
8.x-1.xand8.x-2.xand close this issue asFixed.Comment #13
yasComment #14
yasComment #15
baldwinlouie commented@jigish, I'm re-opening this issue. I find that if I use the checkbox on the
Cloud Service Providerpage to delete a K8s cloud service provider, it will produce the same error.Can you please look at this again?
Comment #16
baldwinlouie commented@jigish, As I was working on another caching issue, I want to provide some feedback from the patch in comment #7.
The
$server_templatethat is passed in the parameter should be renamed $cloud_config. In the preceding function, we are dealing with cloud_config objects. It is only in this function that we load the cloud server templates.Comment #17
pranali.addweb commented@yas
I made changes for K8s (to fix an Internal Server Error when deleting AWS Cloud service provider) as @baldwinlouie's comment.
Please review the above patch and let me know if it needs any changes.
Comment #18
yas@paranaliaddweb
Thank you for the update. It looks fine in my local testing environment.
@baldwinlouie
Could you please review the patch?
Comment #19
baldwinlouie commented@yas and @pranali, Thank you for providing the updated patch. It works. There are no more Internal Server Errors!
Comment #20
yas@baldwinlouie
Thank you for your review. I'll merge the patch to
8.x-1.xand8.x-2.xand close this issue asFixed.Comment #23
yas