Beispiel #1
0
def get_channel_ids_from_omaha_server(host, headers, logging):
    """
    Channel IDs can change between Omaha servers and over time
    may even change on the same Omaha server. Get all IDs from
    the server versus hardcoding in an enum like we do above
    with Event IDs or Platform IDs.
    """
    url = 'https://' + host + '/api/channel'
    response = get(url, headers)
    if response.status_code != 200:
        logging.error("ERROR: Cannot GET /api/channel from Omaha host {}! "
                      "response.status_code : {}".format(host, response.status_code))
        exit(1)
    return response.json()
Beispiel #2
0
def get_omaha_version_id(channel, version, host, headers, logging):
    channel_id = get_channel_id(channel, host, headers, logging)
    url = 'https://' + host + '/api/omaha/version?version=' + version
    response = get(url, headers)
    if response.status_code != 200:
        logging.error(
            'ERROR: Cannot GET /api/omaha/version from Omaha host {}! '
            'response.status_code: {}'.format(host, response.status_code))
        logging.error(response.raise_for_status())
        exit(1)
    id = next(
        item['id'] for item in response.json()
        if (item['channel'] == channel_id and item['version'] == version))
    return id
Beispiel #3
0
def get_channel_ids_from_omaha_server(host, headers, logging):
    """
    Channel IDs can change between Omaha servers and over time
    may even change on the same Omaha server. Get all IDs from
    the server versus hardcoding in an enum like we do above
    with Event IDs or Platform IDs.
    """
    url = 'https://' + host + '/api/channel'
    response = get(url, headers)
    if response.status_code != 200:
        logging.error("ERROR: Cannot GET /api/channel from Omaha host {}! "
                      "response.status_code: {}".format(host, response.status_code))
        logging.error(response.raise_for_status())
        exit(1)
    return response.json()