Datasources stuck in sync when using git + ssh from ./manage.py syncdatasource #8642

Closed
opened 2025-12-29 20:39:15 +01:00 by adam · 3 comments
Owner

Originally created by @jacobw on GitHub (Sep 19, 2023).

Originally assigned to: @jeremystretch on GitHub.

NetBox version

v3.6.1

Python version

3.11

Steps to Reproduce

In Data Sources
Add
Name: test
Type: git
URL: git@github.com:netbox-community/netbox.git
Create

docker compose exec netbox ./manage.py syncdatasource test

Expected Behavior

Usually leads to some sort of ssh question or failure, and I would expect the exception to set the status to failed, and then be able to hit sync again.

I'm not sure exactly how NetBox works, but looking at one of the exceptions...
core.exceptions.SyncError: Fetching remote data failed (HangupException):

class SyncError(Exception):
pass

Does this mean the status is not being reset correctly due to the status being left as syncing?

Observed Behavior

datasource.status = syncing in nbshell
'syncing' in gui
Sync option is now greyed out and cannot reset status without manually setting it in nbshell:

for d in DataSource.objects.filter(status='syncing'):
d.status = 'failed'
d.save()

Originally created by @jacobw on GitHub (Sep 19, 2023). Originally assigned to: @jeremystretch on GitHub. ### NetBox version v3.6.1 ### Python version 3.11 ### Steps to Reproduce In Data Sources Add Name: test Type: git URL: git@github.com:netbox-community/netbox.git Create docker compose exec netbox ./manage.py syncdatasource test ### Expected Behavior Usually leads to some sort of ssh question or failure, and I would expect the exception to set the status to failed, and then be able to hit sync again. I'm not sure exactly how NetBox works, but looking at one of the exceptions... core.exceptions.SyncError: Fetching remote data failed (HangupException): class SyncError(Exception): pass Does this mean the status is not being reset correctly due to the status being left as syncing? ### Observed Behavior datasource.status = syncing in nbshell 'syncing' in gui Sync option is now greyed out and cannot reset status without manually setting it in nbshell: for d in DataSource.objects.filter(status='syncing'): d.status = 'failed' d.save()
adam added the type: bugstatus: acceptedseverity: low labels 2025-12-29 20:39:15 +01:00
adam closed this issue 2025-12-29 20:39:15 +01:00
Author
Owner

@jeremystretch commented on GitHub (Sep 21, 2023):

This appears to be a bug in the syncdatasource management command specifically: Testing using the normal sync (via a background job) returns the status to failed as expected.

@jeremystretch commented on GitHub (Sep 21, 2023): This appears to be a bug in the `syncdatasource` management command specifically: Testing using the normal sync (via a background job) returns the status to failed as expected.
Author
Owner

@jacobw commented on GitHub (Sep 21, 2023):

I originally started investigating this as I was getting this issue via the gui, I think that was version 3.6.0. When I did some more testing in my test environment I was only getting the issue via the syncdatasource command, so that all I included in the issue. So either the other issue was just fixed, or there are some other potential code paths in the gui that end up leaving it run sync. I had been working my way through a number of scenarios in my prod environment so not easy to say what the difference was

@jacobw commented on GitHub (Sep 21, 2023): I originally started investigating this as I was getting this issue via the gui, I think that was version 3.6.0. When I did some more testing in my test environment I was only getting the issue via the syncdatasource command, so that all I included in the issue. So either the other issue was just fixed, or there are some other potential code paths in the gui that end up leaving it run sync. I had been working my way through a number of scenarios in my prod environment so not easy to say what the difference was
Author
Owner

@github-actions[bot] commented on GitHub (Dec 21, 2023):

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. NetBox is governed by a small group of core maintainers which means not all opened issues may receive direct feedback. Do not attempt to circumvent this process by "bumping" the issue; doing so will result in its immediate closure and you may be barred from participating in any future discussions. Please see our contributing guide.

@github-actions[bot] commented on GitHub (Dec 21, 2023): This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. NetBox is governed by a small group of core maintainers which means not all opened issues may receive direct feedback. **Do not** attempt to circumvent this process by "bumping" the issue; doing so will result in its immediate closure and you may be barred from participating in any future discussions. Please see our [contributing guide](https://github.com/netbox-community/netbox/blob/develop/CONTRIBUTING.md).
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#8642