Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync crashes when we try to describe a launch template version on a template that no longer exists #1321

Closed
achantavy opened this issue Jun 21, 2024 · 0 comments
Labels
AWS Related to cartography's AWS module bug Something isn't working

Comments

@achantavy
Copy link
Contributor

Description:

What issue is being seen? Describe what should be happening instead of the bug, for example: Cartography should not crash, the expected value isn't returned, the data schema is wrong, etc.

Sync crashes when calling describe launch template versions because we try to describe a template that may no longer exist.

To Reproduce:

Steps to reproduce the behavior. Provide all data and inputs required to reproduce the issue.

Run a sync on an account where launch templates are being spun up and down (I think).

Proposed fix: add error handling to skip over these cases.

Logs:

If applicable, copy and paste your console log with the failing stack trace.

Traceback (most recent call last):
  File "cartography/sync.py", line 191, in run_with_config
    return sync.run(neo4j_driver, config)
  File "cartography/sync.py", line 113, in run
    stage_func(neo4j_session, config)
  File "cartography/util.py", line 192, in timed
    result = method(*args, **kwargs)
  File "cartography/intel/aws/__init__.py", line 298, in start_aws_ingestion
    sync_successful = _sync_multiple_accounts(
  File "cartography/intel/aws/__init__.py", line 196, in _sync_multiple_accounts
    raise Exception('\n'.join(exception_tracebacks))
Exception: 2024-06-20 16:17:40.827071 - Exception for account ID: XXX
Traceback (most recent call last):
  File "cartography/intel/aws/__init__.py", line 169, in _sync_multiple_accounts
    _sync_one_account(
  File "cartography/intel/aws/__init__.py", line 64, in _sync_one_account
    RESOURCE_FUNCTIONS[func_name](**sync_args)
  File "cartography/util.py", line 192, in timed
    result = method(*args, **kwargs)
  File "cartography/intel/aws/ec2/launch_templates.py", line 143, in sync_ec2_launch_templates
    versions = get_launch_template_versions(boto3_session, templates, region)
  File "cartography/util.py", line 192, in timed
    result = method(*args, **kwargs)
  File "backoff/_sync.py", line 105, in retry
    ret = target(*args, **kwargs)
  File "cartography/util.py", line 279, in inner_function
    return func(*args, **kwargs)
  File "cartography/intel/aws/ec2/launch_templates.py", line 67, in get_launch_template_versions
    for versions in v_paginator.paginate(LaunchTemplateId=template['LaunchTemplateId']):
  File "botocore/paginate.py", line 269, in __iter__
    response = self._make_request(current_kwargs)
  File "botocore/paginate.py", line 357, in _make_request
    return self._method(**current_kwargs)
  File "botocore/client.py", line 565, in _api_call
    return self._make_api_call(operation_name, kwargs)
  File "botocore/client.py", line 1021, in _make_api_call
    raise error_class(parsed_response, operation_name)
botocore.exceptions.ClientError: An error occurred (InvalidLaunchTemplateId.NotFound) when calling the DescribeLaunchTemplateVersions operation: The specified launch template, with template ID lt-XXX, does not exist.

Please complete the following information::

  • Cartography release version or commit hash [e.g. 0.12.0 or 95e8e11]
    0.92.0
@achantavy achantavy changed the title Sync crashes when we try to describe a launch template that no longer exists Sync crashes when we try to describe a launch template version on a template that no longer exists Jun 21, 2024
@chandanchowdhury chandanchowdhury added bug Something isn't working AWS Related to cartography's AWS module labels Jun 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AWS Related to cartography's AWS module bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants