Skip to content

Commit

Permalink
skip version which are part of composite content views (#40)
Browse files Browse the repository at this point in the history
  • Loading branch information
4nn0 authored and ggatward committed Mar 13, 2018
1 parent a9b8b80 commit 1de89ad
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions clean_content_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ def get_cv(org_id, cleanup_list, keep):

return ver_list, ver_descr, ver_keep

def get_content_view_version(cvid):
cvv = helpers.get_json(
helpers.KATELLO_API + "content_view_versions/" + str(cvid))

return cvv

def get_content_view_info(cvid):
"""
Expand Down Expand Up @@ -135,8 +140,10 @@ def cleanup(ver_list, ver_descr, dry_run, runuser, ver_keep, cleanall, ignorefir
helpers.log_msg(msg, 'DEBUG')

for version in cvinfo['versions']:
# Find versions that are not in any environment
if not version['environment_ids']:
# Get composite content views for version
cvv = get_content_view_version(version['id'])
# Find versions that are not in any environment and not in any composite content view
if not version['environment_ids'] and not cvv['composite_content_view_ids']:
if not locked:
msg = "Orphan view version " + str(version['version']) + " found in '" +\
str(ver_descr[cvid]) + "'"
Expand Down

0 comments on commit 1de89ad

Please sign in to comment.