Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package python-pynetbox for openSUSE:Factory
checked in at 2022-02-26 17:02:10
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-pynetbox (Old)
and /work/SRC/openSUSE:Factory/.python-pynetbox.new.1958 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-pynetbox"
Sat Feb 26 17:02:10 2022 rev:28 rq:957671 version:6.6.1
Changes:
--------
--- /work/SRC/openSUSE:Factory/python-pynetbox/python-pynetbox.changes
2021-12-29 21:11:28.130310792 +0100
+++
/work/SRC/openSUSE:Factory/.python-pynetbox.new.1958/python-pynetbox.changes
2022-02-26 17:02:42.327541835 +0100
@@ -1,0 +2,15 @@
+Thu Feb 24 20:42:55 UTC 2022 - Martin Hauke <[email protected]>
+
+- Update to version 6.6.1
+ * Use devices as variable for example calls to nb.dcim.devices.
+ * Fixes #447: Remove extra self argument in Vlans.str().
+- Update to version 6.6.0
+ * Upgrade Black to the first non-beta release.
+ * Fix VirtualChassis.__str__(), make VirtualChassis.master a
+ Devices object.
+- Update to version 6.5.0
+ * Docstring updates: remove secrets from examples.
+ * Fixes #427: Adds support for available-vlans child endpoint
+ for VLAN groups.
+
+-------------------------------------------------------------------
Old:
----
pynetbox-6.4.1.tar.gz
New:
----
pynetbox-6.6.1.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-pynetbox.spec ++++++
--- /var/tmp/diff_new_pack.trm5pT/_old 2022-02-26 17:02:42.839541917 +0100
+++ /var/tmp/diff_new_pack.trm5pT/_new 2022-02-26 17:02:42.843541917 +0100
@@ -1,7 +1,7 @@
#
# spec file for package python-pynetbox
#
-# Copyright (c) 2021 SUSE LLC
+# Copyright (c) 2022 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -19,7 +19,7 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%define skip_python2 1
Name: python-pynetbox
-Version: 6.4.1
+Version: 6.6.1
Release: 0
Summary: NetBox API client library
License: Apache-2.0
++++++ pynetbox-6.4.1.tar.gz -> pynetbox-6.6.1.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pynetbox-6.4.1/.github/workflows/py3.yml
new/pynetbox-6.6.1/.github/workflows/py3.yml
--- old/pynetbox-6.4.1/.github/workflows/py3.yml 2021-12-22
03:07:03.000000000 +0100
+++ new/pynetbox-6.6.1/.github/workflows/py3.yml 2022-02-20
22:32:49.000000000 +0100
@@ -13,6 +13,7 @@
strategy:
matrix:
python: [3.6, 3.8]
+ netbox: ["2.11", "3.0", "3.1"]
steps:
- uses: actions/checkout@v2
@@ -29,4 +30,4 @@
run: black --diff --check pynetbox tests
- name: Run Tests
- run: pytest
+ run: pytest --netbox-versions=${{ matrix.netbox }}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pynetbox-6.4.1/PKG-INFO new/pynetbox-6.6.1/PKG-INFO
--- old/pynetbox-6.4.1/PKG-INFO 2021-12-22 03:07:15.604708400 +0100
+++ new/pynetbox-6.6.1/PKG-INFO 2022-02-20 22:33:00.115910000 +0100
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: pynetbox
-Version: 6.4.1
+Version: 6.6.1
Summary: NetBox API client library
Home-page: https://github.com/digitalocean/pynetbox
Author: Zach Moody
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pynetbox-6.4.1/docs/IPAM.rst
new/pynetbox-6.6.1/docs/IPAM.rst
--- old/pynetbox-6.4.1/docs/IPAM.rst 2021-12-22 03:07:03.000000000 +0100
+++ new/pynetbox-6.6.1/docs/IPAM.rst 2022-02-20 22:32:49.000000000 +0100
@@ -2,4 +2,7 @@
========
.. autoclass:: pynetbox.models.ipam.Prefixes
- :members:
\ No newline at end of file
+ :members:
+
+.. autoclass:: pynetbox.models.ipam.VlanGroups
+ :members:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pynetbox-6.4.1/docs/conf.py
new/pynetbox-6.6.1/docs/conf.py
--- old/pynetbox-6.4.1/docs/conf.py 2021-12-22 03:07:03.000000000 +0100
+++ new/pynetbox-6.6.1/docs/conf.py 2022-02-20 22:32:49.000000000 +0100
@@ -47,9 +47,9 @@
master_doc = "index"
# General information about the project.
-project = u"pynetbox"
-copyright = u"2017, DigitalOcean"
-author = u"Zach Moody"
+project = "pynetbox"
+copyright = "2017, DigitalOcean"
+author = "Zach Moody"
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
@@ -128,7 +128,7 @@
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
- (master_doc, "pynetbox.tex", u"pynetbox Documentation", u"Zach Moody",
"manual"),
+ (master_doc, "pynetbox.tex", "pynetbox Documentation", "Zach Moody",
"manual"),
]
@@ -136,7 +136,7 @@
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
-man_pages = [(master_doc, "pynetbox", u"pynetbox Documentation", [author], 1)]
+man_pages = [(master_doc, "pynetbox", "pynetbox Documentation", [author], 1)]
# -- Options for Texinfo output -------------------------------------------
@@ -148,7 +148,7 @@
(
master_doc,
"pynetbox",
- u"pynetbox Documentation",
+ "pynetbox Documentation",
author,
"pynetbox",
"A python library for NetBox.",
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pynetbox-6.4.1/pynetbox/core/api.py
new/pynetbox-6.6.1/pynetbox/core/api.py
--- old/pynetbox-6.4.1/pynetbox/core/api.py 2021-12-22 03:07:03.000000000
+0100
+++ new/pynetbox-6.6.1/pynetbox/core/api.py 2022-02-20 22:32:49.000000000
+0100
@@ -32,11 +32,11 @@
* dcim
* ipam
* circuits
- * secrets
+ * secrets (on NetBox 2.11 and older)
* tenancy
* extras
* virtualization
- * users
+ * users (since NetBox 2.9)
* wireless (since NetBox 3.1)
Calling any of these attributes will return
@@ -53,8 +53,8 @@
wish to connect to.
:param str token: Your NetBox token.
:param str,optional private_key_file: The path to your private
- key file.
- :param str,optional private_key: Your private key.
+ key file. (Usable only on NetBox 2.11 and older)
+ :param str,optional private_key: Your private key. (Usable only on NetBox
2.11 and older)
:param bool,optional threading: Set to True to use threading in ``.all()``
and ``.filter()`` requests.
:raises ValueError: If *private_key* and *private_key_file* are both
@@ -65,14 +65,19 @@
>>> import pynetbox
>>> nb = pynetbox.api(
... 'http://localhost:8000',
- ... private_key_file='/path/to/private-key.pem',
... token='d6f4e314a5b5fefd164995169f28ae32d987704f'
... )
- >>> nb.dcim.devices.all()
+ >>> list(nb.dcim.devices.all())
+ [test1-leaf1, test1-leaf2, test1-leaf3]
"""
def __init__(
- self, url, token=None, private_key=None, private_key_file=None,
threading=False,
+ self,
+ url,
+ token=None,
+ private_key=None,
+ private_key_file=None,
+ threading=False,
):
if private_key and private_key_file:
raise ValueError(
@@ -120,15 +125,15 @@
>>> import pynetbox
>>> nb = pynetbox.api(
... 'http://localhost:8000',
- ... private_key_file='/path/to/private-key.pem',
... token='d6f4e314a5b5fefd164995169f28ae32d987704f'
... )
>>> nb.version
- '2.6'
+ '3.1'
>>>
"""
version = Request(
- base=self.base_url, http_session=self.http_session,
+ base=self.base_url,
+ http_session=self.http_session,
).get_version()
return version
@@ -143,7 +148,6 @@
>>> import pynetbox
>>> nb = pynetbox.api(
... 'http://localhost:8000',
- ... private_key_file='/path/to/private-key.pem',
... token='d6f4e314a5b5fefd164995169f28ae32d987704f'
... )
>>> nb.openapi()
@@ -151,7 +155,8 @@
>>>
"""
return Request(
- base=self.base_url, http_session=self.http_session,
+ base=self.base_url,
+ http_session=self.http_session,
).get_openapi()
def status(self):
@@ -183,12 +188,14 @@
>>>
"""
status = Request(
- base=self.base_url, token=self.token,
http_session=self.http_session,
+ base=self.base_url,
+ token=self.token,
+ http_session=self.http_session,
).get_status()
return status
def create_token(self, username, password):
- """ Creates an API token using a valid NetBox username and password.
+ """Creates an API token using a valid NetBox username and password.
Saves the created token automatically in the API object.
Requires NetBox 3.0.0 or newer.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pynetbox-6.4.1/pynetbox/core/app.py
new/pynetbox-6.6.1/pynetbox/core/app.py
--- old/pynetbox-6.4.1/pynetbox/core/app.py 2021-12-22 03:07:03.000000000
+0100
+++ new/pynetbox-6.6.1/pynetbox/core/app.py 2022-02-20 22:32:49.000000000
+0100
@@ -27,7 +27,7 @@
class App(object):
- """ Represents apps in NetBox.
+ """Represents apps in NetBox.
Calls to attributes are returned as Endpoint objects.
@@ -79,7 +79,7 @@
).get_session_key()
def choices(self):
- """ Returns _choices response from App
+ """Returns _choices response from App
.. note::
@@ -102,7 +102,7 @@
return self._choices
def custom_choices(self):
- """ Returns _custom_field_choices response from app
+ """Returns _custom_field_choices response from app
.. note::
@@ -119,7 +119,10 @@
'Testfield2': {'Othervalue2': 4, 'Othervalue1': 3}}
"""
custom_field_choices = Request(
- base="{}/{}/_custom_field_choices/".format(self.api.base_url,
self.name,),
+ base="{}/{}/_custom_field_choices/".format(
+ self.api.base_url,
+ self.name,
+ ),
token=self.api.token,
private_key=self.api.private_key,
http_session=self.api.http_session,
@@ -127,7 +130,7 @@
return custom_field_choices
def config(self):
- """ Returns config response from app
+ """Returns config response from app
:Returns: Raw response from NetBox's config endpoint.
:Raises: :py:class:`.RequestError` if called for an invalid endpoint.
@@ -143,7 +146,10 @@
'tags']}}}
"""
config = Request(
- base="{}/{}/config/".format(self.api.base_url, self.name,),
+ base="{}/{}/config/".format(
+ self.api.base_url,
+ self.name,
+ ),
token=self.api.token,
private_key=self.api.private_key,
http_session=self.api.http_session,
@@ -173,22 +179,24 @@
return App(self.api, "plugins/{}".format(name.replace("_", "-")))
def installed_plugins(self):
- """ Returns raw response with installed plugins
+ """Returns raw response with installed plugins
:returns: Raw response NetBox's installed plugins.
:Example:
>>> nb.plugins.installed_plugins()
[{
- 'name': 'test_plugin',
- 'package': 'test_plugin',
- 'author': 'Dmitry',
- 'description': 'Netbox test plugin',
+ 'name': 'test_plugin',
+ 'package': 'test_plugin',
+ 'author': 'Dmitry',
+ 'description': 'Netbox test plugin',
'verison': '0.10'
}]
"""
installed_plugins = Request(
- base="{}/plugins/installed-plugins".format(self.api.base_url,),
+ base="{}/plugins/installed-plugins".format(
+ self.api.base_url,
+ ),
token=self.api.token,
private_key=self.api.private_key,
http_session=self.api.http_session,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pynetbox-6.4.1/pynetbox/core/endpoint.py
new/pynetbox-6.6.1/pynetbox/core/endpoint.py
--- old/pynetbox-6.4.1/pynetbox/core/endpoint.py 2021-12-22
03:07:03.000000000 +0100
+++ new/pynetbox-6.6.1/pynetbox/core/endpoint.py 2022-02-20
22:32:49.000000000 +0100
@@ -48,7 +48,9 @@
self.token = api.token
self.session_key = api.session_key
self.url = "{base_url}/{app}/{endpoint}".format(
- base_url=self.base_url, app=app.name, endpoint=self.name,
+ base_url=self.base_url,
+ app=app.name,
+ endpoint=self.name,
)
self._choices = None
@@ -223,7 +225,7 @@
Passing a list as a named argument adds multiple filters of the
same value.
- >>> device = nb.dcim.devices.filter(role=['leaf-switch',
'spine-switch'])
+ >>> devices = nb.dcim.devices.filter(role=['leaf-switch',
'spine-switch'])
>>> for device in devices:
... print(device.name)
...
@@ -443,7 +445,7 @@
return True if req.delete(data=[{"id": i} for i in cleaned_ids]) else
False
def choices(self):
- """ Returns all choices from the endpoint.
+ """Returns all choices from the endpoint.
The returned dict is also saved in the endpoint object (in
``_choices`` attribute) so that later calls will return the same data
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pynetbox-6.4.1/pynetbox/core/query.py
new/pynetbox-6.6.1/pynetbox/core/query.py
--- old/pynetbox-6.4.1/pynetbox/core/query.py 2021-12-22 03:07:03.000000000
+0100
+++ new/pynetbox-6.6.1/pynetbox/core/query.py 2022-02-20 22:32:49.000000000
+0100
@@ -22,7 +22,7 @@
def calc_pages(limit, count):
- """ Calculate number of pages required for full results set. """
+ """Calculate number of pages required for full results set."""
return int(count / limit) + (limit % count > 0)
@@ -165,7 +165,7 @@
self.offset = offset
def get_openapi(self):
- """ Gets the OpenAPI Spec """
+ """Gets the OpenAPI Spec"""
headers = {
"Content-Type": "application/json;",
}
@@ -179,7 +179,7 @@
raise RequestError(req)
def get_version(self):
- """ Gets the API version of NetBox.
+ """Gets the API version of NetBox.
Issues a GET request to the base URL to read the API version from the
response headers.
@@ -191,7 +191,10 @@
headers = {
"Content-Type": "application/json;",
}
- req = self.http_session.get(self.normalize_url(self.base),
headers=headers,)
+ req = self.http_session.get(
+ self.normalize_url(self.base),
+ headers=headers,
+ )
if req.ok:
return req.headers.get("API-Version", "")
else:
@@ -223,7 +226,7 @@
raise RequestError(req)
def get_status(self):
- """ Gets the status from /api/status/ endpoint in NetBox.
+ """Gets the status from /api/status/ endpoint in NetBox.
:Returns: Dictionary as returned by NetBox.
:Raises: RequestError if request is not successful.
@@ -232,7 +235,8 @@
if self.token:
headers["authorization"] = "Token {}".format(self.token)
req = self.http_session.get(
- "{}status/".format(self.normalize_url(self.base)), headers=headers,
+ "{}status/".format(self.normalize_url(self.base)),
+ headers=headers,
)
if req.ok:
return req.json()
@@ -240,8 +244,7 @@
raise RequestError(req)
def normalize_url(self, url):
- """ Builds a url for POST actions.
- """
+ """Builds a url for POST actions."""
if url[-1] != "/":
return "{}/".format(url)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pynetbox-6.4.1/pynetbox/core/response.py
new/pynetbox-6.6.1/pynetbox/core/response.py
--- old/pynetbox-6.4.1/pynetbox/core/response.py 2021-12-22
03:07:03.000000000 +0100
+++ new/pynetbox-6.6.1/pynetbox/core/response.py 2022-02-20
22:32:49.000000000 +0100
@@ -348,7 +348,7 @@
self._init_cache.append((key, get_return(value)))
def _parse_values(self, values):
- """ Parses values init arg.
+ """Parses values init arg.
Parses values dict at init and sets object attributes with the
values within.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pynetbox-6.4.1/pynetbox/models/dcim.py
new/pynetbox-6.6.1/pynetbox/models/dcim.py
--- old/pynetbox-6.4.1/pynetbox/models/dcim.py 2021-12-22 03:07:03.000000000
+0100
+++ new/pynetbox-6.6.1/pynetbox/models/dcim.py 2022-02-20 22:32:49.000000000
+0100
@@ -54,7 +54,10 @@
.path[len(urlsplit(self.api.base_url).path) :]
.split("/")[1:3]
)
- return_obj_class = uri_to_obj_class_map.get(app_endpoint,
Record,)
+ return_obj_class = uri_to_obj_class_map.get(
+ app_endpoint,
+ Record,
+ )
this_hop_ret.append(
return_obj_class(hop_item_data, self.endpoint.api,
self.endpoint)
)
@@ -72,16 +75,16 @@
class Devices(Record):
"""Devices Object
- Represents a device response from netbox.
+ Represents a device response from netbox.
- Attributes:
- primary_ip, ip4, ip6 (list): Tells __init__ in Record() to
- take the `primary_ip` field's value from the API
- response and return an initialized list of IpAddress
- objects
- device_type (obj): Tells __init__ in Record() to take the
- `device_type` field's value from the API response and
- return an initialized DeviceType object
+ Attributes:
+ primary_ip, ip4, ip6 (list): Tells __init__ in Record() to
+ take the `primary_ip` field's value from the API
+ response and return an initialized list of IpAddress
+ objects
+ device_type (obj): Tells __init__ in Record() to take the
+ `device_type` field's value from the API response and
+ return an initialized DeviceType object
"""
has_details = True
@@ -94,7 +97,7 @@
@property
def napalm(self):
- """ Represents the ``napalm`` detail endpoint.
+ """Represents the ``napalm`` detail endpoint.
Returns a DetailEndpoint object that is the interface for
viewing response from the napalm endpoint.
@@ -152,8 +155,7 @@
class VirtualChassis(Record):
- def __str__(self):
- return self.master.display_name
+ master = Devices
class RUs(Record):
@@ -171,7 +173,7 @@
class Racks(Record):
@property
def units(self):
- """ Represents the ``units`` detail endpoint.
+ """Represents the ``units`` detail endpoint.
Returns a DetailEndpoint object that is the interface for
viewing response from the units endpoint.
@@ -189,7 +191,7 @@
@property
def elevation(self):
- """ Represents the ``elevation`` detail endpoint.
+ """Represents the ``elevation`` detail endpoint.
Returns a DetailEndpoint object that is the interface for
viewing response from the elevation endpoint updated in
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pynetbox-6.4.1/pynetbox/models/ipam.py
new/pynetbox-6.6.1/pynetbox/models/ipam.py
--- old/pynetbox-6.4.1/pynetbox/models/ipam.py 2021-12-22 03:07:03.000000000
+0100
+++ new/pynetbox-6.6.1/pynetbox/models/ipam.py 2022-02-20 22:32:49.000000000
+0100
@@ -28,7 +28,7 @@
@property
def available_ips(self):
- """ Represents the ``available-ips`` detail endpoint.
+ """Represents the ``available-ips`` detail endpoint.
Returns a DetailEndpoint object that is the interface for
viewing and creating IP addresses inside a prefix.
@@ -59,7 +59,7 @@
@property
def available_prefixes(self):
- """ Represents the ``available-prefixes`` detail endpoint.
+ """Represents the ``available-prefixes`` detail endpoint.
Returns a DetailEndpoint object that is the interface for
viewing and creating prefixes inside a parent prefix.
@@ -97,3 +97,34 @@
class Aggregates(Record):
def __str__(self):
return str(self.prefix)
+
+
+class Vlans(Record):
+ def __str__(self):
+ return super().__str__() or str(self.vid)
+
+
+class VlanGroups(Record):
+ @property
+ def available_vlans(self):
+ """Represents the ``available-vlans`` detail endpoint.
+
+ Returns a DetailEndpoint object that is the interface for
+ viewing and creating VLANs inside a VLAN group.
+
+ Available since NetBox 3.2.0.
+
+ :returns: :py:class:`.DetailEndpoint`
+
+ :Examples:
+
+ >>> vlan_group = nb.ipam.vlan_groups.get(1)
+ >>> vlan_group.available_vlans.list()
+ [10, 11, 12]
+
+ To create a new VLAN:
+
+ >>> vlan_group.available_vlans.create({"name": "NewVLAN"})
+ NewVLAN (10)
+ """
+ return DetailEndpoint(self, "available-vlans", custom_return=Vlans)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pynetbox-6.4.1/pynetbox.egg-info/PKG-INFO
new/pynetbox-6.6.1/pynetbox.egg-info/PKG-INFO
--- old/pynetbox-6.4.1/pynetbox.egg-info/PKG-INFO 2021-12-22
03:07:15.000000000 +0100
+++ new/pynetbox-6.6.1/pynetbox.egg-info/PKG-INFO 2022-02-20
22:32:59.000000000 +0100
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: pynetbox
-Version: 6.4.1
+Version: 6.6.1
Summary: NetBox API client library
Home-page: https://github.com/digitalocean/pynetbox
Author: Zach Moody
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pynetbox-6.4.1/requirements-dev.txt
new/pynetbox-6.6.1/requirements-dev.txt
--- old/pynetbox-6.4.1/requirements-dev.txt 2021-12-22 03:07:03.000000000
+0100
+++ new/pynetbox-6.6.1/requirements-dev.txt 2022-02-20 22:32:49.000000000
+0100
@@ -1,3 +1,3 @@
-black==19.10b0
+black~=22.0
pytest==6.2.*
pytest-docker==0.10.*
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pynetbox-6.4.1/setup.py new/pynetbox-6.6.1/setup.py
--- old/pynetbox-6.4.1/setup.py 2021-12-22 03:07:03.000000000 +0100
+++ new/pynetbox-6.6.1/setup.py 2022-02-20 22:32:49.000000000 +0100
@@ -11,7 +11,10 @@
use_scm_version=True,
setup_requires=["setuptools_scm"],
packages=find_packages(exclude=["tests", "tests.*"]),
- install_requires=["requests>=2.20.0,<3.0", "six==1.*",],
+ install_requires=[
+ "requests>=2.20.0,<3.0",
+ "six==1.*",
+ ],
zip_safe=False,
keywords=["netbox"],
classifiers=[
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pynetbox-6.4.1/tests/conftest.py
new/pynetbox-6.6.1/tests/conftest.py
--- old/pynetbox-6.4.1/tests/conftest.py 2021-12-22 03:07:03.000000000
+0100
+++ new/pynetbox-6.6.1/tests/conftest.py 2022-02-20 22:32:49.000000000
+0100
@@ -4,7 +4,7 @@
from packaging import version
-DEFAULT_NETBOX_VERSIONS = "2.7, 2.8, 2.9, 2.10"
+DEFAULT_NETBOX_VERSIONS = "2.11, 3.0, 3.1"
def pytest_addoption(parser):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pynetbox-6.4.1/tests/integration/conftest.py
new/pynetbox-6.6.1/tests/integration/conftest.py
--- old/pynetbox-6.4.1/tests/integration/conftest.py 2021-12-22
03:07:03.000000000 +0100
+++ new/pynetbox-6.6.1/tests/integration/conftest.py 2022-02-20
22:32:49.000000000 +0100
@@ -28,14 +28,12 @@
"""
major, minor = netbox_version.major, netbox_version.minor
- if (major, minor) == (2, 10):
- tag = "1.0.1"
- elif (major, minor) == (2, 9):
- tag = "0.26.2"
- elif (major, minor) == (2, 8):
- tag = "0.24.1"
- elif (major, minor) == (2, 7):
- tag = "0.24.0"
+ if (major, minor) == (3, 1):
+ tag = "1.5.1"
+ elif (major, minor) == (3, 0):
+ tag = "1.5.1"
+ elif (major, minor) == (2, 11):
+ tag = "1.2.0"
else:
raise NotImplementedError(
"Version %s is not currently supported" % netbox_version
@@ -231,9 +229,12 @@
DOCKER_PROJECT_PREFIX,
docker_netbox_version,
)
- compose_data["networks"] = {
- docker_network_name: {"name": docker_network_name,}
- }
+ compose_data["networks"] = {docker_network_name: {}}
+ #
https://docs.docker.com/compose/compose-file/compose-file-v3/#network-configuration-reference
+ if compose_data["version"] >= "3.5":
+ compose_data["networks"][docker_network_name][
+ "name"
+ ] = docker_network_name
# prepend the netbox version to each of the service names and
anything else
# needed to make the continers unique to the netbox version
@@ -251,6 +252,10 @@
"netboxcommunity/netbox:v%s" % netbox_version
)
+ if service_name == "netbox":
+ # ensure the netbox container listens on a random port
+ new_services[new_service_name]["ports"] = ["8080"]
+
# set the network and an alias to the proper short name of the
container
# within that network
new_services[new_service_name]["networks"] = {
@@ -265,7 +270,10 @@
]:
new_service_dependencies.append(
"netbox_v%s_%s"
- % (docker_netbox_version, dependent_service_name,)
+ % (
+ docker_netbox_version,
+ dependent_service_name,
+ )
)
new_services[new_service_name][
"depends_on"
@@ -311,12 +319,17 @@
for volume_name, volume_config in compose_data["volumes"].items():
new_volumes[
"%s_v%s_%s"
- % (DOCKER_PROJECT_PREFIX, docker_netbox_version,
volume_name,)
+ % (
+ DOCKER_PROJECT_PREFIX,
+ docker_netbox_version,
+ volume_name,
+ )
] = volume_config
compose_data["volumes"] = new_volumes
compose_output_fpath = os.path.join(
- netbox_docker_repo_dirpath, "docker-compose-v%s.yml" %
netbox_version,
+ netbox_docker_repo_dirpath,
+ "docker-compose-v%s.yml" % netbox_version,
)
with open(compose_output_fpath, "w") as fdesc:
fdesc.write(yaml.dump(compose_data))
@@ -358,7 +371,10 @@
@pytest.fixture(scope="session")
def docker_netbox_service(
- pytestconfig, docker_ip, docker_services, request,
+ pytestconfig,
+ docker_ip,
+ docker_services,
+ request,
):
"""Get the netbox service to test against.
@@ -461,7 +477,9 @@
@pytest.fixture(scope="session")
def device_role(api):
device_role = api.dcim.device_roles.create(
- name="test-device-role", slug="test-device-role", color="000000",
+ name="test-device-role",
+ slug="test-device-role",
+ color="000000",
)
yield device_role
device_role.delete()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pynetbox-6.4.1/tests/test_api.py
new/pynetbox-6.6.1/tests/test_api.py
--- old/pynetbox-6.4.1/tests/test_api.py 2021-12-22 03:07:03.000000000
+0100
+++ new/pynetbox-6.6.1/tests/test_api.py 2022-02-20 22:32:49.000000000
+0100
@@ -52,10 +52,13 @@
ok = True
@patch(
- "requests.sessions.Session.get",
return_value=ResponseHeadersWithVersion(),
+ "requests.sessions.Session.get",
+ return_value=ResponseHeadersWithVersion(),
)
def test_api_version(self, *_):
- api = pynetbox.api(host,)
+ api = pynetbox.api(
+ host,
+ )
self.assertEqual(api.version, "1.999")
class ResponseHeadersWithoutVersion:
@@ -63,10 +66,13 @@
ok = True
@patch(
- "requests.sessions.Session.get",
return_value=ResponseHeadersWithoutVersion(),
+ "requests.sessions.Session.get",
+ return_value=ResponseHeadersWithoutVersion(),
)
def test_api_version_not_found(self, *_):
- api = pynetbox.api(host,)
+ api = pynetbox.api(
+ host,
+ )
self.assertEqual(api.version, "")
@@ -80,10 +86,13 @@
}
@patch(
- "requests.sessions.Session.get", return_value=ResponseWithStatus(),
+ "requests.sessions.Session.get",
+ return_value=ResponseWithStatus(),
)
def test_api_status(self, *_):
- api = pynetbox.api(host,)
+ api = pynetbox.api(
+ host,
+ )
self.assertEqual(api.status()["netbox-version"], "0.9.9")
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pynetbox-6.4.1/tests/test_app.py
new/pynetbox-6.6.1/tests/test_app.py
--- old/pynetbox-6.4.1/tests/test_app.py 2021-12-22 03:07:03.000000000
+0100
+++ new/pynetbox-6.6.1/tests/test_app.py 2022-02-20 22:32:49.000000000
+0100
@@ -36,7 +36,14 @@
"pynetbox.core.query.Request.get",
return_value={
"tables": {
- "DeviceTable": {"columns": ["name", "status", "tenant",
"tags",],},
+ "DeviceTable": {
+ "columns": [
+ "name",
+ "status",
+ "tenant",
+ "tags",
+ ],
+ },
},
},
)
@@ -66,7 +73,12 @@
@patch(
"pynetbox.core.query.Request.get",
- return_value=[{"name": "test_plugin", "package":
"netbox_test_plugin",}],
+ return_value=[
+ {
+ "name": "test_plugin",
+ "package": "netbox_test_plugin",
+ }
+ ],
)
def test_installed_plugins(self, *_):
api = pynetbox.api(host, **def_kwargs)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pynetbox-6.4.1/tests/test_circuits.py
new/pynetbox-6.6.1/tests/test_circuits.py
--- old/pynetbox-6.4.1/tests/test_circuits.py 2021-12-22 03:07:03.000000000
+0100
+++ new/pynetbox-6.6.1/tests/test_circuits.py 2022-02-20 22:32:49.000000000
+0100
@@ -9,7 +9,9 @@
else:
from mock import patch
-api = pynetbox.api("http://localhost:8000",)
+api = pynetbox.api(
+ "http://localhost:8000",
+)
nb = api.circuits
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pynetbox-6.4.1/tests/test_tenancy.py
new/pynetbox-6.6.1/tests/test_tenancy.py
--- old/pynetbox-6.4.1/tests/test_tenancy.py 2021-12-22 03:07:03.000000000
+0100
+++ new/pynetbox-6.6.1/tests/test_tenancy.py 2022-02-20 22:32:49.000000000
+0100
@@ -10,7 +10,9 @@
from mock import patch
-api = pynetbox.api("http://localhost:8000",)
+api = pynetbox.api(
+ "http://localhost:8000",
+)
nb = api.tenancy
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pynetbox-6.4.1/tests/test_users.py
new/pynetbox-6.6.1/tests/test_users.py
--- old/pynetbox-6.4.1/tests/test_users.py 2021-12-22 03:07:03.000000000
+0100
+++ new/pynetbox-6.6.1/tests/test_users.py 2022-02-20 22:32:49.000000000
+0100
@@ -10,7 +10,9 @@
from mock import patch
-api = pynetbox.api("http://localhost:8000",)
+api = pynetbox.api(
+ "http://localhost:8000",
+)
nb = api.users
@@ -109,7 +111,7 @@
class UnknownModelTestCase(unittest.TestCase):
- """ This test validates that an unknown model is returned as Record object
+ """This test validates that an unknown model is returned as Record object
and that the __str__() method correctly uses the 'display' field of the
object (introduced as a standard field in NetBox 2.11.0).
"""
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pynetbox-6.4.1/tests/test_virtualization.py
new/pynetbox-6.6.1/tests/test_virtualization.py
--- old/pynetbox-6.4.1/tests/test_virtualization.py 2021-12-22
03:07:03.000000000 +0100
+++ new/pynetbox-6.6.1/tests/test_virtualization.py 2022-02-20
22:32:49.000000000 +0100
@@ -10,7 +10,9 @@
from mock import patch
-api = pynetbox.api("http://localhost:8000",)
+api = pynetbox.api(
+ "http://localhost:8000",
+)
nb = api.virtualization
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pynetbox-6.4.1/tests/unit/test_extras.py
new/pynetbox-6.6.1/tests/unit/test_extras.py
--- old/pynetbox-6.4.1/tests/unit/test_extras.py 2021-12-22
03:07:03.000000000 +0100
+++ new/pynetbox-6.6.1/tests/unit/test_extras.py 2022-02-20
22:32:49.000000000 +0100
@@ -8,7 +8,11 @@
class ExtrasTestCase(unittest.TestCase):
def test_config_contexts(self):
test_values = {
- "data": {"test_int": 123, "test_str": "testing", "test_list": [1,
2, 3],}
+ "data": {
+ "test_int": 123,
+ "test_str": "testing",
+ "test_list": [1, 2, 3],
+ }
}
test = ConfigContexts(test_values, None, None)
self.assertTrue(test)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pynetbox-6.4.1/tests/unit/test_query.py
new/pynetbox-6.6.1/tests/unit/test_query.py
--- old/pynetbox-6.4.1/tests/unit/test_query.py 2021-12-22 03:07:03.000000000
+0100
+++ new/pynetbox-6.6.1/tests/unit/test_query.py 2022-02-20 22:32:49.000000000
+0100
@@ -40,7 +40,8 @@
def test_get_count_no_filters(self):
test_obj = Request(
- http_session=Mock(), base="http://localhost:8001/api/dcim/devices",
+ http_session=Mock(),
+ base="http://localhost:8001/api/dcim/devices",
)
test_obj.http_session.get.return_value.json.return_value = {
"count": 42,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pynetbox-6.4.1/tests/unit/test_response.py
new/pynetbox-6.6.1/tests/unit/test_response.py
--- old/pynetbox-6.4.1/tests/unit/test_response.py 2021-12-22
03:07:03.000000000 +0100
+++ new/pynetbox-6.6.1/tests/unit/test_response.py 2022-02-20
22:32:49.000000000 +0100
@@ -81,9 +81,18 @@
test_values = {
"id": 123,
"tags": [
- {"id": 1, "name": "foo",},
- {"id": 2, "name": "bar",},
- {"id": 3, "name": "baz",},
+ {
+ "id": 1,
+ "name": "foo",
+ },
+ {
+ "id": 2,
+ "name": "bar",
+ },
+ {
+ "id": 3,
+ "name": "baz",
+ },
],
}
test = Record(test_values, None, None).serialize()
@@ -162,7 +171,10 @@
def test_choices_idempotence_prev27(self):
test_values = {
"id": 123,
- "choices_test": {"value": 1, "label": "test",},
+ "choices_test": {
+ "value": 1,
+ "label": "test",
+ },
}
test = Record(test_values, None, None)
test.choices_test = 1
@@ -171,7 +183,11 @@
def test_choices_idempotence_v27(self):
test_values = {
"id": 123,
- "choices_test": {"value": "test", "label": "test", "id": 1,},
+ "choices_test": {
+ "value": "test",
+ "label": "test",
+ "id": 1,
+ },
}
test = Record(test_values, None, None)
test.choices_test = "test"
@@ -180,7 +196,10 @@
def test_choices_idempotence_v28(self):
test_values = {
"id": 123,
- "choices_test": {"value": "test", "label": "test",},
+ "choices_test": {
+ "value": "test",
+ "label": "test",
+ },
}
test = Record(test_values, None, None)
test.choices_test = "test"