Due to the following error, AWS cloud image can't be deleted.

Error: The operation "DeregisterImage" could not be performed.
Error Info: AuthFailure
Error from: client-side
Status Code: 400
Message: Not authorized for image:ami-39c28c41
The AWS Cloud Image "ubuntu/images/hvm-ssd/ubuntu-bionic-18.04-amd64-server-20180617" couldn't delete.
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Xiaohua Guan created an issue. See original summary.

Xiaohua Guan’s picture

Xiaohua Guan’s picture

I explain my fix as following.

I add code to check the owner of the image before deleting it. If the ower is not the current user, I will skip the operation DeregisterImage.

In addition, because the property "owner" isn't set when creating a new image, I also add code to set the property.

Xiaohua Guan’s picture

Status: Active » Needs review
Xiaohua Guan’s picture

Remove wrong comment.
Errors like below occurred.

Xiaohua Guan’s picture

Remove wrong comment.
I added a composer.json file, where add the dependency to package aws-sdk-php.

yas’s picture

Status: Needs review » Needs work

@xiaohua-guan Thank you for your patch. I tested your patch manually and it looks working fine. However, to make sure that the error does not return, can you make a test for that patch?

Xiaohua Guan’s picture

@yas

Ok. I will add a test case for the patch.

Xiaohua Guan’s picture

Xiaohua Guan’s picture

Xiaohua Guan’s picture

Status: Needs work » Needs review

@yas

I added a test case to delete image imported, which has different owner.

Please review the patch file 3013583_20181115.patch.

yas’s picture

Status: Needs review » Reviewed & tested by the community

@xiaohua-guan Thank you for your update, it looks good to me.

@baldwinlouie How do you think?

baldwinlouie’s picture

@yas, Looks good! Thank you for the patch.

  • yas committed 461c2fb on 8.x-1.x authored by Xiaohua Guan
    Issue #3013583 by Xiaohua Guan, yas, baldwinlouie: Can't remove exiting...
yas’s picture

Status: Reviewed & tested by the community » Fixed

@xiaohua-guan
@baldwinlouie

Thank you for your contributions. I pushed the code and close this issue.

Xiaohua Guan’s picture

Xiaohua Guan’s picture

@yas

Following error occurred in the automated testing of the branch.

https://www.drupal.org/pift-ci-job/1122274

Drupal\Component\Serialization\Exception\InvalidDataTypeException: yaml_parse(): parsing error encountered during parsing: did not find expected node content (line 21, column 20), context while parsing a block node (line 21, column 20)

The error is due to my mistake in the patch 3013583_20181115.patch. I am sorry.

I provided a new patch file 3013583_20181116.patch, could you review it?

Xiaohua Guan’s picture

Status: Fixed » Needs review

  • yas committed a1e6a0e on 8.x-1.x authored by Xiaohua Guan
    Issue #3013583 by Xiaohua Guan, yas, baldwinlouie: Can't remove exiting...
yas’s picture

Status: Needs review » Reviewed & tested by the community

OK, I pushed the patch.

yas’s picture

Status: Reviewed & tested by the community » Fixed
yas’s picture

Title: Can't remove exiting AWS Cloud Image » Can't remove existing AWS Cloud Image

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.