示例#1
0
def mom_version(name='marathon-user'):
    """Returns the version of marathon on marathon.
    """
    if service_available_predicate(name):
        with marathon_on_marathon(name):
            return marathon_version()
    else:
        # We can either skip the corresponding test by returning False
        # or raise an exception.
        print('WARN: {} MoM not found. Version is None'.format(name))
        return None
def remove_mom_ee():
    mom_ee_versions = [('1.6', 'strict'), ('1.6', 'permissive'),
                       ('1.5', 'strict'), ('1.5', 'permissive'),
                       ('1.4', 'strict'), ('1.4', 'permissive')]
    for mom_ee in mom_ee_versions:
        endpoint = mom_ee_endpoint(mom_ee[0], mom_ee[1])
        logger.info('Checking endpoint: {}'.format(endpoint))
        if service_available_predicate(endpoint):
            logger.info('Removing {}...'.format(endpoint))
            with marathon_on_marathon(name=endpoint) as client:
                delete_all_apps(client=client)

    client = marathon.create_client()
    client.remove_app(MOM_EE_NAME)
    common.deployment_wait(MOM_EE_NAME)
    logger.info('Successfully removed {}'.format(MOM_EE_NAME))
示例#3
0
def cluster_info(mom_name='marathon-user'):
    logger.info("DC/OS: %s, in %s mode", dcos_version(), ee_version())
    agents = get_private_agents()
    logger.info("Agents: %d", len(agents))
    client = marathon.create_client()
    about = client.get_about()
    logger.info("Marathon version: %s", about.get("version"))

    if service_available_predicate(mom_name):
        with marathon_on_marathon(mom_name) as client:
            try:
                about = client.get_about()
                logger.info("Marathon MoM version: {}".format(about.get("version")))
            except Exception:
                logger.info("Marathon MoM not present")
    else:
        logger.info("Marathon MoM not present")
示例#4
0
文件: common.py 项目: zz38/marathon
def cluster_info(mom_name='marathon-user'):
    logger.info("DC/OS: %s, in %s mode", dcos_version(), ee_version())
    agents = get_private_agents()
    logger.info("Agents: %d", len(agents))
    client = marathon.create_client()
    about = client.get_about()
    logger.info("Marathon version: %s", about.get("version"))

    if service_available_predicate(mom_name):
        with marathon_on_marathon(mom_name) as client:
            try:
                about = client.get_about()
                logger.info("Marathon MoM version: {}".format(
                    about.get("version")))
            except Exception:
                logger.info("Marathon MoM not present")
    else:
        logger.info("Marathon MoM not present")
示例#5
0
def mom_version_less_than(version, name='marathon-user'):
    """ Returns True if MoM with the given {name} exists and has a version less
        than {version}. Note that if MoM does not exist False is returned.

        :param version: required version
        :type: string
        :param name: MoM name, default is 'marathon-user'
        :type: string
        :return: True if version < MoM version
        :rtype: bool
    """
    if service_available_predicate(name):
        return mom_version() < LooseVersion(version)
    else:
        # We can either skip the corresponding test by returning False
        # or raise an exception.
        print('WARN: {} MoM not found. mom_version_less_than({}) is False'.
              format(name, version))
        return False
def remove_mom_ee():
    mom_ee_versions = [
        ('1.7', 'strict'),
        ('1.7', 'permissive'),
        ('1.6', 'strict'),
        ('1.6', 'permissive'),
        ('1.5', 'strict'),
        ('1.5', 'permissive')
    ]
    for mom_ee in mom_ee_versions:
        endpoint = mom_ee_endpoint(mom_ee[0], mom_ee[1])
        logger.info('Checking endpoint: {}'.format(endpoint))
        if service_available_predicate(endpoint):
            logger.info('Removing {}...'.format(endpoint))
            with marathon_on_marathon(name=endpoint) as client:
                delete_all_apps(client=client)

    client = marathon.create_client()
    client.remove_app(MOM_EE_NAME)
    deployment_wait(MOM_EE_NAME)
    logger.info('Successfully removed {}'.format(MOM_EE_NAME))