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

Test for membership should be 'not in' #29

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ def initialize():
IMAGES_TO_KEEP = int(os.environ.get('IMAGES_TO_KEEP', 100))
IGNORE_TAGS_REGEX = os.environ.get('IGNORE_TAGS_REGEX', "")


def handler(event, context):
initialize()
if REGION == "None":
Expand Down Expand Up @@ -148,14 +149,14 @@ def discover_delete_images(regionname):
print("Nothing to delete in repository : " + repository['repositoryName'])


def append_to_list(list, id):
if not {'imageDigest': id} in list:
list.append({'imageDigest': id})
def append_to_list(items, val):
if {'imageDigest': val} not in items:
items.append({'imageDigest': val})


def append_to_tag_list(list, id):
if not id in list:
list.append(id)
def append_to_tag_list(tags, tag):
if tag not in tags:
tags.append(tag)


def chunks(l, n):
Expand Down