Skip to content

Commit

Permalink
Clean composite content views first
Browse files Browse the repository at this point in the history
Addresses issue #51
  • Loading branch information
benformosa committed Apr 13, 2019
1 parent 48e2aac commit d8278a4
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions clean_content_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#pylint: disable-msg=R0912,R0913,R0914,R0915

import sys, argparse
import collections
import simplejson as json
import helpers

Expand All @@ -22,11 +23,14 @@ def get_cv(org_id, cleanup_list, keep):
# Query API to get all content views for our org
cvs = helpers.get_json(
helpers.KATELLO_API + "organizations/" + str(org_id) + "/content_views/")
ver_list = {}
ver_descr = {}
ver_keep = {}
ver_list = collections.OrderedDict()
ver_descr = collections.OrderedDict()
ver_keep = collections.OrderedDict()

for cv_result in cvs['results']:
# Sort the CVS so that composites are considered first
cv_results = sorted(cvs['results'], key=lambda k: k[u'composite'], reverse=True)

for cv_result in cv_results:
# We will never clean the DOV
if cv_result['name'] != "Default Organization View":
# Handle specific includes
Expand Down

0 comments on commit d8278a4

Please sign in to comment.