Skip to content

Conversation

@jeremystretch
Copy link
Contributor

Fixes: #371

This specifically addresses a known issue with sorl-thumbnail, but applies a general workaround.

@jeremystretch jeremystretch requested review from a team and arthanson and removed request for a team November 27, 2025 15:47
@aoforb
Copy link

aoforb commented Nov 28, 2025

Thanks for this, I've applied the change manually and its fixed the issue.

try:
module = importlib.import_module(f'{app_label}.migrations.{name}')
except ModuleNotFoundError:
logger = logging.getLogger('netbox_branching.branch')
Copy link
Contributor

@bctiemann bctiemann Nov 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see the pattern in this file is to instantiate a new logger for every log line, which I guess makes sense since they're all routed differently for different purposes; but I'd think a more common/less chatty pattern would be to declare all the various loggers at the top instead of ad-hoc. Just a note for consideration though, not a reason to block this merge.

Copy link
Contributor Author

@jeremystretch jeremystretch Nov 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think in this case it's okay because we're only invoking the logger in the event a failure occurs, which should be rare. We should probably devise a more robust logging strategy generally, but that's outside the scope of this bug fix.

@jeremystretch jeremystretch merged commit f60dd0c into main Nov 29, 2025
12 checks passed
@jeremystretch jeremystretch deleted the 371-ModuleNotFoundError-on-merge branch November 29, 2025 16:29
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.

ModuleNotFoundError exception raised when attempting to merge a branch after upgrading to NetBox v4.4

4 participants