Comments (15)
Hello @netgab,
No issue, you can take your time and let me know.
from pyats.contrib.
Hi @SohanTirpude,
works perfectly now. Thank you!
from pyats.contrib.
Hi , I am looking at your ticket and reviewing it, Please let me know are you facing the issue still or not ?
from pyats.contrib.
please let me know if still facing the issue or not?
from pyats.contrib.
I'm currently on vacation and don't have access to my pyats / netbox install. As long as nothing has changed on the code base since I opened this issue, it should be still present...
from pyats.contrib.
That occurs when you try to iterate over a variable that is None. In Python, None is a special data type that represents the absence of a value.so try with giving value or ensure whether any value is coming or empty values is iterated over.
check and let me know once done after your vacation
from pyats.contrib.
So, the problem still exists. Steps to reproduce:
# Create virtual environment
python3 -m venv venv
source venv/bin/activate
# Install packages
pip install pyats[library]
pip install pyats.contrib
# Run pyats create
pyats create testbed netbox --output=testbed/netbox.yml --netbox-url=https://192.0.2.1 --user-token=<hidden> --verify=False
This gives me the following error:
pyats create testbed netbox --output=testbed/netbox.yml --netbox-url=https://192.0.2.1 --user-token=<hidden> --verify=False
Begin retrieving data from netbox...
'NoneType' object is not iterable
For me as a user it does not really matter what this error message means ("when you try to iterate over a variable that is None"). It does simply not work as expected :)
As I already pointed out:
From my point of view, the error is in the netbox.py
In the method _get_request
a requests.get
request is performed. The requests
parameter verify
is used for certificate validation. Based on the requests
documentation, a bool
value is expected for this parameter.
The class variable self._verify
is passed to the parameter. However, this variable is of type str
.
When I add the following line of code at the top of the _get_request
method:
print(f'The type of self.__verify is: {type(self._verify)} with value {self._verify}')
I get the following output: The type of self.__verify is: <class 'str'> with value False
$ pyats create testbed netbox --output=testbed/netbox.yml --netbox-url=https://192.0.2.1 --user-token=<hidden> --verify=False -vvv
Begin retrieving data from netbox...
The type of self.__verify is: <class 'str'> with value False
Traceback (most recent call last):
File "src/pyats/cli/base.py", line 207, in pyats.cli.base.Command.main
File "src/pyats/cli/base.py", line 339, in pyats.cli.base.CommandWithSubcommands.run
File "src/genie/cli/commands/create_testbed.py", line 34, in genie.cli.commands.create_testbed.CreateTestbed.run
File "/home/D8ML4I9/aci-testing/venv/lib/python3.9/site-packages/pyats/contrib/creators/creator.py", line 208, in to_testbed_file
testbed = self._generate()
File "/home/D8ML4I9/aci-testing/venv/lib/python3.9/site-packages/pyats/contrib/creators/netbox.py", line 589, in _generate
response += self._get_request(devices_url, headers, "results")
TypeError: 'NoneType' object is not iterable
'NoneType' object is not iterable
A simple workaround test is to replace verify=self._verify
with verify=False
in line 147 / 149 / 156 / 158 and everything works.
from pyats.contrib.
verify (bool) default=True: Should requests library validate SSL cert for netbox
CLI Argument | Class Argument
---------------------------------------------
--verify=False | verify=False
may i know from where the value false is assigned to self varaible? can you send me the script file from where the input is passing as false.
from pyats.contrib.
may i know from where the value false is assigned to self varaible? can you send me the script file from where the input is passing as false.
There is no script file. As I already wrote, I'm just using the CLI:
pyats create testbed netbox --output=testbed/netbox.yml --netbox-url=https://192.0.2.1 --user-token=<hidden> --verify=False
The --verify=False
CLI parameter is documented in the class Netbox(TestbedCreator) docstring:
So from my point of view it's either a documentation bug in the docstring itself (--verify=False is not supported) or there is a bug in the code base.
The self.__verify
attribute is somehow inherited from a parent class (maybe BaseTestbedLoader
).
But anyway ... I guess we are using the incorrect data type for the requests.get
call..
from pyats.contrib.
Certainly, In order to better understand your inquiry and provide further assistance, could you please provide me with more information regarding the response you are receiving in your netbox.py script? This will enable me to better analyze the situation and offer more specific recommendations for any further actions that may be necessary.
from pyats.contrib.
please provide me with more information regarding the response you are receiving in your netbox.py script?
from pyats.contrib.
As written above in my initial post:
$ pyats create testbed netbox --output=testbed/netbox.yml --netbox-url=https://192.0.2.1 --user-token=<hidden> --verify=False -vvv
Begin retrieving data from netbox...
The type of self.__verify is: <class 'str'> with value False
Traceback (most recent call last):
File "src/pyats/cli/base.py", line 207, in pyats.cli.base.Command.main
File "src/pyats/cli/base.py", line 339, in pyats.cli.base.CommandWithSubcommands.run
File "src/genie/cli/commands/create_testbed.py", line 34, in genie.cli.commands.create_testbed.CreateTestbed.run
File "/home/D8ML4I9/aci-testing/venv/lib/python3.9/site-packages/pyats/contrib/creators/creator.py", line 208, in to_testbed_file
testbed = self._generate()
File "/home/D8ML4I9/aci-testing/venv/lib/python3.9/site-packages/pyats/contrib/creators/netbox.py", line 589, in _generate
response += self._get_request(devices_url, headers, "results")
TypeError: 'NoneType' object is not iterable
'NoneType' object is not iterable
from pyats.contrib.
Hello @netgab,
For the above mentioned problem, PR has been raised and merged. So, kindly check and confirm whether your issue has resolved or not.
from pyats.contrib.
Hello @SohanTirpude,
thanks you for taking care of the issue. To verify, I need to wait until the new version is published to PyPi.
Otherwise I need to build the package directly from the sources....
from pyats.contrib.
Hello @netgab,
The 23.7 version has been released I guess. So, kindly check and let me know if the issue still persist.
from pyats.contrib.
Related Issues (7)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pyats.contrib.