From cea01e037a1e9f2e6ec3006fb1b3c24119e427ab Mon Sep 17 00:00:00 2001 From: weisdd <46579601+weisdd@users.noreply.github.com> Date: Mon, 11 May 2020 16:14:25 +0300 Subject: [PATCH] Fix: incorrect DeviceConnectionsReport in reports.md (#4606) Since the CONNECTION_STATUS_PLANNED constant is gone from dcim.constants, the DeviceConnectionsReport script is no longer correct. The suggested fix is based on the fact that console_port.connection_status and power_port.connection_status currently have the following set of values: * None = A cable is not connected to a Console Server Port or it's connected to a Rear/Front Port; * False = A cable is connected to a Console Server Port and marked as Planned; * True = A cable is connected to a Console Server Port and marked as Installed. --- docs/additional-features/reports.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/docs/additional-features/reports.md b/docs/additional-features/reports.md index 6deddc140..e845117c0 100644 --- a/docs/additional-features/reports.md +++ b/docs/additional-features/reports.md @@ -33,7 +33,6 @@ Within each report class, we'll create a number of test methods to execute our r ``` from dcim.choices import DeviceStatusChoices -from dcim.constants import CONNECTION_STATUS_PLANNED from dcim.models import ConsolePort, Device, PowerPort from extras.reports import Report @@ -51,7 +50,7 @@ class DeviceConnectionsReport(Report): console_port.device, "No console connection defined for {}".format(console_port.name) ) - elif console_port.connection_status == CONNECTION_STATUS_PLANNED: + elif not console_port.connection_status: self.log_warning( console_port.device, "Console connection for {} marked as planned".format(console_port.name) @@ -67,7 +66,7 @@ class DeviceConnectionsReport(Report): for power_port in PowerPort.objects.filter(device=device): if power_port.connected_endpoint is not None: connected_ports += 1 - if power_port.connection_status == CONNECTION_STATUS_PLANNED: + if not power_port.connection_status: self.log_warning( device, "Power connection for {} marked as planned".format(power_port.name)