RedHatSatellite / ballista

Modular and easily extendable tool to manipulate Katello/Satellite 6
GNU General Public License v3.0
16 stars 10 forks source link

Ability to exclude CCV with chain-publish #12

Closed gorantornqvist closed 7 years ago

gorantornqvist commented 7 years ago

It would be nice to be able to exclude a CCV when chain publishing CVs.

My quick and dirty fix (since I found no easy way to pass additional parameters to the katlibs) was to pass a string like "exclude_ccv:MyCCVNameToExclude" to ballista.

In: katlibs/modules/chain_publish.py recursive_update() row before # Get ids of views

    excludes = [a for a in cvs if "exclude_ccv:" in a]
    real_cvs = [b for b in cvs if b not in excludes]
    cvs = real_cvs
    for index, item in enumerate(excludes):
        pos = item.index(':')+1
        value = item[pos:]
        excludes[index] = value

And in the loop # Find which composites are impacted - changed to:

for view in all_views:
        if view['composite'] and set([i['content_view_id'] for i in view['components']]).intersection(
                viewids_to_update):
            if view['name'] in excludes:
                logger.info('Excluding CCV {}'.format(view['name']))
            else:
                logger.info('We need to update {}'.format(view['name']))
                comps_to_update.append(view)

Example: /opt/ballista/ballista.py -c /path/to/config.ini chain-publish "RHEL7" "exclude_ccv:RHEL7 Satellite SOE"

joeyloman commented 7 years ago

@gorantornqvist chain-publish now contains the --exclude option, for example: /opt/ballista/ballista.py -c /path/to/config.ini chain-publish "RHEL7" --exclude "RHEL7 Satellite SOE"