dropbox / nsot

Network Source of Truth is an open source IPAM and network inventory database
https://nsot.readthedocs.io
Other
399 stars 66 forks source link

Allowing sites to be nested in other sites #254

Open rmhasan opened 7 years ago

rmhasan commented 7 years ago

This is a PR for #215. This PR allows Sites to be nested in other sites. I performed the following tests. I also created a pull request for pynsot that allows users to pass the id of the parent site. The command line argument for passing the parent id is -p

EDIT: I made the pull request dropbox/pynsot#124

$ nsot sites add -n first
# site with name 'first' is added

$ nsot sites add -n second -p 1
# site with name 'second' is added and its parent is 1

$ nsot sites remove -i 1
# site was not removed, because it is second sites parent

$ nsot sites update -i 1 -p 1
# fails because a site cannot be nested in itself

$ nsot sites add -n third -p 2
$ nsot sites add -n fourth -p 3
$ nsot sites add -n fifth -p 4
$ nsot sites update -i 1 -p 5
# update fails because site with id 5 is a child or grand child of site with id 1
jathanism commented 7 years ago

@rmhasan Thanks for this contribution, too! Me and the other maintainers will be taking a look and try to keep this conversation going.

CLAassistant commented 2 years ago

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.