Exemple #1
0
def show_package_releases(namespace, package_name):
    reponame = repo_name(namespace, package_name)
    media_type = getvalues().get('media_type', None)
    result = cnr.api.impl.registry.show_package_releases(reponame,
                                                         media_type=media_type,
                                                         package_class=Package)
    return jsonify(result)
Exemple #2
0
def delete_package(namespace, package_name, release, media_type):
    reponame = repo_name(namespace, package_name)
    result = cnr.api.impl.registry.delete_package(reponame,
                                                  release,
                                                  media_type,
                                                  package_class=Package)
    return jsonify(result)
Exemple #3
0
def show_package(namespace, package_name, release, media_type):
    reponame = repo_name(namespace, package_name)
    result = cnr.api.impl.registry.show_package(reponame,
                                                release,
                                                media_type,
                                                channel_class=Channel,
                                                package_class=Package)
    return jsonify(result)
Exemple #4
0
def add_channel_release(namespace, package_name, channel_name, release):
    reponame = repo_name(namespace, package_name)
    result = cnr.api.impl.registry.add_channel_release(reponame,
                                                       channel_name,
                                                       release,
                                                       channel_class=Channel,
                                                       package_class=Package)
    return jsonify(result)
Exemple #5
0
def build_tar(namespace, package_name, release, media_type):
    reponame = repo_name(namespace, package_name)
    k = _build(reponame, release, media_type)
    resp = current_app.make_response(k.build_tar())
    resp.mimetype = 'application/tar'
    resp.headers['Content-Disposition'] = 'filename="%s_%s.tar.gz"' % (
        k.name.replace("/", "_"), k.version)
    return resp
Exemple #6
0
def pull_json(namespace, package_name, release, media_type):
    reponame = repo_name(namespace, package_name)
    data = cnr.api.impl.registry.pull(reponame,
                                      release,
                                      media_type,
                                      Package,
                                      blob_class=Blob)
    return _pull(data, json_format=True)
Exemple #7
0
def pull(namespace, package_name, release, media_type):
    reponame = repo_name(namespace, package_name)
    data = cnr.api.impl.registry.pull(reponame,
                                      release,
                                      media_type,
                                      Package,
                                      blob_class=Blob)
    json_format = request.args.get('format', None) == 'json'
    return _pull(data, json_format=json_format)
Exemple #8
0
def push(namespace, package_name):
    reponame = repo_name(namespace, package_name)
    values = getvalues()
    release = values['release']
    media_type = values.get('media_type', DEFAULT_MEDIA_TYPE)
    force = (values.get('force', 'false') == 'true')
    metadata = values.get('metadata', None)
    blob = Blob(reponame, values['blob'])
    result = cnr.api.impl.registry.push(reponame,
                                        release,
                                        media_type,
                                        blob,
                                        force,
                                        Package,
                                        metadata=metadata)
    return jsonify(result)
Exemple #9
0
def build(namespace, package_name, release, media_type):
    reponame = repo_name(namespace, package_name)
    current_app.logger.info("generate %s", namespace, package_name)
    k = _build(reponame, release, media_type)
    return jsonify(k.build())
Exemple #10
0
def tree(namespace, package_name, release, media_type):
    reponame = repo_name(namespace, package_name)
    r = kpm.api.impl.builder.tree(
        reponame, endpoint=current_app.config['KPM_REGISTRY_HOST'])
    return jsonify(r)
Exemple #11
0
def show_file(namespace, package_name, filepath):
    reponame = repo_name(namespace, package_name)

    return kpm.api.impl.builder.show_file(
        reponame, filepath, endpoint=current_app.config['KPM_REGISTRY_HOST'])
Exemple #12
0
def blobs_json(namespace, package_name, digest):
    reponame = repo_name(namespace, package_name)
    data = cnr.api.impl.registry.pull_blob(reponame, digest, blob_class=Blob)
    return _pull(data, json_format=True)
Exemple #13
0
def blobs(namespace, package_name, digest):
    reponame = repo_name(namespace, package_name)
    data = cnr.api.impl.registry.pull_blob(reponame, digest, blob_class=Blob)
    json_format = request.args.get('format', None) == 'json'
    return _pull(data, json_format=json_format)
Exemple #14
0
def delete_channel(namespace, package_name, channel_name):
    reponame = repo_name(namespace, package_name)
    result = cnr.api.impl.registry.delete_channel(reponame,
                                                  channel_name,
                                                  channel_class=Channel)
    return jsonify(result)
Exemple #15
0
def show_channel(namespace, package_name, channel_name):
    reponame = repo_name(namespace, package_name)
    result = cnr.api.impl.registry.show_channel(reponame, channel_name,
                                                Channel)
    return jsonify(result)
Exemple #16
0
def list_channels(namespace, package_name):
    reponame = repo_name(namespace, package_name)
    result = cnr.api.impl.registry.list_channels(reponame, Channel)
    resp = current_app.make_response(json.dumps(result))
    resp.mimetype = 'application/json'
    return resp
Exemple #17
0
def show_package_release_manifests(namespace, package_name, release):
    reponame = repo_name(namespace, package_name)
    result = cnr.api.impl.registry.show_package_manifests(
        reponame, release, package_class=Package)
    return jsonify(result)