Skip to content

Commit c85d8fc

Browse files
authored
Merge pull request #268 from networktocode/release-v3.0.4
Release v3.0.4
2 parents 11ae627 + 6d7ac5d commit c85d8fc

File tree

9 files changed

+431
-357
lines changed

9 files changed

+431
-357
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,9 @@ jobs:
126126
integration_nautobot:
127127
name: "Integration Test - Nautobot"
128128
runs-on: "ubuntu-20.04"
129+
strategy:
130+
matrix:
131+
nautobot-version: ["1.0.3", "1.1.6", "1.2.12", "1.3.1"]
129132
steps:
130133
- name: "Check out repository code"
131134
uses: "actions/checkout@v2"
@@ -145,7 +148,7 @@ jobs:
145148
poetry install
146149
invoke nautobot-integration-tests
147150
env:
148-
NAUTOBOT_VERSION: "1.0.1"
151+
NAUTOBOT_VERSION: "${{ matrix.nautobot-version }}"
149152
needs:
150153
- "pytest"
151154
integration_netbox210:

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## v3.0.4 - 2022-06-09
9+
10+
### Fixed
11+
12+
- [#137](https://github.com/networktocode/network-importer/pull/267) - Use public `diffsync` adapter methods

docs/getting_started.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,6 @@ network-importer apply [--update-configs] [--limit="site=nyc"]
145145
In addition to the supplied command you can also use `docker-compose` to bring up the required service stack. Like so:
146146
```
147147
sudo docker-compose up -d
148-
sudo docker-compose exec network-importer bash
148+
sudo docker-compose exec network_importer bash
149149
sudo docker-compose down
150150
```

network_importer/__init__.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
"Init for network-importer."
2+
3+
try:
4+
from importlib import metadata
5+
except ImportError:
6+
# Python version < 3.8
7+
import importlib_metadata as metadata
8+
9+
__version__ = metadata.version(__name__)

network_importer/adapters/base.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"""BaseAdapter for the network importer."""
22
from diffsync import DiffSync
3+
from diffsync.exceptions import ObjectNotFound
34
from network_importer.models import Site, Device, Interface, IPAddress, Cable, Vlan, Prefix
45

56

@@ -50,8 +51,10 @@ def get_or_create_vlan(self, vlan, site=None):
5051
modelname = vlan.get_type()
5152
uid = vlan.get_unique_id()
5253

53-
if uid in self._data[modelname]:
54-
return self._data[modelname][uid], False
54+
try:
55+
return self.get(modelname, uid), False
56+
except ObjectNotFound:
57+
pass
5558

5659
self.add(vlan)
5760
if site:
@@ -72,8 +75,10 @@ def get_or_add(self, obj):
7275
modelname = obj.get_type()
7376
uid = obj.get_unique_id()
7477

75-
if uid in self._data[modelname]:
76-
return self._data[modelname][uid], False
78+
try:
79+
return self.get(modelname, uid), False
80+
except ObjectNotFound:
81+
pass
7782

7883
self.add(obj)
7984

network_importer/version.py

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)