示例#1
0
文件: api.py 项目: alex/services
def post_taskcluster(body):
    # TODO: need to make this route work
    credentials = []

    # XXX: it should get authenticated via Authenticated header
    client_id = current_app.config.get('TASKCLUSTER_CLIENT_ID')
    access_token = current_app.config.get('TASKCLUSTER_ACCESS_TOKEN')

    if client_id and access_token:
        credentials = [dict(
            credentials=dict(
                clientId=client_id,
                accessToken=access_token,
            ))]

    purge_cache = taskcluster.PurgeCache(*credentials)

    for item in body:
        purge_cache.purgeCache(item.provisionerId,
                               item.workerType,
                               dict(cacheName=item.cacheName))

    return None
示例#2
0
def post_tc_purgecache(body):
    ''' Purge cache on taskcluster. '''

    credentials = []

    client_id = current_app.config['TASKCLUSTER_CLIENT_ID']
    access_token = current_app.config['TASKCLUSTER_ACCESS_TOKEN']

    if client_id and access_token:
        credentials = [{
            'credentials': {
                'clientId': client_id,
                'accessToken': access_token,
            },
        }]

    purge_cache = taskcluster.PurgeCache(*credentials)

    for item in body:
        purge_cache.purgeCache(item.provisionerId, item.workerType,
                               {'cacheName': item.cacheName})

    return None
def tc_purgecache(body):
    """Purge cache on taskcluster
    """

    credentials = []

    client_id = current_app.config.get('TASKCLUSTER_CLIENT_ID')
    access_token = current_app.config.get('TASKCLUSTER_ACCESS_TOKEN')

    if client_id and access_token:
        credentials = [dict(
            credentials=dict(
                clientId=client_id,
                accessToken=access_token,
            ))]

    purge_cache = taskcluster.PurgeCache(*credentials)

    for item in body:
        purge_cache.purgeCache(item.provisionerId,
                               item.workerType,
                               dict(cacheName=item.cacheName))

    return None