Skip to content

Commit

Permalink
ecs_ecr - Fix RepositoryNotFoundException when creating Repositorie…
Browse files Browse the repository at this point in the history
…s in check mode (ansible-collections#1550)

ecs_ecr - Fix `RepositoryNotFoundException` when creating Repositories in check mode

SUMMARY
When trying to create a repository in check mode the module throws a RepositoryNotFoundException trying to access policy objects on the repositories
also fixes and re-enables basic integration tests
ISSUE TYPE

Bugfix Pull Request

COMPONENT NAME
ecs_ecr
ADDITIONAL INFORMATION

Reviewed-by: Markus Bergholz <[email protected]>
  • Loading branch information
tremble authored Oct 7, 2022
1 parent b80eb9b commit 5204259
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ecs_ecr.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ def get_repository_policy(self, registry_id, name):
repositoryName=name, **build_kwargs(registry_id))
text = res.get('policyText')
return text and json.loads(text)
except is_boto3_error_code('RepositoryPolicyNotFoundException'):
except is_boto3_error_code(['RepositoryNotFoundException', 'RepositoryPolicyNotFoundException']):
return None

def create_repository(self, registry_id, name, image_tag_mutability):
Expand Down Expand Up @@ -334,7 +334,7 @@ def get_lifecycle_policy(self, registry_id, name):
repositoryName=name, **build_kwargs(registry_id))
text = res.get('lifecyclePolicyText')
return text and json.loads(text)
except is_boto3_error_code('LifecyclePolicyNotFoundException'):
except is_boto3_error_code(['LifecyclePolicyNotFoundException', 'RepositoryNotFoundException']):
return None

def put_lifecycle_policy(self, registry_id, name, policy_text):
Expand Down

0 comments on commit 5204259

Please sign in to comment.