From 37b9fd8ceee50867535d497c3e8cc1fe4e5d78e8 Mon Sep 17 00:00:00 2001 From: Marek Skrobacki Date: Wed, 25 Sep 2024 10:09:17 +0100 Subject: [PATCH] chore: pretty print undersync's response So that it is somewhat more readable. --- .../understack_workflows/main/undersync_device.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/python/understack-workflows/understack_workflows/main/undersync_device.py b/python/understack-workflows/understack_workflows/main/undersync_device.py index af24f5261..525bec79f 100644 --- a/python/understack-workflows/understack_workflows/main/undersync_device.py +++ b/python/understack-workflows/understack_workflows/main/undersync_device.py @@ -1,7 +1,9 @@ import argparse import os +from pprint import pprint import sys from uuid import UUID + import requests from understack_workflows.helpers import boolean_args @@ -49,9 +51,12 @@ def update_nautobot_for_provisioning( device_id, interface_mac, new_status ) vlan_group_id = vlan_group_id_for(interface.device.id, nautobot) - logger.debug(f"Switch interface {interface.device} {interface} found in {vlan_group_id=}") + logger.debug( + f"Switch interface {interface.device} {interface} found in {vlan_group_id=}" + ) return vlan_group_id + def vlan_group_id_for(device_id, nautobot): result = nautobot.session.graphql.query( '{device(id: "%s") { rel_vlan_group_to_devices {id}}}' % device_id @@ -155,7 +160,7 @@ def main(): vlan_group_id = update_nautobot(args) response = call_undersync(args, vlan_group_id) - logger.info(f"Undersync returned: {response.json()}") + logger.info(f"Undersync returned: {pprint(response.json())}") if __name__ == "__main__":