Feature/get platform from instance info #22
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.
Issue #, if available: Closes #23
Description of changes:
There could be cases where the base AMI is unavailable (e.g. EC2 instance restored from a AWS Backup Recovery point that has since exceeded its Retention period, or an EC2 instance that was launched from an AMI that has since been deregistered).
This PR adds additional logic to retrieve the Platform details from the instance_info should they be unavailable from the image information. The describe_instances API call provides the
PlatformDetails
response to achieve this.Note that Ubuntu and Amazon Linux platforms cannot be distinguished. Both return
Linux/UNIX
. Hence, they are not handled by this PR. This PR does however, handleWindows
,Red Hat
, andSUSE
platforms since their Platform Details are specific.Also adding an additional fix for detecting if
ubuntu
is in the imageDescription
. Since theDescription
attribute is optional, this PR adds a check if it exists first before checking ifubuntu
is a sub-string within it.By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.