Skip to content

Commit b3099f7

Browse files
committed
Fix error in ifquery -c -o json <tunnel interface>
In ifupdown/iface.py, class ifaceJsonEncoderWithStatus(json.JSONEncoder), in the for-loop, it fails for the IPNetwork objects (keys tunnel-endpoint and tunnel-remote) since they are not of type string. Converting the value(s) to string in the loop resolved it. ``` $ ifquery -c -o json gre1 error: main exception: 'IPNetwork' object has no attribute 'config' ``` Tested with a GRE tunnel, first reported by another user on the Proxmox forum https://forum.proxmox.com/threads/sdn-tunnel-status-problem.160608/ and reported to the Proxmox bug tracker https://bugzilla.proxmox.com/show_bug.cgi?id=6078 Signed-off-by: Thomas Kupper <thomas.kupper@gmail.com>
1 parent d1c8309 commit b3099f7

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

ifupdown2/ifupdown/iface.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ def default(self, o):
320320
status_str = ifaceStatusUserStrs.UNKNOWN
321321
vitem_status.append('%s' %status_str)
322322
idx += 1
323-
retconfig[k] = v[0] if len(v) == 1 else v
323+
retconfig[k] = str(v[0] if len(v) == 1 else v)
324324
retconfig_status[k] = vitem_status[0] if len(vitem_status) == 1 else vitem_status
325325

326326
if (o.status == ifaceStatus.NOTFOUND or

0 commit comments

Comments
 (0)