Improvements to CentOS Image search #502
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Two small fixes to the CentOS image search.
First, addressing #456, add an additional filter to the search when looking for CentOS 6 or 7 images to also filter on the ProductCode. This extra field ensures that the AMI returned is the official CentOS image, not an image created by another provider who happened to name their image "CentOS Linux".
That approach did not work for CentOS 8, however. It was found that CentOS 8 is not published to the AWS Marketplace; while the images are still public. Additionally, the Name string had changed slightly, causing the search based on "CentOS Linux" to never match centos-8. For CentOS 8+, the Name match is adjusted, and we use the OwnerID to match the publisher of the image.
Specifying simply "centos" will now provide the latest centos-8 image, as expected; previously it would provide the latest centos-7 image.
Search tested on centos 6,7,8 on regions us-east-1, us-east-2, and us-west-2.
Unit tests updated.
Issues Resolved
Fixes #456
Closes chef/chef-workstation#1311
Check List