Example #1
0
def compare_oc_version(compare_to, operator):
    """

    :param compare_to: E.g. '9.0'
    :param operator: One of '<', '=', '>', '<=', '>='
    :return:
    """
    oc_api = get_oc_api()
    url = oc_api.url + 'status.php'
    rtn_code, std_out, std_err = runcmd('curl %s' % url, log_warning=False)

    import json
    version = (json.loads(std_out))['version']

    return version_compare(version, operator, compare_to)
Example #2
0
def compare_oc_version(compare_to, operator):
    """

    :param compare_to: E.g. '9.0'
    :param operator: One of '<', '=', '>', '<=', '>='
    :return:
    """
    oc_api = get_oc_api()
    url = oc_api.url + 'status.php'
    rtn_code, std_out, std_err = runcmd('curl %s' % url, log_warning=False)

    import json
    version = (json.loads(std_out))['version']

    return version_compare(version, operator, compare_to)
Example #3
0
def compare_client_version(compare_to, operator):
    """

    :param compare_to: E.g. '2.1'
    :param operator: One of '<', '=', '>', '<=', '>='
    :return:
    """

    cmd = config.oc_sync_cmd
    cmd = cmd[:cmd.find(' --')]
    cmd += ' --version'
    rtn_code, std_out, std_err = runcmd(cmd)

    version = std_out[std_out.find(' version ') + 9:]
    if version[-4:-1] == 'git':
        version = version[:-4]

    return version_compare(version, operator, compare_to)
Example #4
0
def compare_client_version(compare_to, operator):
    """

    :param compare_to: E.g. '2.1'
    :param operator: One of '<', '=', '>', '<=', '>='
    :return:
    """

    cmd = config.oc_sync_cmd
    cmd = cmd[:cmd.find(' --')]
    cmd += ' --version'
    rtn_code, std_out, std_err = runcmd(cmd)

    version = std_out[std_out.find(' version ') + 9:]
    if version[-4:-1] == 'git':
        version = version[:-4]

    return version_compare(version, operator, compare_to)