From 50da32c5f711c45a31f3113f1706e51ae9ea2a15 Mon Sep 17 00:00:00 2001 From: Moritz Warning Date: Sun, 24 May 2020 23:45:34 +0200 Subject: [PATCH] fix for different profiles.json format --- misc/collect.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/misc/collect.py b/misc/collect.py index 8ac6e76..e9b91d2 100755 --- a/misc/collect.py +++ b/misc/collect.py @@ -52,6 +52,9 @@ def add_profile(id, target, profile): for image in profile['images']: images.append({'name': image['name'], 'type': image['type']}) + if target is None: + target = profile['target'] + if args.change_prefix: change_prefix(images, 'openwrt-', args.change_prefix) @@ -89,7 +92,7 @@ for path in paths: try: if 'profiles' in obj: for id in obj['profiles']: - add_profile(id, obj['target'], obj['profiles'][id]) + add_profile(id, obj.get('target'), obj['profiles'][id]) else: add_profile(obj['id'], obj['target'], obj) except json.decoder.JSONDecodeError as e: -- 2.30.2