Skip to content

Resource inspection fails for ECS when Capacity Provider Strategy is set #179

@nerixim

Description

@nerixim

Recently discovered your awesome tool. Thanks for the work!

I have an ECS cluster with Capacity Provider Strategy set and cloudiscovery throws an error when trying to inspect it.
Actually it's a boto3 issue but meanwhile it can be avoided by adding a check as follows

# https://github.com/Cloud-Architects/cloudiscovery/blob/fad132e45f813775eaf0051e628fcbec68291fb4/cloudiscovery/provider/aws/vpc/resource/containers.py#L58
- if data_service_detail["launchType"] == "FARGATE":
+ if data_service_detail.get("launchType") == "FARGATE" or data_service_detail.get('capacityProviderStrategy'):

Error trace just in case

Inspecting resources
You've found a bug! Please, open an issue in GitHub project
https://github.com/Cloud-Architects/cloudiscovery/issues

Python:        3.9.4 (default, Apr  5 2021, 01:49:30)
[Clang 12.0.0 (clang-1200.0.32.29)]
boto3 version: 1.17.53
Platform:      macOS-10.15.7-x86_64-i386-64bit

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/cloudiscovery/shared/error_handler.py", line 21, in wrapper
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/cloudiscovery/shared/common.py", line 130, in wrapper
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/cloudiscovery/provider/aws/vpc/resource/containers.py", line 58, in get_resources
    if data_service_detail["launchType"] == "FARGATE":
KeyError: 'launchType'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions