-
Notifications
You must be signed in to change notification settings - Fork 174
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds support for NetBox v3.5+ (#564)
* Fix unused `PowerPorts` model (#535) Updated models/mapper.py: set `PowerPorts` for "dcim.powerport" in the map-dict. * migrate from pkg_resources to importlib * adds core app * adds endpoints added in 3.5 * adds support for 3.5 * lint fixes * updates openapi tests * adds testing for 3.4 and 3.5 * updates pytest.skip * updates docker tags for testing * fixes superuser account creation for testing * fixed requirements * updates the docstring for render-config endpoint * removes extra semicolon from content type value * migrate from pkg_resources to importlib * adds core app * adds endpoints added in 3.5 * adds support for 3.5 * lint fixes * updates openapi tests * adds testing for 3.4 and 3.5 * updates pytest.skip * updates docker tags for testing * fixes superuser account creation for testing * fixed requirements * updates the docstring for render-config endpoint * removes extra semicolon from content type value --------- Co-authored-by: nautics889 <[email protected]>
- Loading branch information
1 parent
f32ed2f
commit 98625ed
Showing
17 changed files
with
126 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,6 @@ | ||
from pkg_resources import get_distribution, DistributionNotFound | ||
from importlib.metadata import metadata | ||
|
||
from pynetbox.core.query import RequestError, AllocationError, ContentError | ||
from pynetbox.core.api import Api as api | ||
|
||
try: | ||
__version__ = get_distribution(__name__).version | ||
except DistributionNotFound: | ||
pass | ||
__version__ = metadata(__name__).get("Version") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
black~=22.10 | ||
pytest==7.1.* | ||
pytest-docker==1.0.* | ||
PyYAML==6.0 | ||
PyYAML==6.0.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
requests>=2.20.0,<3.0 | ||
packaging<24.0 | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
chkwok
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,7 +28,11 @@ def get_netbox_docker_version_tag(netbox_version): | |
major, minor = netbox_version.major, netbox_version.minor | ||
|
||
if (major, minor) == (3, 3): | ||
tag = "2.2.0" | ||
tag = "2.3.0" | ||
elif (major, minor) == (3, 4): | ||
tag = "2.5.3" | ||
elif (major, minor) == (3, 5): | ||
tag = "2.6.1" | ||
else: | ||
raise NotImplementedError( | ||
"Version %s is not currently supported" % netbox_version | ||
|
@@ -48,7 +52,7 @@ def git_toplevel(): | |
try: | ||
subp.check_call(["which", "git"]) | ||
except subp.CalledProcessError: | ||
pytest.skip(msg="git executable was not found on the host") | ||
pytest.skip(reason="git executable was not found on the host") | ||
return ( | ||
subp.check_output(["git", "rev-parse", "--show-toplevel"]) | ||
.decode("utf-8") | ||
|
@@ -73,7 +77,7 @@ def netbox_docker_repo_dirpaths(pytestconfig, git_toplevel): | |
try: | ||
subp.check_call(["which", "docker"]) | ||
except subp.CalledProcessError: | ||
pytest.skip(msg="docker executable was not found on the host") | ||
pytest.skip(reason="docker executable was not found on the host") | ||
netbox_versions_by_repo_dirpaths = {} | ||
for netbox_version in pytestconfig.option.netbox_versions: | ||
repo_version_tag = get_netbox_docker_version_tag(netbox_version=netbox_version) | ||
|
@@ -248,6 +252,14 @@ def docker_compose_file(pytestconfig, netbox_docker_repo_dirpaths): | |
"netboxcommunity/netbox:v%s" % netbox_version | ||
) | ||
|
||
new_services[new_service_name]["environment"] = { | ||
"SKIP_SUPERUSER": "false", | ||
"SUPERUSER_API_TOKEN": "0123456789abcdef0123456789abcdef01234567", | ||
"SUPERUSER_EMAIL": "[email protected]", | ||
"SUPERUSER_NAME": "admin", | ||
"SUPERUSER_PASSWORD": "admin", | ||
} | ||
|
||
if service_name == "netbox": | ||
# ensure the netbox container listens on a random port | ||
new_services[new_service_name]["ports"] = ["8080"] | ||
|
@@ -341,7 +353,7 @@ def docker_compose_file(pytestconfig, netbox_docker_repo_dirpaths): | |
|
||
|
||
def netbox_is_responsive(url): | ||
"""Chack if the HTTP service is up and responsive.""" | ||
"""Check if the HTTP service is up and responsive.""" | ||
try: | ||
response = requests.get(url) | ||
if response.status_code == 200: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Hm, in a world where backward compatibility is a thing, this looks like a strange requirement, especially given that the packaging 24.0 announcement also doesn't mention any backward incompatibility. So I need to ask: is this requirement really necessary and correct?