Skip to content

Commit 20c9dcd

Browse files
authored
Update CI to Ansible 2.13 (#919)
1 parent 54d3710 commit 20c9dcd

File tree

5 files changed

+61
-48
lines changed

5 files changed

+61
-48
lines changed

plugins/inventory/nb_inventory.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66
__metaclass__ = type
77

88
DOCUMENTATION = """
9-
name: nb_inventory
10-
plugin_type: inventory
9+
name: nb_inventory
1110
author:
1211
- Remy Leone (@sieben)
1312
- Anthony Ruhier (@Anthony25)
@@ -139,6 +138,7 @@
139138
- I(rack_group) is supported on NetBox versions 2.10 or lower only
140139
- I(location) is supported on NetBox versions 2.11 or higher only
141140
type: list
141+
elements: str
142142
choices:
143143
- sites
144144
- site
@@ -180,18 +180,21 @@
180180
- List of parameters passed to the query string for both devices and VMs (Multiple values may be separated by commas).
181181
- You can also use Jinja2 templates.
182182
type: list
183+
elements: str
183184
default: []
184185
device_query_filters:
185186
description:
186187
- List of parameters passed to the query string for devices (Multiple values may be separated by commas).
187188
- You can also use Jinja2 templates.
188189
type: list
190+
elements: str
189191
default: []
190192
vm_query_filters:
191193
description:
192194
- List of parameters passed to the query string for VMs (Multiple values may be separated by commas).
193195
- You can also use Jinja2 templates.
194196
type: list
197+
elements: str
195198
default: []
196199
timeout:
197200
description: Timeout for NetBox requests in seconds
@@ -348,7 +351,7 @@
348351
from itertools import chain
349352
from collections import defaultdict
350353
from ipaddress import ip_interface
351-
from packaging import specifiers, version
354+
352355

353356
from ansible.constants import DEFAULT_LOCAL_TMP
354357
from ansible.plugins.inventory import BaseInventoryPlugin, Constructable, Cacheable
@@ -360,6 +363,13 @@
360363
from ansible.module_utils.six.moves.urllib.parse import urlencode
361364
from ansible.module_utils.six import raise_from
362365

366+
try:
367+
from packaging import specifiers, version
368+
except ImportError as imp_exc:
369+
PACKAGING_IMPORT_ERROR = imp_exc
370+
else:
371+
PACKAGING_IMPORT_ERROR = None
372+
363373
try:
364374
import pytz
365375
except ImportError as imp_exc:

plugins/lookup/nb_lookup.py

Lines changed: 25 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -11,36 +11,11 @@
1111

1212
from __future__ import absolute_import, division, print_function
1313

14-
import os
15-
import functools
16-
from pprint import pformat
17-
18-
from ansible.errors import AnsibleError
19-
from ansible.plugins.lookup import LookupBase
20-
from ansible.parsing.splitter import parse_kv, split_args
21-
from ansible.utils.display import Display
22-
from ansible.module_utils.six import raise_from
23-
24-
try:
25-
import pynetbox
26-
except ImportError as imp_exc:
27-
PYNETBOX_LIBRARY_IMPORT_ERROR = imp_exc
28-
else:
29-
PYNETBOX_LIBRARY_IMPORT_ERROR = None
30-
31-
try:
32-
import requests
33-
except ImportError as imp_exc:
34-
REQUESTS_LIBRARY_IMPORT_ERROR = imp_exc
35-
else:
36-
REQUESTS_LIBRARY_IMPORT_ERROR = None
37-
38-
3914
__metaclass__ = type
4015

4116
DOCUMENTATION = """
42-
lookup: nb_lookup
4317
author: Chris Mills (@cpmills1975)
18+
name: nb_lookup
4419
version_added: "0.1.0"
4520
short_description: Queries and returns elements from NetBox
4621
description:
@@ -151,6 +126,30 @@
151126
type: list
152127
"""
153128

129+
import os
130+
import functools
131+
from pprint import pformat
132+
133+
from ansible.errors import AnsibleError
134+
from ansible.plugins.lookup import LookupBase
135+
from ansible.parsing.splitter import parse_kv, split_args
136+
from ansible.utils.display import Display
137+
from ansible.module_utils.six import raise_from
138+
139+
try:
140+
import pynetbox
141+
except ImportError as imp_exc:
142+
PYNETBOX_LIBRARY_IMPORT_ERROR = imp_exc
143+
else:
144+
PYNETBOX_LIBRARY_IMPORT_ERROR = None
145+
146+
try:
147+
import requests
148+
except ImportError as imp_exc:
149+
REQUESTS_LIBRARY_IMPORT_ERROR = imp_exc
150+
else:
151+
REQUESTS_LIBRARY_IMPORT_ERROR = None
152+
154153

155154
def get_endpoint(netbox, term):
156155
"""

plugins/module_utils/netbox_dcim.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
from packaging.version import Version
5555

5656
HAS_PACKAGING = True
57+
PACKAGING_IMPORT_ERROR = ""
5758
except ImportError as imp_exc:
5859
PACKAGING_IMPORT_ERROR = imp_exc
5960
HAS_PACKAGING = False

poetry.lock

Lines changed: 21 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ license = "GPLv3"
77

88
[tool.poetry.dependencies]
99
python = "^3.8"
10-
ansible-core = "2.12.*"
10+
ansible-core = "2.13.*"
1111
black = "*"
1212
codecov = "*"
1313
coverage = "^4.0"

0 commit comments

Comments
 (0)