Skip to content

Destroy fails after failed deployment #22

@krrome

Description

@krrome

Describe the bug
When deployment fails e.g. because the access to a mentioned external Lambda Layer was rejected then hark destroy fails.

To Reproduce
Steps to reproduce the behavior:

cd examples/fractals
hark deploy
# Fails with "User: arn:aws:iam::XXXXXXXXXXXX:user/XYZ is not authorized to perform: lambda:GetLayerVersion on resource: arn:aws:lambda:eu-west-2:770693421928:layer:Klayers-python38-Pillow:4"
hark destroy

Expected behavior
Destroy should also work after failed deployment

Tracebacks
If applicable, copy the Python traceback here.

Traceback (most recent call last):
  File "/home/roman/anaconda3/envs/teal/bin/hark", line 33, in <module>
    sys.exit(load_entry_point('hark-lang', 'console_scripts', 'hark')())
  File "..some_path/hark-lang/src/hark_lang/cli/main.py", line 434, in main
    dispatch(args)
  File "..some_path/hark-lang/src/hark_lang/cli/main.py", line 95, in _wrapped
    fn(args, **kwargs)
  File "..some_path/hark-lang/src/hark_lang/cli/main.py", line 415, in dispatch
    _destroy(args)
  File "..some_path/hark-lang/src/hark_lang/cli/main.py", line 109, in _wrapped
    return fn(args, cfg=cfg)
  File "..some_path/hark-lang/src/hark_lang/cli/main.py", line 276, in _destroy
    in_own.destroy(cfg)
  File "..some_path/hark-lang/src/hark_lang/cli/in_own.py", line 68, in destroy
    aws.destroy(deploy_config, callback_start=_update_sp(spin_msg, sp))
  File "..some_path/hark-lang/src/hark_lang/cloud/aws.py", line 1133, in destroy
    res.destroy_if_exists(config)
  File "..some_path/hark-lang/src/hark_lang/cloud/aws.py", line 898, in destroy_if_exists
    if not self.exists(config):
  File "..some_path/hark-lang/src/hark_lang/cloud/aws.py", line 836, in exists
    res = self._get_current(config)
  File "..some_path/hark-lang/src/hark_lang/cloud/aws.py", line 820, in _get_current
    res = client.get_bucket_notification_configuration(Bucket=self.bucket)
  File "/home/roman/anaconda3/envs/teal/lib/python3.8/site-packages/botocore/client.py", line 316, in _api_call
    return self._make_api_call(operation_name, kwargs)
  File "/home/roman/anaconda3/envs/teal/lib/python3.8/site-packages/botocore/client.py", line 635, in _make_api_call
    raise error_class(parsed_response, operation_name)
botocore.errorfactory.NoSuchBucket: An error occurred (NoSuchBucket) when calling the GetBucketNotificationConfiguration operation: The specified bucket does not exist

Affected Versions
0.5.1

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions