Skip to content

Commit

Permalink
Merge pull request #268 from networktocode/release-v3.0.4
Browse files Browse the repository at this point in the history
Release v3.0.4
  • Loading branch information
chadell committed Jun 9, 2022
2 parents 11ae627 + 6d7ac5d commit c85d8fc
Show file tree
Hide file tree
Showing 9 changed files with 431 additions and 357 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@ jobs:
integration_nautobot:
name: "Integration Test - Nautobot"
runs-on: "ubuntu-20.04"
strategy:
matrix:
nautobot-version: ["1.0.3", "1.1.6", "1.2.12", "1.3.1"]
steps:
- name: "Check out repository code"
uses: "actions/checkout@v2"
Expand All @@ -145,7 +148,7 @@ jobs:
poetry install
invoke nautobot-integration-tests
env:
NAUTOBOT_VERSION: "1.0.1"
NAUTOBOT_VERSION: "${{ matrix.nautobot-version }}"
needs:
- "pytest"
integration_netbox210:
Expand Down
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## v3.0.4 - 2022-06-09

### Fixed

- [#137](https://github.com/networktocode/network-importer/pull/267) - Use public `diffsync` adapter methods
2 changes: 1 addition & 1 deletion docs/getting_started.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,6 @@ network-importer apply [--update-configs] [--limit="site=nyc"]
In addition to the supplied command you can also use `docker-compose` to bring up the required service stack. Like so:
```
sudo docker-compose up -d
sudo docker-compose exec network-importer bash
sudo docker-compose exec network_importer bash
sudo docker-compose down
```
9 changes: 9 additions & 0 deletions network_importer/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
"Init for network-importer."

try:
from importlib import metadata
except ImportError:
# Python version < 3.8
import importlib_metadata as metadata

__version__ = metadata.version(__name__)
13 changes: 9 additions & 4 deletions network_importer/adapters/base.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""BaseAdapter for the network importer."""
from diffsync import DiffSync
from diffsync.exceptions import ObjectNotFound
from network_importer.models import Site, Device, Interface, IPAddress, Cable, Vlan, Prefix


Expand Down Expand Up @@ -50,8 +51,10 @@ def get_or_create_vlan(self, vlan, site=None):
modelname = vlan.get_type()
uid = vlan.get_unique_id()

if uid in self._data[modelname]:
return self._data[modelname][uid], False
try:
return self.get(modelname, uid), False
except ObjectNotFound:
pass

self.add(vlan)
if site:
Expand All @@ -72,8 +75,10 @@ def get_or_add(self, obj):
modelname = obj.get_type()
uid = obj.get_unique_id()

if uid in self._data[modelname]:
return self._data[modelname][uid], False
try:
return self.get(modelname, uid), False
except ObjectNotFound:
pass

self.add(obj)

Expand Down
3 changes: 0 additions & 3 deletions network_importer/version.py

This file was deleted.

Loading

0 comments on commit c85d8fc

Please sign in to comment.