Customized CSV plugin

Dear Gents, I am making a customized CSV plugin which should get data from CSV file instead of yaml file and getting the following exception? Can anyone help me in fixing this issue? Any help would be much appreciated!

Blockquote

Traceback (most recent call last):e[0m
e[0m File “C:\Users\user\AppData\Local\Programs\Python\Python38\inventory\nornir_1st_Script.py”, line 67, in
main()
e[0me[0m File “C:\Users\user\AppData\Local\Programs\Python\Python38\inventory\nornir_1st_Script.py”, line 47, in main
nr = InitNornir(inventory={
e[0me[0m File “C:\Users\user\AppData\Local\Programs\Python\Python38\lib\site-packages\nornir\init_nornir.py”, line 74, in InitNornir
inv = conf.inventory.plugin.deserialize(
e[0me[0m File “C:\Users\user\AppData\Local\Programs\Python\Python38\lib\site-packages\nornir\core\deserializer\inventory.py”, line 146, in deserialize
return inventory.Inventory(
e[0me[0m File “C:\Users\user\AppData\Local\Programs\Python\Python38\lib\site-packages\nornir\core\inventory.py”, line 408, in init
host.groups.refs = [self.groups[p] for p in host.groups]
e[0me[0m File “C:\Users\user\AppData\Local\Programs\Python\Python38\lib\site-packages\nornir\core\inventory.py”, line 408, in
host.groups.refs = [self.groups[p] for p in host.groups]
e[0me[0mKeyError: ‘ericsson_mw’
e[0me[0m

GitHub link below to check all the needed files

here
'groups': [device_info[11]]
you assign a group ericsson_mw, but later this group is not created: groups = {}
You can’t assign a host to a nonexistent group.

Thanks brother, Issue is fixed…

There was one more minor issue and i have managed to fix it!

Thanks for your support in fixing this issue!

hi @khurram703 im new to nornir and automation/python. I’m also trying to use a csv plugin for my host following your code but I couldnt make it to work. What was the minor issue that you had and how did you fix it? Thanks in advance.