File tree 1 file changed +22
-9
lines changed
1 file changed +22
-9
lines changed Original file line number Diff line number Diff line change @@ -37,15 +37,28 @@ def get_device_name(device):
37
37
38
38
39
39
def get_device_description (device ):
40
- return '{} ({}) — {} {} ({}U) {} {}' .format (
41
- device .name ,
42
- device .device_role ,
43
- device .device_type .manufacturer .name ,
44
- device .device_type .model ,
45
- floatformat (device .device_type .u_height ),
46
- device .asset_tag or '' ,
47
- device .serial or ''
48
- )
40
+ """
41
+ Return a description for a device to be rendered in the rack elevation in the following format
42
+
43
+ Name: <name>
44
+ Role: <device_role>
45
+ Device Type: <manufacturer> <model> (<u_height>)
46
+ Asset tag: <asset_tag> (if defined)
47
+ Serial: <serial> (if defined)
48
+ Description: <description> (if defined)
49
+ """
50
+ description = f'Name: { device .name } '
51
+ description += f'\n Role: { device .device_role } '
52
+ u_height = f'{ floatformat (device .device_type .u_height )} U'
53
+ description += f'\n Device Type: { device .device_type .manufacturer .name } { device .device_type .model } ({ u_height } )'
54
+ if device .asset_tag :
55
+ description += f'\n Asset tag: { device .asset_tag } '
56
+ if device .serial :
57
+ description += f'\n Serial: { device .serial } '
58
+ if device .description :
59
+ description += f'\n Description: { device .description } '
60
+
61
+ return description
49
62
50
63
51
64
class RackElevationSVG :
You can’t perform that action at this time.
0 commit comments