Skip to content

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

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

Closed
coloHsq opened this issue Feb 11, 2020 · 1 comment
Closed

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

coloHsq opened this issue Feb 11, 2020 · 1 comment
Assignees
Labels
status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application

Comments

@coloHsq
Copy link

coloHsq commented Feb 11, 2020

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

@hSaria
Copy link
Contributor

hSaria commented 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
         )

@jeremystretch jeremystretch added status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application labels Feb 11, 2020
@jeremystretch jeremystretch self-assigned this Feb 11, 2020
@lock lock bot locked as resolved and limited conversation to collaborators May 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application
Projects
None yet
Development

No branches or pull requests

3 participants