mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-23 20:51:03 +02:00
tools: ynl: load jsonschema on demand
The CLI script tries to validate jsonschema by default. It's seems better to validate too many times than too few. However, when copying the scripts to random servers having to install jsonschema is tedious. Load jsonschema via importlib, and let the user opt out. Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
@@ -13,6 +13,7 @@ def main():
|
||||
parser = argparse.ArgumentParser(description='YNL CLI sample')
|
||||
parser.add_argument('--spec', dest='spec', type=str, required=True)
|
||||
parser.add_argument('--schema', dest='schema', type=str)
|
||||
parser.add_argument('--no-schema', action='store_true')
|
||||
parser.add_argument('--json', dest='json_text', type=str)
|
||||
parser.add_argument('--do', dest='do', type=str)
|
||||
parser.add_argument('--dump', dest='dump', type=str)
|
||||
@@ -20,6 +21,9 @@ def main():
|
||||
parser.add_argument('--subscribe', dest='ntf', type=str)
|
||||
args = parser.parse_args()
|
||||
|
||||
if args.no_schema:
|
||||
args.schema = ''
|
||||
|
||||
attrs = {}
|
||||
if args.json_text:
|
||||
attrs = json.loads(args.json_text)
|
||||
|
Reference in New Issue
Block a user