Example #1
0
def lookup(webapp_manifest_url):
    """
    Looks in S3 for an existing key for the manifest URL.  If not found,
    generates a new one, stores in S3, and then attempts fetches from S3.
    """
    try:
        return storage.get_app_key(webapp_manifest_url)
    except storage.NoSuchKey:
        generate(webapp_manifest_url)
        return storage.get_app_key(webapp_manifest_url)
Example #2
0
def get_keystore(apk_id):
    """
    Returns an open file object for a key store.

    An end-user keystore will be generated and saved to S3 if it doesn't
    exist. Reviewer keystores are always generated.
    """
    if get_user_mode() == 'REVIEWER':
        log.info('reviewer mode: generating a new keystore')
        # Always generate new key stores for reviewers.
        # Thus, we don't need to store them.
        return make_keystore(apk_id, store=False)
    else:
        log.info('end-user mode: fetching/generating/storing keystore')
        try:
            # TODO: maybe check for expired key stores. In other words,
            # this code will break in 10 years :)
            return storage.get_app_key(apk_id)
        except NoSuchKey:
            return make_keystore(apk_id)
Example #3
0
def get_keystore(apk_id):
    """
    Returns an open file object for a key store.

    An end-user keystore will be generated and saved to S3 if it doesn't
    exist. Reviewer keystores are always generated.
    """
    if get_user_mode() == 'REVIEWER':
        log.info('reviewer mode: generating a new keystore')
        # Always generate new key stores for reviewers.
        # Thus, we don't need to store them.
        return make_keystore(apk_id, store=False)
    else:
        log.info('end-user mode: fetching/generating/storing keystore')
        try:
            # TODO: maybe check for expired key stores. In other words,
            # this code will break in 30 years :)
            return storage.get_app_key(apk_id)
        except NoSuchKey:
            return make_keystore(apk_id)