Skip to content

Move debug print before netbox_create_or_update#398

Open
shbatm wants to merge 1 commit intoSolvik:masterfrom
shbatm:fix/debug-print-order
Open

Move debug print before netbox_create_or_update#398
shbatm wants to merge 1 commit intoSolvik:masterfrom
shbatm:fix/debug-print-order

Conversation

@shbatm
Copy link

@shbatm shbatm commented Jan 19, 2026

Problem

Previously, if an error occurred during netbox_create_or_update(), the debug information would never be printed since print_debug() was called after the update operation. This made troubleshooting failures difficult since you couldn't see the data that was being sent to Netbox.

Solution

This PR moves the debug print to occur before the update attempt, ensuring debug data is visible even when errors occur. It also adds documentation for the --debug flag which was previously undocumented.

Changes

  • Moved server.print_debug() call in cli.py to execute before server.netbox_create_or_update(config)
  • Added Debug Mode section to README.md with usage examples
  • Added commented debug option to netbox_agent.yaml.example

Testing

The change preserves all existing functionality - debug output just occurs earlier in the execution flow.

🤖 Generated with Claude Code

Previously, if an error occurred during netbox_create_or_update(), the
debug information would never be printed since print_debug() was called
after the update. This moves the debug print to occur before the update
attempt, ensuring debug data is visible even when errors occur.

Also adds documentation for the --debug flag which was previously
undocumented in both README.md and the example config file.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@shbatm shbatm force-pushed the fix/debug-print-order branch from 3e1d9d7 to 34f18c0 Compare January 19, 2026 20:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant