Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit e209b17

Browse files
committedNov 3, 2020
Rebase
1 parent 986fe8b commit e209b17

File tree

6 files changed

+65
-0
lines changed

6 files changed

+65
-0
lines changed
 

‎netbox_onboarding/models.py

+14
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@
1515
from django.dispatch import receiver
1616
from django.db import models
1717
from django.urls import reverse
18+
<<<<<<< HEAD
1819
from dcim.models import Device
20+
=======
21+
>>>>>>> 83ada44... NetBox 2.9 support
1922
from .choices import OnboardingStatusChoices, OnboardingFailChoices
2023
from .release import NETBOX_RELEASE_CURRENT, NETBOX_RELEASE_29
2124

@@ -57,6 +60,14 @@ class OnboardingTask(ChangeLoggedModel):
5760
help_text="Timeout period in sec to wait while connecting to the device", default=30
5861
)
5962

63+
<<<<<<< HEAD
64+
=======
65+
created_on = models.DateTimeField(auto_now_add=True)
66+
67+
class Meta: # noqa: D106 "missing docstring in public nested class"
68+
ordering = ["created_on"]
69+
70+
>>>>>>> 83ada44... NetBox 2.9 support
6071
def __str__(self):
6172
"""String representation of an OnboardingTask."""
6273
return f"{self.site} : {self.ip_address}"
@@ -69,6 +80,7 @@ def get_absolute_url(self):
6980
from utilities.querysets import RestrictedQuerySet # pylint: disable=no-name-in-module, import-outside-toplevel
7081

7182
objects = RestrictedQuerySet.as_manager()
83+
<<<<<<< HEAD
7284

7385

7486
class OnboardingDevice(models.Model):
@@ -151,3 +163,5 @@ def init_onboarding_for_new_device(sender, instance, created, **kwargs): # pyli
151163
"""
152164
if created:
153165
OnboardingDevice.objects.create(device=instance)
166+
=======
167+
>>>>>>> 83ada44... NetBox 2.9 support

‎netbox_onboarding/netbox_keeper.py

+4
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,11 @@ def ensure_primary_ip(self):
411411
)
412412

413413
if created or not self.nb_primary_ip in self.nb_mgmt_ifname.ip_addresses.all():
414+
<<<<<<< HEAD
414415
logger.info("ASSIGN: IP address %s to %s", self.nb_primary_ip.address, self.nb_mgmt_ifname.name)
416+
=======
417+
logging.info("ASSIGN: IP address %s to %s", self.nb_primary_ip.address, self.nb_mgmt_ifname.name)
418+
>>>>>>> 83ada44... NetBox 2.9 support
415419
self.nb_mgmt_ifname.ip_addresses.add(self.nb_primary_ip)
416420
self.nb_mgmt_ifname.save()
417421

‎netbox_onboarding/tables.py

+4
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,11 @@ class Meta(BaseTable.Meta): # noqa: D106 "Missing docstring in public nested cl
3030
fields = (
3131
"pk",
3232
"id",
33+
<<<<<<< HEAD
3334
"created",
35+
=======
36+
"created_on",
37+
>>>>>>> 83ada44... NetBox 2.9 support
3438
"ip_address",
3539
"site",
3640
"platform",

‎netbox_onboarding/templates/netbox_onboarding/onboardingtask.html

+8
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,14 @@ <h1>{% block title %}Device: {{ onboardingtask.ip_address }}{% endblock %}</h1>
1818
<li role="presentation"{% if not active_tab %} class="active"{% endif %}>
1919
<a href="{{ onboardingtask.get_absolute_url }}">Onboarding Task</a>
2020
</li>
21+
<<<<<<< HEAD
2122
{% if perms.extras.view_objectchange %}
2223
<li role="presentation"{% if active_tab == 'changelog' %} class="active"{% endif %}>
2324
<a href="{% url 'plugins:netbox_onboarding:onboardingtask_changelog' pk=onboardingtask.pk %}">Change Log</a>
2425
</li>
2526
{% endif %}
27+
=======
28+
>>>>>>> 83ada44... NetBox 2.9 support
2629
</ul>
2730
{% endblock %}
2831

@@ -79,8 +82,13 @@ <h1>{% block title %}Device: {{ onboardingtask.ip_address }}{% endblock %}</h1>
7982
<td>{{ onboardingtask.message|placeholder }}</td>
8083
</tr>
8184
<tr>
85+
<<<<<<< HEAD
8286
<td>Created</td>
8387
<td>{{ onboardingtask.created|placeholder }}</td>
88+
=======
89+
<td>Created On</td>
90+
<td>{{ onboardingtask.created_on|placeholder }}</td>
91+
>>>>>>> 83ada44... NetBox 2.9 support
8492
</tr>
8593
</table>
8694
</div>

‎netbox_onboarding/urls.py

+3
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,13 @@
2929
path("add/", OnboardingTaskCreateView.as_view(), name="onboardingtask_add"),
3030
path("delete/", OnboardingTaskBulkDeleteView.as_view(), name="onboardingtask_bulk_delete"),
3131
path("import/", OnboardingTaskFeedBulkImportView.as_view(), name="onboardingtask_import"),
32+
<<<<<<< HEAD
3233
path(
3334
"<int:pk>/changelog/",
3435
ObjectChangeLogView.as_view(),
3536
name="onboardingtask_changelog",
3637
kwargs={"model": OnboardingTask},
3738
),
39+
=======
40+
>>>>>>> 83ada44... NetBox 2.9 support
3841
]

‎netbox_onboarding/views.py

+32
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,38 @@ class ReleaseMixinOnboardingTaskFeedBulkImportView(PermissionRequiredMixin):
5757
permission_required = "netbox_onboarding.add_onboardingtask"
5858

5959

60+
<<<<<<< HEAD
61+
=======
62+
if NETBOX_RELEASE_CURRENT < NETBOX_RELEASE_29:
63+
from django.contrib.auth.mixins import PermissionRequiredMixin # pylint: disable=ungrouped-imports
64+
65+
class ReleaseMixinOnboardingTaskView(PermissionRequiredMixin, View):
66+
"""Release Mixin View for presenting a single OnboardingTask."""
67+
68+
permission_required = "netbox_onboarding.view_onboardingtask"
69+
70+
class ReleaseMixinOnboardingTaskListView(PermissionRequiredMixin):
71+
"""Release Mixin View for listing all extant OnboardingTasks."""
72+
73+
permission_required = "netbox_onboarding.view_onboardingtask"
74+
75+
class ReleaseMixinOnboardingTaskCreateView(PermissionRequiredMixin):
76+
"""Release Mixin View for creating a new OnboardingTask."""
77+
78+
permission_required = "netbox_onboarding.add_onboardingtask"
79+
80+
class ReleaseMixinOnboardingTaskBulkDeleteView(PermissionRequiredMixin):
81+
"""Release Mixin View for deleting one or more OnboardingTasks."""
82+
83+
permission_required = "netbox_onboarding.delete_onboardingtask"
84+
85+
class ReleaseMixinOnboardingTaskFeedBulkImportView(PermissionRequiredMixin):
86+
"""Release Mixin View for bulk-importing a CSV file to create OnboardingTasks."""
87+
88+
permission_required = "netbox_onboarding.add_onboardingtask"
89+
90+
91+
>>>>>>> 83ada44... NetBox 2.9 support
6092
else:
6193
from utilities.views import ObjectView # pylint: disable=ungrouped-imports, no-name-in-module
6294

0 commit comments

Comments
 (0)
Please sign in to comment.