b96135c218065188be9dfe1fea1dff76b6f66e4f,app/grandchallenge/container_exec/tasks.py,,validate_docker_image_async,#,15

Before Change


            instance.image.save(uploaded_image.name, File(f))

    try:
        with instance.image.open(mode="rb") as im, tarfile.open(
            fileobj=im, mode="r"
        ) as t:
            member = dict(zip(t.getnames(), t.getmembers()))["manifest.json"]
            manifest = t.extractfile(member).read()
    except (KeyError, tarfile.ReadError):
        model.objects.filter(pk=pk).update(
            status=(
                "manifest.json not found at the root of the container image file. "

After Change



    image_sha256 = manifest[0]["Config"][:64]

    config = _extract_docker_image_file(
        model, instance, f"{image_sha256}.json"
    )
    config = json.loads(config)

    if str(config["config"]["User"].lower()) in ["", "root", "0"]:
        model.objects.filter(pk=pk).update(
            status=(
                "The container runs as root. Please add a user, group and USER "
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 6

Instances


Project Name: comic/grand-challenge.org
Commit Name: b96135c218065188be9dfe1fea1dff76b6f66e4f
Time: 2019-02-26
Author: code@jmsmkn.com
File Name: app/grandchallenge/container_exec/tasks.py
Class Name:
Method Name: validate_docker_image_async


Project Name: AxeldeRomblay/MLBox
Commit Name: b4489997dc5b04e614e9919634461110a27cdba5
Time: 2017-06-27
Author: nicolas.cherel@telecom-paristech.fr
File Name: python-package/setup.py
Class Name:
Method Name:


Project Name: deepmipt/DeepPavlov
Commit Name: f7062eca7c924ee2a58d1255a4efb06b31b63110
Time: 2017-12-26
Author: ol.gure@gmail.com
File Name: deeppavlov/models/intent_recognition/intent_keras/intent_model.py
Class Name: KerasIntentModel
Method Name: save