amyasnikov / validity

NetBox plugin to validate network devices
MIT License
136 stars 8 forks source link

Problem to run sync datasource #78

Closed rsp1991 closed 7 months ago

rsp1991 commented 7 months ago

Hello,

I installed the plugin in my netbox and followed the steps of the link below:

https://validity.readthedocs.io/en/latest/quickstart_polling/

When I try sync the DataSource, I get failed with status:

TypeError("'NoneType' object is not callable")

amyasnikov commented 7 months ago

Hey @rsp1991, please post the following:

  1. Python version
  2. NetBox version
  3. Validity version
  4. Full error traceback
rsp1991 commented 7 months ago

1 - Python 3.10.12 2 - v3.7.3 3 - 2.1.0 4 - How can I get traceback?

I'm look the webpage and I can see the message below:

image

amyasnikov commented 7 months ago

Traceback can be found in the logs of RQ worker. Particular command to get them depends on your deployment method. E.g. docker logs <rqworker_container_name> may help if you run NetBox inside docker.

rsp1991 commented 7 months ago

I installed in the Ubuntu, I got the command in the google sudo journalctl --unit netbox-rq.service -n 100 --no-pager

Mar 27 21:21:53 vm15 python3[19110]: 21:21:53 default: extras.scripts.run_script(commit=True, data={'site': None, 'role': None, 'devices': <ConfigContextModelQuerySet [<Devic..., job=<Job: 9a89c3c4-4da6-4c36-85a6-25e5ca32bb23>, request=<utilities.utils.NetBoxFakeRequest object at 0x7ed6037aafe0>) (9a89c3c4-4da6-4c36-85a6-25e5ca32bb23) Mar 27 21:21:57 vm15 python3[21867]: SW01 has diff between intented and actual configurations Mar 27 21:21:57 vm15 python3[21867]: 21:21:57 default: Job OK (9a89c3c4-4da6-4c36-85a6-25e5ca32bb23) Mar 27 21:21:57 vm15 python3[21867]: 21:21:57 Result is kept for 500 seconds Mar 27 21:33:18 vm15 python3[19110]: 21:33:18 default: core.jobs.sync_datasource(job=<Job: 524937b7-6aba-4d21-b425-c7d267b66364>) (524937b7-6aba-4d21-b425-c7d267b66364) Mar 27 21:33:18 vm15 python3[21955]: 21:33:18 [Job 524937b7-6aba-4d21-b425-c7d267b66364]: exception raised while executing (core.jobs.sync_datasource) Mar 27 21:33:18 vm15 python3[21955]: Traceback (most recent call last): Mar 27 21:33:18 vm15 python3[21955]: File "/opt/netbox/venv/lib/python3.10/site-packages/rq/worker.py", line 1431, in perform_job Mar 27 21:33:18 vm15 python3[21955]: rv = job.perform() Mar 27 21:33:18 vm15 python3[21955]: File "/opt/netbox/venv/lib/python3.10/site-packages/rq/job.py", line 1280, in perform Mar 27 21:33:18 vm15 python3[21955]: self._result = self._execute() Mar 27 21:33:18 vm15 python3[21955]: File "/opt/netbox/venv/lib/python3.10/site-packages/rq/job.py", line 1317, in _execute Mar 27 21:33:18 vm15 python3[21955]: result = self.func(*self.args, self.kwargs) Mar 27 21:33:18 vm15 python3[21955]: File "/opt/netbox-3.7.3/netbox/core/jobs.py", line 33, in sync_datasource Mar 27 21:33:18 vm15 python3[21955]: raise e Mar 27 21:33:18 vm15 python3[21955]: File "/opt/netbox-3.7.3/netbox/core/jobs.py", line 20, in sync_datasource Mar 27 21:33:18 vm15 python3[21955]: datasource.sync() Mar 27 21:33:18 vm15 python3[21955]: File "/opt/netbox-3.7.3/netbox/core/models/data.py", line 190, in sync Mar 27 21:33:18 vm15 python3[21955]: backend = self.get_backend() Mar 27 21:33:18 vm15 python3[21955]: File "/opt/netbox-3.7.3/netbox/core/models/data.py", line 173, in get_backend Mar 27 21:33:18 vm15 python3[21955]: return self.backend_class(self.source_url, backend_params) Mar 27 21:33:18 vm15 python3[21955]: TypeError: 'NoneType' object is not callable

amyasnikov commented 7 months ago

I've not been able to reproduce this issue on a clean set up (NetBox 3.7.3 + Validity 2.1.0). Sync of Validity Polling performs fine in this case.

Maybe there are other plugins which introduce their own Data Source types and this somehow influences Validity.

Anyway, try to reproduce the issue on a clean set up.

rsp1991 commented 7 months ago

I tried do in the new netbox but I have same problem, can you shared your datasource config. please

rsp1991 commented 7 months ago

@amyasnikov

I reinstalled the packet and right now the sync run, but I get this message when I try run the compliance:

NoComponentError: There is no bound Data File for "config"

Mar 28 01:35:53 vm15 python3[23174]: 22:35:53 default: extras.scripts.run_script(commit=True, data={'sync_datasources': False, 'make_report': True, 'selectors': <RestrictedQu..., job=<Job: 4b90f124-adc6-44dd-9ce0-bc61cb898c42>, request=<utilities.utils.NetBoxFakeRequest object at 0x7c58cf66d0f0>) (4b90f124-adc6-44dd-9ce0-bc61cb898c42) Mar 28 01:35:53 vm15 python3[23895]: Failed to execute test ntp for device SW01, NoComponentError: There is no bound Data File for "config" Mar 28 01:35:54 vm15 python3[23895]: 22:35:54 default: Job OK (4b90f124-adc6-44dd-9ce0-bc61cb898c42) Mar 28 01:35:54 vm15 python3[23895]: 22:35:54 Result is kept for 500 seconds

amyasnikov commented 7 months ago

It means Validity cannot find appropriate file inside Data Source to display/parse the config for SW01.

rsp1991 commented 7 months ago

@amyasnikov thanks right now I can.

The switch cisco 3750 shows the wrong below I got output of the show running: image

amyasnikov commented 7 months ago

I'm closing the issue because the original problem is not reproducible. @rsp1991 feel free to ask any further questions in discussions