Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates for Release 1.2.0 #102

Merged
merged 6 commits into from
Sep 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,14 +119,14 @@ jobs:
strategy:
fail-fast: true
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10"]
python-version: ["3.8", "3.9", "3.10"]
db-backend: ["postgresql"]
nautobot-version: ["stable"]
include:
- python-version: "3.10"
db-backend: "postgresql"
nautobot-version: "1.4.10"
- python-version: "3.7"
- python-version: "3.8"
db-backend: "mysql"
nautobot-version: "1.5.5"
- python-version: "3.10"
Expand Down
10 changes: 0 additions & 10 deletions docs/admin/release_notes/version_1.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,6 @@ nautobot-device-onboarding now covers onboarding of Cisco Nexus and Arista EOS d

Celery has been introduced to eventually replace RQ for executing background tasks within Nautobot. Plugin's usage of RQ has been migrated to use Celery.

## v1.1.3 (2023-07-26)

### Added

### Changed
- [#53](https://github.com/nautobot/nautobot-plugin-device-onboarding/pull/53) - Documentation updates
- [#87](https://github.com/nautobot/nautobot-plugin-device-onboarding/pull/87) - Add OnboardingTask status and failure reason metrics

### Fixed
- [#75](https://github.com/nautobot/nautobot-plugin-device-onboarding/pull/75) - Fix reverse migration for migrations 0002, 0003

## v1.1.2 (2022-08-01)

Expand Down
18 changes: 18 additions & 0 deletions docs/admin/release_notes/version_1.2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# v1.2 Release Notes

This document describes all new features and changes in `nautobot-device-onboarding` plugin 1.2.


## Release Overview

## v1.2.0 (2023-08-1x)

### Added

### Changed
- [#53](https://github.com/nautobot/nautobot-plugin-device-onboarding/pull/53) - Documentation updates
- [#87](https://github.com/nautobot/nautobot-plugin-device-onboarding/pull/87) - Add OnboardingTask status and failure reason metrics
-

### Fixed
- [#75](https://github.com/nautobot/nautobot-plugin-device-onboarding/pull/75) - Fix reverse migration for migrations 0002, 0003
3 changes: 2 additions & 1 deletion nautobot_device_onboarding/filters.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Filtering logic for OnboardingTask instances."""
# pylint: disable=unsupported-binary-operation

import django_filters
from django.db.models import Q
Expand Down Expand Up @@ -47,7 +48,7 @@ class Meta: # noqa: D106 "Missing docstring in public nested class"
model = OnboardingTask
fields = ["id", "site", "site_id", "platform", "role", "status", "failed_reason"]

def search(self, queryset, name, value): # pylint: disable=unused-argument, no-self-use
def search(self, queryset, name, value): # pylint: disable=unused-argument
"""Perform the filtered search."""
if not value.strip():
return queryset
Expand Down
1 change: 0 additions & 1 deletion nautobot_device_onboarding/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@


class Migration(migrations.Migration):

initial = True

dependencies = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ def create_missing_onboardingdevice(apps, schema_editor):


class Migration(migrations.Migration):

dependencies = [
("nautobot_device_onboarding", "0001_initial"),
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ def create_labels_for_existing_tasks(apps, schema_editor):


class Migration(migrations.Migration):

dependencies = [
("nautobot_device_onboarding", "0002_create_onboardingdevice"),
]
Expand Down
34 changes: 17 additions & 17 deletions nautobot_device_onboarding/nautobot_keeper.py
Original file line number Diff line number Diff line change
Expand Up @@ -375,15 +375,15 @@ def ensure_device_instance(self, default_status=PLUGIN_SETTINGS["default_device_
)
lookup_args = {
"pk": self.onboarded_device.pk,
"defaults": dict(
name=self.netdev_hostname,
device_type=self.nb_device_type,
device_role=self.nb_device_role,
platform=self.nb_platform,
site=self.nb_site,
serial=self.netdev_serial_number,
"defaults": {
"name": self.netdev_hostname,
"device_type": self.nb_device_type,
"device_role": self.nb_device_role,
"platform": self.nb_platform,
"site": self.nb_site,
"serial": self.netdev_serial_number,
# status= field is not updated in case of already existing devices to prevent changes
),
},
}
else:
# Construct lookup arguments if onboarded device does not exist in Nautobot
Expand All @@ -403,15 +403,15 @@ def ensure_device_instance(self, default_status=PLUGIN_SETTINGS["default_device_

lookup_args = {
"name": self.netdev_hostname,
"defaults": dict(
device_type=self.nb_device_type,
device_role=self.nb_device_role,
platform=self.nb_platform,
site=self.nb_site,
serial=self.netdev_serial_number,
"defaults": {
"device_type": self.nb_device_type,
"device_role": self.nb_device_role,
"platform": self.nb_platform,
"site": self.nb_site,
"serial": self.netdev_serial_number,
# `status` field is defined only for new devices, no update for existing should occur
status=device_status,
),
"status": device_status,
},
}

try:
Expand All @@ -433,7 +433,7 @@ def ensure_interface(self):
"""Ensures that the interface associated with the mgmt_ipaddr exists and is assigned to the device."""
if self.netdev_mgmt_ifname:
self.nb_mgmt_ifname, _ = Interface.objects.get_or_create(
name=self.netdev_mgmt_ifname, device=self.device, defaults=dict(type=InterfaceTypeChoices.TYPE_OTHER)
name=self.netdev_mgmt_ifname, device=self.device, defaults={"type": InterfaceTypeChoices.TYPE_OTHER}
)
ensure_default_cf(obj=self.nb_mgmt_ifname, model=Interface)

Expand Down
9 changes: 3 additions & 6 deletions nautobot_device_onboarding/netdev_keeper.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,12 +167,9 @@ def guess_netmiko_device_type(self):
logger.error("ERROR: %s", str(err))
raise OnboardException(reason="fail-general", message=f"ERROR: {str(err)}") from err

else:
if guessed_device_type is None:
logger.error("ERROR: Could not detect device type with SSHDetect")
raise OnboardException(
reason="fail-general", message="ERROR: Could not detect device type with SSHDetect"
)
if guessed_device_type is None:
logger.error("ERROR: Could not detect device type with SSHDetect")
raise OnboardException(reason="fail-general", message="ERROR: Could not detect device type with SSHDetect")

return guessed_device_type

Expand Down
1 change: 0 additions & 1 deletion nautobot_device_onboarding/tests/test_onboarding.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""Unit tests for nautobot_device_onboarding.netdev_keeper module and its classes."""
# pylint: disable=no-self-use

from unittest import mock

Expand Down
4 changes: 2 additions & 2 deletions nautobot_device_onboarding/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def onboard_device(task_id, credentials): # pylint: disable=too-many-statements
if OnboardingDevice.objects.filter(device=onboarded_device, enabled=False):
onboarding_task.status = OnboardingStatusChoices.STATUS_SKIPPED

return dict(onboarding_task=True)
return {"onboarding_task": True}

except Device.DoesNotExist as err:
logger.info("Getting device with IP lookup failed: %s", str(err))
Expand Down Expand Up @@ -124,7 +124,7 @@ def onboard_device(task_id, credentials): # pylint: disable=too-many-statements

onboardingtask_results_counter.labels(status=onboarding_task.status).inc()

return dict(ok=onboarding_status)
return {"ok": onboarding_status}


def enqueue_onboarding_task(task_id, credentials):
Expand Down
Loading
Loading