Automatically hide protected images 87/7887/2
authorThanh Ha <thanh.ha@linuxfoundation.org>
Sat, 9 Dec 2017 01:45:25 +0000 (20:45 -0500)
committerThanh Ha <thanh.ha@linuxfoundation.org>
Sat, 9 Dec 2017 01:52:30 +0000 (20:52 -0500)
We are not able to delete protected images so automatically filter
them out of our results.

Issue: RELENG-705
Change-Id: Id7fa5ab73ec912aac9b04dfb30c29492320402f2
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
lftools/openstack/image.py

index 4c9ac98..8b2a77f 100644 (file)
@@ -31,6 +31,8 @@ def _filter_images(images, days=0, hide_public=False, ci_managed=True):
             continue
         if ci_managed and image.metadata.get('ci_managed', None) != 'yes':
             continue
+        if image.protected:
+            continue
         if days and (
                 datetime.strptime(image.created_at, '%Y-%m-%dT%H:%M:%SZ')
                 >= datetime.now() - timedelta(days=days)):