bonclay7 / aws-amicleaner

Cleanup your old unused ami and related snapshots
MIT License
362 stars 132 forks source link

Errors if LaunchConfigurationName is empty string #107

Closed devgrok closed 4 years ago

devgrok commented 4 years ago

Got the following error where zeroed_lcs = [''] and gave the below error. Likely because of the use of LaunchTemplates instead of LaunchConfigurations.

Fixes the below error:

  File "/usr/local/lib/python3.5/dist-packages/amicleaner/cli.py", line 53, in fetch_candidates
    excluded_amis += f.fetch_zeroed_asg()
  File "/usr/local/lib/python3.5/dist-packages/amicleaner/fetch.py", line 72, in fetch_zeroed_asg
    LaunchConfigurationNames=zeroed_lcs
  File "/usr/local/lib/python3.5/dist-packages/botocore/client.py", line 276, in _api_call
    return self._make_api_call(operation_name, kwargs)
  File "/usr/local/lib/python3.5/dist-packages/botocore/client.py", line 559, in _make_api_call
    api_params, operation_model, context=request_context)
  File "/usr/local/lib/python3.5/dist-packages/botocore/client.py", line 607, in _convert_to_request_dict
    api_params, operation_model)
  File "/usr/local/lib/python3.5/dist-packages/botocore/validate.py", line 297, in serialize_to_request
    raise ParamValidationError(report=report.generate_report())
botocore.exceptions.ParamValidationError: Parameter validation failed:
Invalid length for parameter LaunchConfigurationNames[0], value: 0, valid range: 1-inf
codecov-io commented 4 years ago

Codecov Report

Merging #107 into master will not change coverage. The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #107   +/-   ##
=======================================
  Coverage   91.55%   91.55%           
=======================================
  Files          11       11           
  Lines         817      817           
=======================================
  Hits          748      748           
  Misses         69       69
Impacted Files Coverage Δ
amicleaner/fetch.py 100% <ø> (ø) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 70627e5...69b9a14. Read the comment docs.

devgrok commented 4 years ago

duplicate of https://github.com/bonclay7/aws-amicleaner/pull/104