Skip to content
This repository has been archived by the owner on Jul 24, 2021. It is now read-only.

Commit

Permalink
Merge pull request #963 from joyent/ether/v2-room-in-pxe
Browse files Browse the repository at this point in the history
add room information to pxe endpoints
  • Loading branch information
karenetheridge authored Dec 6, 2019
2 parents 1e327a8 + 44e03fe commit f14da8a
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 0 deletions.
34 changes: 34 additions & 0 deletions json-schema/response.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,7 @@ definitions:
additionalProperties: false
required:
- datacenter
- datacenter_room
- rack
properties:
datacenter:
Expand All @@ -472,6 +473,22 @@ definitions:
oneOf:
- type: 'null'
- type: string
datacenter_room:
type: object
additionalProperties: false
required:
- az
- alias
- vendor_name
properties:
az:
type: string
alias:
type: string
vendor_name:
oneOf:
- type: string
- type: 'null'
rack:
type: object
additionalProperties: false
Expand Down Expand Up @@ -538,6 +555,7 @@ definitions:
additionalProperties: false
required:
- datacenter
- datacenter_room
- rack
properties:
datacenter:
Expand All @@ -555,6 +573,22 @@ definitions:
oneOf:
- type: 'null'
- type: string
datacenter_room:
type: object
additionalProperties: false
required:
- az
- alias
- vendor_name
properties:
az:
type: string
alias:
type: string
vendor_name:
oneOf:
- type: string
- type: 'null'
rack:
type: object
additionalProperties: false
Expand Down
1 change: 1 addition & 0 deletions lib/Conch/Controller/Device.pm
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ sub get_pxe ($c) {
id => 'device.id',
'location.datacenter.name' => 'datacenter.region',
'location.datacenter.vendor_name' => 'datacenter.vendor_name',
(map +('location.datacenter_room.'.$_ => 'datacenter_room.'.$_), qw(az alias vendor_name)),
'location.rack.name' => 'rack.name',
'location.rack.rack_unit_start' => 'device_location.rack_unit_start',
# pxe = the first (sorted by name) interface that is status=up
Expand Down
1 change: 1 addition & 0 deletions lib/Conch/Controller/WorkspaceDevice.pm
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ sub get_pxe_devices ($c) {
id => 'device.id',
'location.datacenter.name' => 'datacenter.region',
'location.datacenter.vendor_name' => 'datacenter.vendor_name',
(map +('location.datacenter_room.'.$_ => 'datacenter_room.'.$_), qw(az alias vendor_name)),
'location.rack.name' => 'rack.name',
'location.rack.rack_unit_start' => 'device_location.rack_unit_start',
# pxe = the first (sorted by name) interface that is status=up
Expand Down
2 changes: 2 additions & 0 deletions t/integration/crud/devices.t
Original file line number Diff line number Diff line change
Expand Up @@ -589,6 +589,7 @@ subtest 'Device PXE' => sub {

$layout->create_related('device_location', { device_id => 'PXE_TEST' });
my $datacenter = $t->load_fixture('datacenter_0');
my $datacenter_room = $layout->rack->datacenter_room;

$t->get_ok('/device/PXE_TEST/pxe')
->status_is(200)
Expand All @@ -600,6 +601,7 @@ subtest 'Device PXE' => sub {
name => $datacenter->region,
vendor_name => $datacenter->vendor_name,
},
datacenter_room => { map +($_ => $datacenter_room->$_), qw(az alias vendor_name) },
rack => {
name => $layout->rack->name,
rack_unit_start => $layout->rack_unit_start,
Expand Down
2 changes: 2 additions & 0 deletions t/integration/crud/workspace-devices.t
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ subtest 'Devices with PXE data' => sub {
name => $datacenter->region,
vendor_name => $datacenter->vendor_name,
},
datacenter_room => { map +($_ => $layouts[0]->rack->datacenter_room->$_), qw(az alias vendor_name) },
rack => {
name => $layouts[0]->rack->name,
rack_unit_start => $layouts[0]->rack_unit_start,
Expand All @@ -265,6 +266,7 @@ subtest 'Devices with PXE data' => sub {
name => $datacenter->region,
vendor_name => $datacenter->vendor_name,
},
datacenter_room => { map +($_ => $layouts[1]->rack->datacenter_room->$_), qw(az alias vendor_name) },
rack => {
name => $layouts[1]->rack->name,
rack_unit_start => $layouts[1]->rack_unit_start,
Expand Down

0 comments on commit f14da8a

Please sign in to comment.