<commit_before>import argparse
import logging
import os

from ceph_deploy import hosts
from ceph_deploy.cliutil import priority
from ceph_deploy.lib import remoto


LOG = logging.getLogger(__name__)


def sanitize_args(args):
    """
    args may need a bunch of logic to set proper defaults that argparse is
    not well suited for.
    """
    if args.release is None:
        args.release = 'giant'
        args.default_release = True

    # XXX This whole dance is because --stable is getting deprecated
    if args.stable is not None:
        LOG.warning('the --stable flag is deprecated, use --release instead')
        args.release = args.stable
    # XXX Tango ends here.

    return args


def install(args):
    args = sanitize_args(args)
    if args.repo:
        return install_repo(args)

    if args.version_kind == 'stable':
        version = args.release
    else:
        version = getattr(args, args.version_kind)

    version_str = args.version_kind

    if version:
        version_str += ' version {version}'.format(version=version)
    LOG.debug(
        'Installing %s on cluster %s hosts %s',
        version_str,
        args.cluster,
        ' '.join(args.host),
    )

    for hostname in args.host:
        LOG.debug('Detecting platform for host %s ...', hostname)
        distro = hosts.get(
            hostname,
            username=args.username,
            # XXX this should get removed once ceph packages are split for
            # upstream. If default_release is True, it means that the user is
            # trying to install on a RHEL machine and should expect to get RHEL
            # packages. Otherwise, it will need to specify either a specific
            # version, or repo, or a development branch.
            use_rhceph=args.default_release,
            )
        LOG.info(
            'Distro info: %s %s %s',
            distro.name,
            distro.release,
            distro.codename
        )

        if distro.init == 'sysvinit' and args.cluster != 'ceph':
            LOG.error('refusing to install on host: %s, with custom cluster name: %s' % (
                    hostname,
                    args.cluster,
                )
            )
            LOG.error('custom cluster names are not supported on sysvinit hosts')
            continue

        rlogger = logging.getLogger(hostname)
        rlogger.info('installing ceph on %s' % hostname)
<commit_msg>add explanation for other distros in the new flag for RHEL<commit_after>import argparse
import logging
import os

from ceph_deploy import hosts
from ceph_deploy.cliutil import priority
from ceph_deploy.lib import remoto


LOG = logging.getLogger(__name__)


def sanitize_args(args):
    """
    args may need a bunch of logic to set proper defaults that argparse is
    not well suited for.
    """
    if args.release is None:
        args.release = 'giant'
        args.default_release = True

    # XXX This whole dance is because --stable is getting deprecated
    if args.stable is not None:
        LOG.warning('the --stable flag is deprecated, use --release instead')
        args.release = args.stable
    # XXX Tango ends here.

    return args


def install(args):
    args = sanitize_args(args)
    if args.repo:
        return install_repo(args)

    if args.version_kind == 'stable':
        version = args.release
    else:
        version = getattr(args, args.version_kind)

    version_str = args.version_kind

    if version:
        version_str += ' version {version}'.format(version=version)
    LOG.debug(
        'Installing %s on cluster %s hosts %s',
        version_str,
        args.cluster,
        ' '.join(args.host),
    )

    for hostname in args.host:
        LOG.debug('Detecting platform for host %s ...', hostname)
        distro = hosts.get(
            hostname,
            username=args.username,
            # XXX this should get removed once ceph packages are split for
            # upstream. If default_release is True, it means that the user is
            # trying to install on a RHEL machine and should expect to get RHEL
            # packages. Otherwise, it will need to specify either a specific
            # version, or repo, or a development branch. Other distro users should
            # not see any differences.
            use_rhceph=args.default_release,
            )
        LOG.info(
            'Distro info: %s %s %s',
            distro.name,
            distro.release,
            distro.codename
        )

        if distro.init == 'sysvinit' and args.cluster != 'ceph':
            LOG.error('refusing to install on host: %s, with custom cluster name: %s' % (
                    hostname,
                    args.cluster,
                )
            )
            LOG.error('custom cluster names are not supported on sysvinit hosts')
            continue

        rlogger = logging.getLogger(hostname)
        rlogger.info('installing ceph on %s' % hostname)

{'fraction_non_alphanumeric': 0.07953169156237384, 'fraction_numerical': 0.0, 'mean_word_length': 2.0012113870381585, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3476647', 'n_tokens_mistral': 1375, 'n_tokens_neox': 1329, 'n_words': 470}