ERROR:root:Fetching remote data failed (AttributeError): 'NoneType' object has no attribute 'encode' #8515

Closed
opened 2025-12-29 20:37:40 +01:00 by adam · 5 comments
Owner

Originally created by @chuegel on GitHub (Aug 26, 2023).

NetBox version

v3.5.8

Python version

3.10

Steps to Reproduce

We want to setup a git (gitlab on premis) data source.

  1. create a personal access token (all read permissions granted)
  2. setup data source in netbox:
    2.1 URL: https://our-gitlab.com/project.git
    2.2 username: myuser
    2.3 password: (access-token)
  3. Branch: main

The sync erroers out immediately with following error:

09:05:11 default: core.jobs.sync_datasource(job=<Job: 7c7bfb03-a363-433b-ae81-b0f43a4e52c9>) (7c7bfb03-a363-433b-ae81-b0f43a4e52c9)
ERROR:root:Fetching remote data failed (AttributeError): 'NoneType' object has no attribute 'encode'
09:05:12 default: Job OK (7c7bfb03-a363-433b-ae81-b0f43a4e52c9)

Not sure what (AttributeError): 'NoneType' object has no attribute 'encode' means or if its a permission error.
Running netbox on a k8s cluster

Expected Behavior

To be able to fetch the files from the remote git.

Observed Behavior

see above

Originally created by @chuegel on GitHub (Aug 26, 2023). ### NetBox version v3.5.8 ### Python version 3.10 ### Steps to Reproduce We want to setup a git (gitlab on premis) data source. 1. create a personal access token (all read permissions granted) 2. setup data source in netbox: 2.1 URL: https://our-gitlab.com/project.git 2.2 username: myuser 2.3 password: (access-token) 3. Branch: main The sync erroers out immediately with following error: ``` 09:05:11 default: core.jobs.sync_datasource(job=<Job: 7c7bfb03-a363-433b-ae81-b0f43a4e52c9>) (7c7bfb03-a363-433b-ae81-b0f43a4e52c9) ERROR:root:Fetching remote data failed (AttributeError): 'NoneType' object has no attribute 'encode' 09:05:12 default: Job OK (7c7bfb03-a363-433b-ae81-b0f43a4e52c9) ``` Not sure what ` (AttributeError): 'NoneType' object has no attribute 'encode'` means or if its a permission error. Running netbox on a k8s cluster ### Expected Behavior To be able to fetch the files from the remote git. ### Observed Behavior see above
adam closed this issue 2025-12-29 20:37:42 +01:00
Author
Owner

@chuegel commented on GitHub (Aug 30, 2023):

I have tried also username/password (no token) with the same result

@chuegel commented on GitHub (Aug 30, 2023): I have tried also username/password (no token) with the same result
Author
Owner

@rasanentimo commented on GitHub (Aug 30, 2023):

Which user are you running netbox? I faced similar issue with our kubernetes based installation where the user had no name

I have no name!@netbox-c754ff4fd-z99tb:/opt/netbox/netbox$ whoami
whoami: cannot find name for user ID 1000

dulwich requires a username for git. You can either run it with other user which has name or you can set some name as env variable ('LOGNAME', 'USER', 'LNAME', 'USERNAME') https://github.com/jelmer/dulwich/blob/master/dulwich/repo.py#L148

@rasanentimo commented on GitHub (Aug 30, 2023): Which user are you running netbox? I faced similar issue with our kubernetes based installation where the user had no name ``` I have no name!@netbox-c754ff4fd-z99tb:/opt/netbox/netbox$ whoami whoami: cannot find name for user ID 1000 ``` dulwich requires a username for git. You can either run it with other user which has name or you can set some name as env variable ('LOGNAME', 'USER', 'LNAME', 'USERNAME') https://github.com/jelmer/dulwich/blob/master/dulwich/repo.py#L148
Author
Owner

@chuegel commented on GitHub (Aug 30, 2023):

@rasanentimo thanks, that was it.
I've passed extraenvs in the helm chart for the worker node

    worker:
     extraEnvs:
       - name: USERNAME
         value: myusername
       - name: USER
         value: myusername

I wonder though why the username from the data source form doesn't get passed to the git command

@chuegel commented on GitHub (Aug 30, 2023): @rasanentimo thanks, that was it. I've passed extraenvs in the helm chart for the worker node ``` worker: extraEnvs: - name: USERNAME value: myusername - name: USER value: myusername ``` I wonder though why the username from the data source form doesn't get passed to the git command
Author
Owner

@bitcollector1 commented on GitHub (Aug 31, 2023):

Odd that my issue this looks to be the same did not get introduced until 3.6 upgrade. It was working minutes before the upgrade on 3.5.9

@bitcollector1 commented on GitHub (Aug 31, 2023): Odd that my issue this looks to be the same did not get introduced until 3.6 upgrade. It was working minutes before the upgrade on 3.5.9
Author
Owner

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

From the discussion above, this appears to be related to a configuration issue, so I'm going to close it out. If anyone comes across this and can provide reproduction steps for a stock NetBox deployment, please open a new bug report and reference this one.

@jeremystretch commented on GitHub (Sep 21, 2023): From the discussion above, this appears to be related to a configuration issue, so I'm going to close it out. If anyone comes across this and can provide reproduction steps for a stock NetBox deployment, please open a new bug report and reference this one.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#8515