Skip to content

Commit

Permalink
Ensure that images are hidden (#711)
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Berendt <[email protected]>
  • Loading branch information
berendt committed Dec 18, 2023
1 parent e57862a commit 5556e43
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
13 changes: 12 additions & 1 deletion openstack_image_manager/manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -1097,7 +1097,11 @@ def manage_outdated_images(self, managed_images: set) -> list:
logger.info("Deactivating image '%s'" % image)
self.conn.image.deactivate_image(cloud_image.id)

if self.CONF.hide and not self.CONF.dry_run:
if (
self.CONF.hide
and not self.CONF.dry_run
and cloud_image.visibility != "community"
):
logger.info(
"Setting visibility of '%s' to 'community'" % image
)
Expand All @@ -1111,6 +1115,13 @@ def manage_outdated_images(self, managed_images: set) -> list:
logger.info(
f"Image '{image}' will not be deleted, {counter[image_name]} <= {last}"
)
if (
self.CONF.hide
and not self.CONF.dry_run
and cloud_image.visibility != "community"
):
logger.info("Setting visibility of '%s' to 'community'" % image)
self.conn.image.update_image(cloud_image.id, visibility="community")
elif (
counter[image_name] < last and self.CONF.hide and not self.CONF.dry_run
):
Expand Down
2 changes: 1 addition & 1 deletion playbooks/real-world.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@

- role: tox
vars:
tox_extra_args: -- --hide --hypervisor kvm --force --keep --delete --yes-i-really-know-what-i-do
tox_extra_args: -- --hypervisor kvm --force --keep --latest --hide

0 comments on commit 5556e43

Please sign in to comment.