nornir-automation / nornir

Pluggable multi-threaded framework with inventory management to help operate collections of devices
https://nornir.readthedocs.io/
Apache License 2.0
1.38k stars 234 forks source link

Adds duplicated code as function for inventory helper. #727

Closed jvanderaa closed 11 months ago

jvanderaa commented 2 years ago

Fixes #723

Details

https://github.com/wvandeun/nornir_netbox/blob/develop/nornir_netbox/plugins/inventory/netbox.py#L39-L48 https://github.com/carlmontanari/nornir_ansible/blob/master/nornir_ansible/plugins/inventory/ansible.py#L456-L472

dbarrosop commented 2 years ago

I think if we want to go down this path and support this we should add a from_dict static method to all of the user facing objects (i.e. Host.from_dict(...), Group.from_dict(...)).

Basically that from_dict method should mean that a_host == Host.from_dict(a_host.dict()) with one exception; groups should be excluded and post-processed or you might end up in the situation where groups don't exist before trying to create the reference.

Thoughts?

jvanderaa commented 2 years ago

That makes sense. It may take me a little bit longer to get back on that particular update. I also need to check on what is going on with the tests that are failing here now after locally testing.

dbarrosop commented 2 years ago

Re failing tests, you may need to rebase as it's due to some breaking changes github actions did. Kirk fixed those already a few days ago though so hopefully you don't have to do anything about them.

jvanderaa commented 2 years ago

I've still got this on my radar. I've just come down with a bit of a cold that has knocked me out of working much lately...

dbarrosop commented 2 years ago

No worries, get well!

jvanderaa commented 2 years ago

I'm getting this in front of me a bit more. I thought I had something but the tests are not working. So I am going to try to restart the process on another branch.

ktbyers commented 11 months ago

@jvanderaa What is the status of this?

Is this dead now i.e. should be closed?

jvanderaa commented 11 months ago

Yeah, probably good to close out. Sorry for leaving it for so long @ktbyers

ktbyers commented 11 months ago

@jvanderaa No worries at all.