PowerPort and PowerOutlet doesn't inherit Type from templates #3305

Closed
opened 2025-12-29 18:27:34 +01:00 by adam · 1 comment
Owner

Originally created by @coloHsq on GitHub (Feb 11, 2020).

Originally assigned to: @jeremystretch on GitHub.

Environment

  • Python version: 3.6.7
  • NetBox version: 2.7.4

Steps to Reproduce

  1. Create a Device template which has power ports or power outlets with a defined type (e.g. C13)
  2. Instantiate a device from the freshly created template

Expected Behavior

The devices instances should have Type defined on PowerPorts and PowerOutlets

Observed Behavior

Type data on PowerPorts and PowerOutlets is missing

Originally created by @coloHsq on GitHub (Feb 11, 2020). Originally assigned to: @jeremystretch on GitHub. ### Environment * Python version: 3.6.7 * NetBox version: 2.7.4 ### Steps to Reproduce 1. Create a Device template which has power ports or power outlets with a defined type (e.g. C13) 2. Instantiate a device from the freshly created template ### Expected Behavior The devices instances should have Type defined on PowerPorts and PowerOutlets ### Observed Behavior Type data on PowerPorts and PowerOutlets is missing
adam added the type: bugstatus: accepted labels 2025-12-29 18:27:34 +01:00
adam closed this issue 2025-12-29 18:27:35 +01:00
Author
Owner

@hSaria commented on GitHub (Feb 11, 2020):

Seems like the type wasn't being set during instantiation. Needs:

diff --git a/netbox/dcim/models/device_component_templates.py b/netbox/dcim/models/device_component_templates.py
index ab4a078c..faa42b03 100644
--- a/netbox/dcim/models/device_component_templates.py
+++ b/netbox/dcim/models/device_component_templates.py
@@ -168,6 +168,7 @@ class PowerPortTemplate(ComponentTemplateModel):
         return PowerPort(
             device=device,
             name=self.name,
+            type=self.type,
             maximum_draw=self.maximum_draw,
             allocated_draw=self.allocated_draw
         )
@@ -232,6 +233,7 @@ class PowerOutletTemplate(ComponentTemplateModel):
         return PowerOutlet(
             device=device,
             name=self.name,
+            type=self.type,
             power_port=power_port,
             feed_leg=self.feed_leg
         )
@hSaria commented on GitHub (Feb 11, 2020): Seems like the type wasn't being set during instantiation. Needs: ```diff diff --git a/netbox/dcim/models/device_component_templates.py b/netbox/dcim/models/device_component_templates.py index ab4a078c..faa42b03 100644 --- a/netbox/dcim/models/device_component_templates.py +++ b/netbox/dcim/models/device_component_templates.py @@ -168,6 +168,7 @@ class PowerPortTemplate(ComponentTemplateModel): return PowerPort( device=device, name=self.name, + type=self.type, maximum_draw=self.maximum_draw, allocated_draw=self.allocated_draw ) @@ -232,6 +233,7 @@ class PowerOutletTemplate(ComponentTemplateModel): return PowerOutlet( device=device, name=self.name, + type=self.type, power_port=power_port, feed_leg=self.feed_leg ) ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#3305