Skip to content

Commit 398ba8a

Browse files
Fixing validate-modules errors + any other testing issues that need to be taken care of (#225)
1 parent ca8629d commit 398ba8a

File tree

79 files changed

+830
-5161
lines changed

Some content is hidden

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

79 files changed

+830
-5161
lines changed

.travis.yml

Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -10,38 +10,21 @@ env:
1010
global:
1111
- COLLECTION_NAMESPACE: netbox
1212
- COLLECTION_NAME: netbox
13-
- COLLECTION_VERSION: 0.2.2
13+
- COLLECTION_VERSION: 0.2.3
1414
- secure: "tE6GtwrRU+Kjobx/94xqR2MqM20pHCnrLcHgPzIHA3npdwuA+GjCBiBLTkEEQM4fUWIfzUTyjSr9bZErm1PTI1GcIRdniTgJ3ZzSSkE7tgeYALB/7xsusB57SlmbBQm2SGwU558uWZ3NHEsi0WTgD8GKZo77OpGX72FZKsVXOz6k2wve51sOtoSVjgCsvWTmZHx4ynGdiA5wFkZfaEcjXECahKtunW+MlB5kpJzkVeLRUEXFMhWlsIYiA5nj8OI/X3Nk9ugh1ribENX9LrjpgrqQ9YariZ8G6py1ONuKZIn2g7xs5kNQ3qL6HL6N7SoUxiwH16CfSyugFaYiMfaxQ4NUVGGRHS4vSGbNIf+gLHcYvP40miI1f/+pntCzqygZMhW73FX2o+KH2OGv09khOl8k1nDg2/XvW0kCc/FU6l+Jp5wCC8H9X2uiULtQpRqts5TzIonlPEzGIpfGFgJ5m54Emhv9gjG1Z5OOyL/qae1Wr+L/uhiFafcglZYh8NHEMWCUCkeqFqR2kDmUMtdgYLD7Q7NdwlL/PSVVs1l7UPiQHlnecQKEHN7CvR3eKByTEmkCKafRYh/JQ9rBt9sZc7aAPVu+w3wWUwbHS4o4vVnmyXvJb1PeJSiuynF7CBo4Qd6qj4YwX8gLK6PylGyaMOp169u6xw1mo5/CX0pJ3x4="
1515

1616
jobs:
1717
include:
18-
# Previous release of Netbox, latest release of Ansible
19-
- name: "Python 3.6 - Netbox 2.6 - Latest PyPi Ansible"
20-
python: 3.6
21-
env: PYTHON_VER=3.6 VERSION=v2.6 INTEGRATION_TESTS=v2.6
22-
install:
23-
- cd ..
24-
# Setup netbox container for integration testing
25-
- git clone https://github.com/FragmentedPacket/netbox-docker.git
26-
- cd netbox-docker
27-
- docker-compose pull
28-
- docker-compose up -d
29-
- cd ..
30-
# setuptools <46.1.3 has issues with ansible-test executables https://github.com/ansible/ansible/issues/68963
31-
- pip install -U pip "setuptools>=46.1.3"
32-
# coverage 5.0 is not compatible with ansible-test https://github.com/ansible/ansible/issues/65907
33-
- pip install pytest==4.6.5 pytest-mock pytest-xdist jinja2 PyYAML black==19.10b0 "coverage<5"
34-
- pip install pynetbox cryptography codecov jmespath jsondiff ansible
35-
3618
- name: "Python 3.6 - Netbox 2.7 - Latest PyPi Ansible"
3719
python: 3.6
3820
env:
39-
- PYTHON_VER=3.6 VERSION=v2.7 INTEGRATION_TESTS=latest
21+
- PYTHON_VER=3.6 VERSION=v2.7 INTEGRATION_TESTS=latest
4022
install:
4123
- cd ..
4224
# Setup netbox container for integration testing
4325
- git clone https://github.com/netbox-community/netbox-docker.git
4426
- cd netbox-docker
27+
- sed -i 's/SKIP_STARTUP_SCRIPTS=false/SKIP_STARTUP_SCRIPTS=true/' env/netbox.env
4528
- docker-compose pull
4629
- docker-compose up -d
4730
- cd ..
@@ -55,7 +38,7 @@ jobs:
5538
- name: "Python 3.7 - Netbox 2.8 - Latest PyPi Ansible"
5639
python: 3.7
5740
env:
58-
- PYTHON_VER=3.7 VERSION=v2.8 INTEGRATION_TESTS=latest
41+
- PYTHON_VER=3.7 VERSION=v2.8 INTEGRATION_TESTS=latest
5942
install:
6043
- cd ..
6144
# Setup netbox container for integration testing
@@ -110,15 +93,13 @@ before_script:
11093
- chmod +x tests/integration/targets/inventory/compare_inventory_json.py
11194

11295
script:
113-
11496
# Check python syntax
11597
- black . --check --diff
11698

11799
# Sanity tests
118100
# --requirements - install pip packages as necessary
119101
# Skip pep8 as we use black instead
120-
# Skip validate-modules until the issues can be resolved #180
121-
- ansible-test sanity -v --requirements --python $PYTHON_VER --skip-test pep8 --skip-test validate-modules
102+
- ansible-test sanity -v --requirements --python $PYTHON_VER --skip-test pep8
122103

123104
# Unit tests, with code coverage
124105
- ansible-test units -v --coverage --python $PYTHON_VER

galaxy.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ namespace: netbox
99
name: netbox
1010

1111
# The version of the collection. Must be compatible with semantic versioning
12-
version: 0.2.2
12+
version: 0.2.3
1313

1414
# The path to the Markdown (.md) readme file. This path is relative to the root of the collection
1515
readme: README.md
@@ -68,8 +68,8 @@ issues: https://github.com/netbox-community/ansible_modules/issues
6868
# https://github.com/ansible/ansible/issues/67543
6969
# https://docs.ansible.com/ansible/devel/dev_guide/developing_collections.html#ignoring-files-and-folders
7070
build_ignore:
71-
- venv
72-
- ansible_collections
73-
- tests/output
74-
- .pytest_cache
75-
- .vscode
71+
- venv
72+
- ansible_collections
73+
- tests/output
74+
- .pytest_cache
75+
- .vscode

plugins/module_utils/netbox_circuits.py

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,11 @@
55

66
__metaclass__ = type
77

8-
# This should just be temporary once 2.9 is relased and tested we can remove this
9-
try:
10-
from ansible_collections.netbox.netbox.plugins.module_utils.netbox_utils import (
11-
NetboxModule,
12-
ENDPOINT_NAME_MAPPING,
13-
SLUG_REQUIRED,
14-
)
15-
except ImportError:
16-
import sys
17-
18-
sys.path.append(".")
19-
from netbox_utils import NetboxModule, ENDPOINT_NAME_MAPPING, SLUG_REQUIRED
8+
from ansible_collections.netbox.netbox.plugins.module_utils.netbox_utils import (
9+
NetboxModule,
10+
ENDPOINT_NAME_MAPPING,
11+
SLUG_REQUIRED,
12+
)
2013

2114

2215
NB_PROVIDERS = "providers"

plugins/module_utils/netbox_dcim.py

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,11 @@
99
import traceback
1010
from ansible.module_utils.basic import missing_required_lib
1111

12-
try:
13-
from ansible_collections.netbox.netbox.plugins.module_utils.netbox_utils import (
14-
NetboxModule,
15-
ENDPOINT_NAME_MAPPING,
16-
SLUG_REQUIRED,
17-
)
18-
except ImportError:
19-
import sys
20-
21-
sys.path.append(".")
22-
from netbox_utils import NetboxModule, ENDPOINT_NAME_MAPPING, SLUG_REQUIRED
12+
from ansible_collections.netbox.netbox.plugins.module_utils.netbox_utils import (
13+
NetboxModule,
14+
ENDPOINT_NAME_MAPPING,
15+
SLUG_REQUIRED,
16+
)
2317

2418

2519
NB_DEVICE_BAYS = "device_bays"

plugins/module_utils/netbox_extras.py

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,10 @@
55

66
__metaclass__ = type
77

8-
# This should just be temporary once 2.9 is relased and tested we can remove this
9-
try:
10-
from ansible_collections.netbox.netbox.plugins.module_utils.netbox_utils import (
11-
NetboxModule,
12-
ENDPOINT_NAME_MAPPING,
13-
)
14-
except ImportError:
15-
import sys
16-
17-
sys.path.append(".")
18-
from netbox_utils import NetboxModule, ENDPOINT_NAME_MAPPING
8+
from ansible_collections.netbox.netbox.plugins.module_utils.netbox_utils import (
9+
NetboxModule,
10+
ENDPOINT_NAME_MAPPING,
11+
)
1912

2013

2114
class NetboxExtrasModule(NetboxModule):

plugins/module_utils/netbox_ipam.py

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,11 @@
1111
from ansible.module_utils._text import to_text
1212
from ansible.module_utils.basic import missing_required_lib
1313

14-
try:
15-
from ansible_collections.netbox.netbox.plugins.module_utils.netbox_utils import (
16-
NetboxModule,
17-
ENDPOINT_NAME_MAPPING,
18-
SLUG_REQUIRED,
19-
)
20-
except ImportError:
21-
import sys
22-
23-
sys.path.append(".")
24-
from netbox_utils import NetboxModule, ENDPOINT_NAME_MAPPING, SLUG_REQUIRED
14+
from ansible_collections.netbox.netbox.plugins.module_utils.netbox_utils import (
15+
NetboxModule,
16+
ENDPOINT_NAME_MAPPING,
17+
SLUG_REQUIRED,
18+
)
2519

2620

2721
NB_AGGREGATES = "aggregates"

plugins/module_utils/netbox_secrets.py

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,10 @@
55

66
__metaclass__ = type
77

8-
# This should just be temporary once 2.9 is relased and tested we can remove this
9-
try:
10-
from ansible_collections.netbox.netbox.plugins.module_utils.netbox_utils import (
11-
NetboxModule,
12-
ENDPOINT_NAME_MAPPING,
13-
)
14-
except ImportError:
15-
import sys
16-
17-
sys.path.append(".")
18-
from netbox_utils import NetboxModule, ENDPOINT_NAME_MAPPING
8+
from ansible_collections.netbox.netbox.plugins.module_utils.netbox_utils import (
9+
NetboxModule,
10+
ENDPOINT_NAME_MAPPING,
11+
)
1912

2013

2114
class NetboxSecretsModule(NetboxModule):

plugins/module_utils/netbox_tenancy.py

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,11 @@
55

66
__metaclass__ = type
77

8-
# This should just be temporary once 2.9 is relased and tested we can remove this
9-
try:
10-
from ansible_collections.netbox.netbox.plugins.module_utils.netbox_utils import (
11-
NetboxModule,
12-
ENDPOINT_NAME_MAPPING,
13-
SLUG_REQUIRED,
14-
)
15-
except ImportError:
16-
import sys
17-
18-
sys.path.append(".")
19-
from netbox_utils import NetboxModule, ENDPOINT_NAME_MAPPING, SLUG_REQUIRED
8+
from ansible_collections.netbox.netbox.plugins.module_utils.netbox_utils import (
9+
NetboxModule,
10+
ENDPOINT_NAME_MAPPING,
11+
SLUG_REQUIRED,
12+
)
2013

2114

2215
NB_TENANTS = "tenants"

plugins/module_utils/netbox_utils.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212
import re
1313
from itertools import chain
1414
from ansible_collections.ansible.netcommon.plugins.module_utils.compat import ipaddress
15-
from ansible.module_utils._text import to_text
15+
16+
# from ansible.module_utils._text import to_text
17+
from ansible.module_utils.common.text.converters import to_text
1618

1719
# from ._text import to_native
1820
from ansible.module_utils._text import to_native
@@ -777,7 +779,6 @@ def __init__(
777779
add_file_common_args=False,
778780
supports_check_mode=supports_check_mode,
779781
required_if=required_if,
780-
required_by=None,
781782
)
782783

783784
def _check_required_if(self, spec, param=None):

plugins/module_utils/netbox_virtualization.py

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,11 @@
55

66
__metaclass__ = type
77

8-
# This should just be temporary once 2.9 is relased and tested we can remove this
9-
try:
10-
from ansible_collections.netbox.netbox.plugins.module_utils.netbox_utils import (
11-
NetboxModule,
12-
ENDPOINT_NAME_MAPPING,
13-
SLUG_REQUIRED,
14-
)
15-
except ImportError:
16-
import sys
17-
18-
sys.path.append(".")
19-
from netbox_utils import NetboxModule, ENDPOINT_NAME_MAPPING
8+
from ansible_collections.netbox.netbox.plugins.module_utils.netbox_utils import (
9+
NetboxModule,
10+
ENDPOINT_NAME_MAPPING,
11+
SLUG_REQUIRED,
12+
)
2013

2114

2215
NB_VIRTUAL_MACHINES = "virtual_machines"

0 commit comments

Comments
 (0)