From 4a1ee151b3cb054d84cd964fd62f5855f765751d Mon Sep 17 00:00:00 2001 From: Kelly Brazil Date: Wed, 2 Mar 2022 10:57:09 -0800 Subject: [PATCH] add dhcp6 options to docs --- docs/parsers/nmcli.md | 4 ++++ jc/parsers/nmcli.py | 16 +++++----------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/docs/parsers/nmcli.md b/docs/parsers/nmcli.md index 9d735c61..518f24bf 100644 --- a/docs/parsers/nmcli.md +++ b/docs/parsers/nmcli.md @@ -50,6 +50,10 @@ Schema: "name": string, "value": string/integer/float, }, + "dhcp6_option_x": { + "name": string, + "value": string/integer/float, + }, "ip4_route_x": { "dst": string, "nh": string, diff --git a/jc/parsers/nmcli.py b/jc/parsers/nmcli.py index f7be36cd..d71575a4 100644 --- a/jc/parsers/nmcli.py +++ b/jc/parsers/nmcli.py @@ -45,6 +45,10 @@ Schema: "name": string, "value": string/integer/float, }, + "dhcp6_option_x": { + "name": string, + "value": string/integer/float, + }, "ip4_route_x": { "dst": string, "nh": string, @@ -185,17 +189,7 @@ def _process(proc_data: List[Dict]) -> List[Dict]: except Exception: pass - if '_option_' in key and key[-1].isdigit(): - for k in entry[key]: - try: - if '.' in entry[key][k]: - entry[key][k] = float(entry[key][k]) - else: - entry[key][k] = int(entry[key][k]) - except Exception: - pass - - if '_route_' in key and key[-1].isdigit(): + if ('_option_' in key or '_route_' in key) and key[-1].isdigit(): for k in entry[key]: try: if '.' in entry[key][k]: