#3154 json-compatible kiwi result file parsing
Closed by tkopecek. Opened by tkopecek.
tkopecek/koji kiwi2  into  master

Download 3154.patch

In transition period we should parse both (pickle/json) formats.

80512 kiwiBuild (noarch): open (koji-builder02.na.intgdc.com) -> FAILED: Fault: <Fault 1: 'Traceback (most recent call last):\n  File "/usr/lib/python3.6/site-packages/koji/daemon.py", line 1458, in runTask\n    response = (handler.run(),)\n  File "/usr/lib/python3.6/site-packages/koji/tasks.py", line 335, in run\n    return koji.util.call_with_argcheck(self.handler, self.params, self.opts)\n  File "/usr/lib/python3.6/site-packages/koji/util.py", line 271, in call_with_argcheck\n    return func(*args, **kwargs)\n  File "/usr/lib/koji-builder-plugins/kiwi.py", line 375, in handler\n    open(joinpath(broot.rootdir(), target_dir[1:], \'kiwi.result\'), \'rb\'))\n  File "/usr/lib64/python3.6/json/__init__.py", line 299, in load\n    parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw)\n  File "/usr/lib64/python3.6/json/__init__.py", line 349, in loads\n    s = s.decode(detect_encoding(s), \'surrogatepass\')\nUnicodeDecodeError: \'utf-8\' codec can\'t decode byte 0x80 in position 0: invalid start byte\n'>

aha, that's probably because the filename is different: /mnt/ebs/mock/privatecloud-c9s-build-3534-36376/root/builddir/result/image/kiwi.result.json

I think this one needs to also cover FileNotFoundError raised by open() if file not found (aka kiwi.result.json)

also this one should be { "result_files": json.load()… }

Example of the json file generated by kiwi:

{
    "disk_image": {
        "compress": true,
        "filename": "/builddir/result/image/gdc-c9s.x86_64-1.0.0.raw",
        "shasum": true,
        "use_for_bundle": true
    },
    "image_changes": {
        "compress": true,
        "filename": "/builddir/result/image/gdc-c9s.x86_64-1.0.0.changes",
        "shasum": false,
        "use_for_bundle": true
    },
    "image_packages": {
        "compress": false,
        "filename": "/builddir/result/image/gdc-c9s.x86_64-1.0.0.packages",
        "shasum": false,
        "use_for_bundle": true
    },
    "image_verified": {
        "compress": false,
        "filename": "/builddir/result/image/gdc-c9s.x86_64-1.0.0.verified",
        "shasum": false,
        "use_for_bundle": true
    }
}

Fixed alternative: https://pagure.io/koji/pull-request/3198

Pull-Request has been closed by tkopecek

Metadata