Since the package split, now there are various different Ceph components to
    install like:

    * ceph
    * ceph-mon
    * ceph-mgr
    * ceph-osd
    * ceph-mds

    This helper function should parse the args that may contain specifics about
    these flags and return the default if none are passed in (which is, install
    everything)

def detect_components(args, distro):
    """
    Since the package split, now there are various different Ceph components to
    install like:

    * ceph
    * ceph-mon
    * ceph-mgr
    * ceph-osd
    * ceph-mds

    This helper function should parse the args that may contain specifics about
    these flags and return the default if none are passed in (which is, install
    everything)
    """
    # the flag that prevents all logic here is the `--repo` flag which is used
    # when no packages should be installed, just the repo files, so check for
    # that here and return an empty list (which is equivalent to say 'no
    # packages should be installed')
    if args.repo:
        return []

    flags = {
        'install_osd': 'ceph-osd',
        'install_rgw': 'ceph-radosgw',
        'install_mds': 'ceph-mds',
        'install_mon': 'ceph-mon',
        'install_mgr': 'ceph-mgr',
        'install_common': 'ceph-common',
        'install_tests': 'ceph-test',
    }

    if distro.is_rpm:
        defaults = default_components.rpm
    elif distro.is_pkgtarxz:
        # archlinux doesn't have components!
        flags = {
            'install_osd': 'ceph',
            'install_rgw': 'ceph',
            'install_mds': 'ceph',
            'install_mon': 'ceph',
            'install_mgr': 'ceph',
            'install_common': 'ceph',
            'install_tests': 'ceph',
        }
        defaults = default_components.pkgtarxz
    else:
        defaults = default_components.deb
        # different naming convention for deb than rpm for radosgw
        flags['install_rgw'] = 'radosgw'

    if args.install_all:
        return defaults
    else:
        components = []
        for k, v in flags.items():
            if getattr(args, k, False):
                components.append(v)
        # if we have some components selected from flags then return that,
        # otherwise return defaults because no flags and no `--repo` means we
        # should get all of them by default
        return components or defaults