Skip to content

Commit fb57747

Browse files
authored
Merge pull request #1504 from netbox-community/devel
Release v3.22.0
2 parents 90a506f + 594591e commit fb57747

File tree

307 files changed

+31231
-1122
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

307 files changed

+31231
-1122
lines changed

.github/ISSUE_TEMPLATE/bug_report.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ body:
6767
Describe in detail the exact steps that someone else can take to
6868
reproduce this bug using the current stable release of the Ansible NetBox collection.
6969
Include any sanatized playbooks, variables, & tasks specifically showing just the issue.
70-
#placeholder: |
70+
# placeholder: |
7171

7272
validations:
7373
required: true

.github/workflows/main.yml

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,20 @@ jobs:
1515
- name: Run black
1616
uses: psf/black@stable
1717

18+
- name: Run yamllint
19+
uses: ibiqlik/action-yamllint@v3
20+
with:
21+
file_or_dir: .
22+
config_file: .yamllint.yml
23+
strict: true
24+
1825
unit_testing:
1926
runs-on: ubuntu-24.04
2027
needs: linting
2128
strategy:
2229
fail-fast: false
2330
matrix:
24-
python-version: ["3.13"]
31+
python-version: ["3.11", "3.12", "3.13"]
2532

2633
steps:
2734

@@ -66,13 +73,13 @@ jobs:
6673
strategy:
6774
fail-fast: false
6875
matrix:
69-
include:
70-
- VERSION: "v4.0"
71-
NETBOX_DOCKER_VERSION: 2.9.1
76+
include:
7277
- VERSION: "v4.1"
7378
NETBOX_DOCKER_VERSION: 3.0.1
7479
- VERSION: "v4.2"
75-
NETBOX_DOCKER_VERSION: 3.1.0
80+
NETBOX_DOCKER_VERSION: 3.2.1
81+
- VERSION: "v4.3"
82+
NETBOX_DOCKER_VERSION: 3.3.0
7683

7784
steps:
7885

@@ -114,7 +121,7 @@ jobs:
114121
docker container ls
115122
docker logs netbox-docker-netbox-1
116123
timeout 300 bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost:32768/login/)" != "200" ]]; do echo "waiting for NetBox"; sleep 5; done' || false
117-
working-directory: /home/runner/.ansible/collections/ansible_collections/netbox/netbox
124+
working-directory: /home/runner/.ansible/collections/ansible_collections/netbox/netbox
118125

119126
- name: Pre-populate NetBox
120127
run: ./tests/integration/netbox-deploy.py
@@ -126,13 +133,13 @@ jobs:
126133
ansible-test integration -v --color --coverage --python ${{ env.python-version }} inventory-${{ matrix.VERSION }}
127134
working-directory: /home/runner/.ansible/collections/ansible_collections/netbox/netbox
128135

129-
- name: Run regression tests
136+
- name: Run regression tests
130137
continue-on-error: true
131-
run: |
132-
ansible-test integration -v --color --coverage --python ${{ env.python-version }} regression-${{ matrix.VERSION }}
138+
run: |
139+
ansible-test integration -v --color --coverage --python ${{ env.python-version }} regression-${{ matrix.VERSION }}
133140
working-directory: /home/runner/.ansible/collections/ansible_collections/netbox/netbox
134141

135-
- name: Run integration tests
142+
- name: Run integration tests
136143
run: |
137144
ansible-test integration -v --color --coverage --python ${{ env.python-version }} ${{ matrix.VERSION }}
138145
ansible-test coverage report --all --omit "tests/*,hacking/*,docs/*" --show-missing

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
name: Deploy collection to Ansible Galaxy
33
on:
4-
create:
4+
push:
55
tags:
66
- "v*"
77
jobs:

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,4 @@ jobs:
4747
'${{ needs.unit-galaxy.result }}',
4848
'${{ needs.unit-source.result }}',
4949
'${{ needs.ansible-lint.result }}'
50-
])"
50+
])"

.yamllint.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
---
2+
extends: default
3+
4+
# see rules at https://yamllint.readthedocs.io/en/latest/rules.html
5+
ignore: |
6+
- .cache/
7+
- .venv/
8+
- .github/
9+
10+
rules:
11+
braces:
12+
max-spaces-inside: 20
13+
level: error
14+
brackets:
15+
max-spaces-inside: 20
16+
level: error
17+
colons:
18+
max-spaces-before: 1
19+
max-spaces-after: 20
20+
level: error
21+
commas:
22+
max-spaces-before: 50
23+
min-spaces-after: 1
24+
max-spaces-after: 20
25+
level: error
26+
comments:
27+
min-spaces-from-content: 1
28+
comments-indentation: disable
29+
document-start:
30+
present: true
31+
empty-lines:
32+
max: 3
33+
level: error
34+
hyphens:
35+
level: error
36+
indentation:
37+
spaces: 2
38+
indent-sequences: whatever
39+
check-multi-line-strings: false
40+
key-duplicates: enable
41+
line-length:
42+
max: 230
43+
level: warning
44+
allow-non-breakable-words: true
45+
allow-non-breakable-inline-mappings: true
46+
new-line-at-end-of-file: enable
47+
new-lines:
48+
type: unix
49+
trailing-spaces: enable
50+
truthy: disable
51+
octal-values:
52+
forbid-explicit-octal: true

CHANGELOG.rst

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,52 @@ NetBox.NetBox Release Notes
44

55
.. contents:: Topics
66

7+
v3.22.0
8+
=======
9+
10+
Minor Changes
11+
-------------
12+
13+
- Add integration tests for contact groups
14+
- Add support for custom headers for all modules
15+
- Change `netbox_contact.contact_group` to `contact_groups`
16+
- Fix ansible-bad-import-from pylint errors
17+
- Fix broken code path when using old api path on old netbox systems
18+
- Make the unit-test data structures more flexible.
19+
- Remove abandoned unit-test data.
20+
- add workaround to _build_query_params for services and Netbox 4.3.0 - 4.4.3 (wrong parent_object_type data type)
21+
- add yamllint to project pipeline.
22+
- improve version_check_greater to be more universal
23+
- netbox_circuit_termination - Add parameters termination_id and termination_type for NetBox 4.2+
24+
- netbox_tag - Add support for object_types on tags
25+
- rename variable full_version to netbox_version.
26+
- rename variable version to api_version.
27+
- sanitize netbox versions received from api
28+
- test suite expanded to run on Python 3.11, 3.12, and 3.13.
29+
- user.groups, user.permissions, user_group.permissions, permission.actions, and permission.object_types are now treated as unordered sets for update comparison purposes.
30+
31+
Bugfixes
32+
--------
33+
34+
- Add netbox version check to support service creation for netbox version prior of 4.3
35+
- Fix integration test for circuit termination, missing assignment
36+
- Fix integration test for service
37+
- Fix task duplicate task name in documentation that cause ansible-lint error
38+
- Fix typos in tag integration tests.
39+
- Support for related_object_filter when related_object_type is "object"
40+
- Use dedicated function to check netbox version istead of self.full_version for rack.
41+
- add parent_object_type and parent_object_id to services ALLOWED_QUERY_PARAMS
42+
- nb_device_interface: Fix specifying primary_mac_address objects by id for disambiguation
43+
- nb_inventory - Fix service collection for version greater than 4.3
44+
- nb_inventory - Fixed empty inventory results when netbox server URL is a non-root path
45+
- netbox_service - Fix issue 1426 - broken netbox_service module
46+
47+
New Modules
48+
-----------
49+
50+
- netbox.netbox.netbox_contact_assignment - Manage contact assignments in NetBox
51+
- netbox.netbox.netbox_data_source - Manage data sources in NetBox
52+
753
v3.21.0
854
=======
955

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ This Ansible collection consists of a set of modules to define the intended netw
99

1010
- You must be running one of the two most recent releases of NetBox
1111
- A NetBox write-enabled API token when using modules or a read-only token for the `nb_lookup` and `nb_inventory` plugins.
12-
- Python 3.10+
12+
- Python 3.11+
1313
- Python modules:
1414
- pytz
1515
- pynetbox
16-
- Ansible 2.15+
16+
- Ansible 2.18+
1717

1818
## Installation
1919

changelogs/changelog.yaml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
---
12
ancestor: null
23
releases:
34
0.1.0:
@@ -851,6 +852,71 @@ releases:
851852
name: netbox_mac_address
852853
namespace: ''
853854
release_date: '2025-03-04'
855+
3.22.0:
856+
changes:
857+
minor_changes:
858+
- Change `netbox_contact.contact_group` to `contact_groups`
859+
- Add integration tests for contact groups
860+
- Add support for custom headers for all modules
861+
- Fix ansible-bad-import-from pylint errors
862+
- Fix broken code path when using old api path on old netbox systems
863+
- add workaround to _build_query_params for services and Netbox 4.3.0 - 4.4.3 (wrong parent_object_type data type)
864+
- netbox_circuit_termination - Add parameters termination_id and termination_type for NetBox 4.2+
865+
- netbox_tag - Add support for object_types on tags
866+
- improve version_check_greater to be more universal
867+
- sanitize netbox versions received from api
868+
- test suite expanded to run on Python 3.11, 3.12, and 3.13.
869+
- Make the unit-test data structures more flexible.
870+
- Remove abandoned unit-test data.
871+
- user.groups, user.permissions, user_group.permissions, permission.actions, and permission.object_types are now treated as unordered sets for update comparison purposes.
872+
- rename variable version to api_version.
873+
- rename variable full_version to netbox_version.
874+
- add yamllint to project pipeline.
875+
bugfixes:
876+
- Fix task duplicate task name in documentation that cause ansible-lint error
877+
- nb_inventory - Fix service collection for version greater than 4.3
878+
- Add netbox version check to support service creation for netbox version prior of 4.3
879+
- Use dedicated function to check netbox version istead of self.full_version for rack.
880+
- Fix typos in tag integration tests.
881+
- Fix integration test for circuit termination, missing assignment
882+
- Fix integration test for service
883+
- "nb_device_interface: Fix specifying primary_mac_address objects by id for disambiguation"
884+
- add parent_object_type and parent_object_id to services ALLOWED_QUERY_PARAMS
885+
- nb_inventory - Fixed empty inventory results when netbox server URL is a non-root path
886+
- Support for related_object_filter when related_object_type is "object"
887+
- netbox_service - Fix issue 1426 - broken netbox_service module
888+
modules:
889+
- description: Manage data sources in NetBox
890+
name: netbox_data_source
891+
namespace: ''
892+
- description: Manage contact assignments in NetBox
893+
name: netbox_contact_assignment
894+
namespace: ''
895+
fragments:
896+
- 1182-fix-contact-groups.yml
897+
- 1433-add-custom-headers.yml
898+
- 1435-fix-duplicate-task-name.yml
899+
- 1438-fix-inventory-service-collection.yml
900+
- 1439-fix-sevral-bug-discovered-by-integration-tests.yml
901+
- 1459-add-netbox-data-sources.yml
902+
- 1462-fix-pylint-errors.yml
903+
- 1464-fix-mac-lookup-by-id.yml
904+
- 1469-fix-old-apis.yml
905+
- 1479-fix-services_parent_object.yml
906+
- contacts.yml
907+
- nb_inventory.yml
908+
- netbox_circuit_termination.yml
909+
- netbox_custom_field.yml
910+
- netbox_service.yml
911+
- netbox_tag.yml
912+
- netbox_version_check_greater.yml
913+
- netbox_version_sanitize.yml
914+
- python_versions.yml
915+
- unit_test_data.yml
916+
- users-ordering.yml
917+
- version_api.yml
918+
- version_netbox.yml
919+
- yamllint.yml
854920
3.3.0:
855921
changes:
856922
minor_changes:

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
author = "Mikhail Yohman <@FragmentedPacket>"
2828

2929
# The full version, including alpha/beta/rc tags
30-
release = "3.21.0"
30+
release = "3.22.0"
3131

3232

3333
# -- General configuration ---------------------------------------------------

docs/getting_started/contributing/modules/architecture.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -284,14 +284,15 @@ We set several instance attributes that are used within other methods throughout
284284
url = self.module.params["netbox_url"]
285285
token = self.module.params["netbox_token"]
286286
ssl_verify = self.module.params["validate_certs"]
287+
headers = self.module.params["headers"]
287288
288289
# Attempt to initiate connection to NetBox
289290
if nb_client is None:
290-
self.nb = self._connect_netbox_api(url, token, ssl_verify)
291+
self.nb = self._connect_netbox_api(url, token, ssl_verify, headers)
291292
else:
292293
self.nb = nb_client
293294
try:
294-
self.version = self.nb.version
295+
self.api_version = self.nb.version
295296
except AttributeError:
296297
self.module.fail_json(msg="Must have pynetbox >=4.1.0")
297298

0 commit comments

Comments
 (0)