From 36549e3a2c8f5f938a30d9e26a7bc42e652c1b7c Mon Sep 17 00:00:00 2001 From: Doug Goldstein Date: Wed, 20 May 2026 13:44:51 -0500 Subject: [PATCH] fix(neutron): avoid exception when undersync does not return JSON Avoid an exception when undersync does not return JSON in its reply. --- .../neutron_understack/undersync.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/python/neutron-understack/neutron_understack/undersync.py b/python/neutron-understack/neutron_understack/undersync.py index e6b991773..77bcc2891 100644 --- a/python/neutron-understack/neutron_understack/undersync.py +++ b/python/neutron-understack/neutron_understack/undersync.py @@ -89,10 +89,13 @@ def _undersync_post(self, action: str, vlan_group: str) -> requests.Response: response = self.client.post( f"{self.api_url}/v1/vlan-group/{vlan_group}/{action}", timeout=self.timeout ) - LOG.debug( - "undersync %(action)s resp: %(resp)s", - {"resp": response.json(), "action": action}, - ) + try: + LOG.debug( + "undersync %(action)s resp: %(resp)s", + {"resp": response.json(), "action": action}, + ) + except requests.exceptions.JSONDecodeError: + LOG.debug("undersync %s non-JSON resp: %s", action, response.text) self._log_and_raise_for_status(response) return response