Skip to content

Commit cdb05c7

Browse files
authored
Merge pull request #60 from chadell/release-v1.2.0
Release v1.2.0
2 parents da6a708 + d3c95ad commit cdb05c7

File tree

17 files changed

+1443
-1221
lines changed

17 files changed

+1443
-1221
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,8 @@ jobs:
103103
strategy:
104104
fail-fast: true
105105
matrix:
106-
python-version: ["3.6", "3.7", "3.8", "3.9"]
107-
nautobot-version: ["1.0.3", "1.1.4"]
106+
python-version: ["3.7", "3.8", "3.9"]
107+
nautobot-version: ["1.2.11", "stable"]
108108
runs-on: "ubuntu-20.04"
109109
env:
110110
INVOKE_NAUTOBOT_SSOT_PYTHON_VER: "${{ matrix.python-version }}"

development/Dockerfile

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ ARG PYTHON_VER
33
ARG NAUTOBOT_VER
44
FROM ghcr.io/nautobot/nautobot-dev:${NAUTOBOT_VER}-py${PYTHON_VER}
55

6+
ARG NAUTOBOT_VER
7+
68
ENV prometheus_multiproc_dir=/prom_cache
79

810
ARG NAUTOBOT_ROOT=/opt/nautobot
@@ -19,17 +21,26 @@ RUN poetry config virtualenvs.create false \
1921
# Install Nautobot Plugin
2022
# -------------------------------------------------------------------------------------
2123

22-
WORKDIR /source
24+
WORKDIR /tmp/install
2325

2426
# Copy in only pyproject.toml/poetry.lock to help with caching this layer if no updates to dependencies
25-
COPY poetry.lock pyproject.toml /source/
27+
COPY poetry.lock pyproject.toml /tmp/install/
28+
29+
# Add the version of Nautobot to the pyproject toml for testing
30+
RUN if [ "$NAUTOBOT_VER" = "stable" ]; \
31+
then poetry add nautobot@latest; \
32+
else poetry add nautobot==$NAUTOBOT_VER; \
33+
fi
2634

2735
# --no-root declares not to install the project package since we're wanting to take advantage of caching dependency installation
2836
# and the project is copied in and installed after this step
2937
RUN poetry install --no-interaction --no-ansi --no-root
3038

3139
# Copy in the rest of the source code and install local Nautobot plugin
40+
WORKDIR /source
3241
COPY . /source
33-
RUN poetry install --no-interaction --no-ansi
42+
# Copy updated Poetry files to override the Poetry files from the project.
43+
# This will make sure that the correct Nautobot version is used.
44+
RUN cp /tmp/install/* /source/ && poetry install --no-interaction --no-ansi
3445

3546
COPY development/nautobot_config.py /opt/nautobot/nautobot_config.py

docs/changelog.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# Changelog
22

3+
## v1.2.0 - 2022-09-30
4+
5+
### Fixed
6+
7+
- [#58](https://github.com/nautobot/nautobot-plugin-ssot/pull/58) - Change `message` and `object_repr` from 200 `CharField` field, to a `TextField`
8+
9+
### Changed
10+
11+
- [#56](https://github.com/nautobot/nautobot-plugin-ssot/pull/56) - Drop Python 3.6 support
12+
313
## v1.1.2 - 2022-05-09
414

515
### Fixed

nautobot_ssot/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""Plugin declaration for nautobot_ssot."""
2-
2+
# flake8: noqa
33
try:
44
from importlib import metadata
55
except ImportError:

nautobot_ssot/filters.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from .models import Sync, SyncLogEntry
99

1010

11-
class SyncFilter(BaseFilterSet):
11+
class SyncFilterSet(BaseFilterSet):
1212
"""Filter capabilities for SyncOverview instances."""
1313

1414
class Meta:
@@ -18,7 +18,7 @@ class Meta:
1818
fields = ["dry_run", "job_result"]
1919

2020

21-
class SyncLogEntryFilter(BaseFilterSet):
21+
class SyncLogEntryFilterSet(BaseFilterSet):
2222
"""Filter capabilities for SyncLogEntry instances."""
2323

2424
q = django_filters.CharFilter(method="search", label="Search")

nautobot_ssot/jobs/base.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import traceback
55
import tracemalloc
66
from typing import Iterable
7+
from packaging.version import Version
78

89
from django.forms import HiddenInput
910
from django.templatetags.static import static
@@ -16,6 +17,7 @@
1617
from diffsync.enum import DiffSyncFlags
1718
import structlog
1819

20+
from nautobot import __version__ as nautobot_version
1921
from nautobot.extras.jobs import BaseJob, BooleanVar
2022

2123
from nautobot_ssot.choices import SyncLogEntryActionChoices
@@ -268,9 +270,12 @@ def __init__(self):
268270
# Default diffsync flags. You can overwrite them at any time.
269271
self.diffsync_flags = DiffSyncFlags.CONTINUE_ON_FAILURE | DiffSyncFlags.LOG_UNCHANGED_RECORDS
270272

271-
def as_form(self, data=None, files=None, initial=None):
273+
def as_form(self, data=None, files=None, initial=None, approval_view=False):
272274
"""Render this instance as a Django form for user inputs, including a "Dry run" field."""
273-
form = super().as_form(data=data, files=files, initial=initial)
275+
if Version(nautobot_version) < Version("1.2"):
276+
form = super().as_form(data=data, files=files, initial=initial)
277+
else:
278+
form = super().as_form(data=data, files=files, initial=initial, approval_view=approval_view)
274279
# Set the "dry_run" widget's initial value based on our Meta attribute, if any
275280
form.fields["dry_run"].initial = getattr(self.Meta, "dry_run_default", True)
276281
# Hide the "commit" widget to reduce user confusion

nautobot_ssot/jobs/examples.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
"""Sample data-source and data-target Jobs."""
2+
# Skip colon check for multiple statements on one line.
3+
# flake8: noqa: E701
4+
25
from typing import Optional, Mapping
36
from uuid import UUID
47
from django.contrib.contenttypes.models import ContentType
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Generated by Django 3.2.15 on 2022-09-27 13:52
2+
3+
from django.db import migrations, models
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
("nautobot_ssot", "0002_performance_metrics"),
10+
]
11+
12+
operations = [
13+
migrations.AlterField(
14+
model_name="synclogentry",
15+
name="message",
16+
field=models.TextField(blank=True),
17+
),
18+
migrations.AlterField(
19+
model_name="synclogentry",
20+
name="object_repr",
21+
field=models.TextField(blank=True, default="", editable=False),
22+
),
23+
]

nautobot_ssot/models.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,9 +161,9 @@ class SyncLogEntry(BaseModel):
161161
synced_object_id = models.UUIDField(blank=True, null=True)
162162
synced_object = GenericForeignKey(ct_field="synced_object_type", fk_field="synced_object_id")
163163

164-
object_repr = models.CharField(max_length=200, blank=True, default="", editable=False)
164+
object_repr = models.TextField(blank=True, default="", editable=False)
165165

166-
message = models.CharField(max_length=511, blank=True)
166+
message = models.TextField(blank=True)
167167

168168
class Meta:
169169
"""Metaclass attributes of SyncLogEntry."""

nautobot_ssot/tests/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,7 @@
11
"""Unit tests for nautobot_ssot plugin."""
2+
3+
from django.conf import settings
4+
5+
if "job_logs" in settings.DATABASES:
6+
settings.DATABASES["job_logs"] = settings.DATABASES["job_logs"].copy()
7+
settings.DATABASES["job_logs"]["TEST"] = {"MIRROR": "default"}

0 commit comments

Comments
 (0)