@@ -629,12 +629,16 @@ def transaction(self, verbose=False):
629
629
630
630
631
631
def add_location_info (lines , dblocation , prefix = "" , use_rack_fullname = False ):
632
- # FIXME: sort out hub/region
633
- for parent_type in ["continent" , "country" , "city" , "campus" , "building" ,
634
- "bunker" ]:
632
+ for parent_type in ["hub" , "continent" , "country" , "city" , "campus" , "building" ,
633
+ "room" , "bunker" ]:
635
634
dbparent = getattr (dblocation , parent_type )
636
635
if dbparent :
637
- pan_assign (lines , prefix + "sysloc/" + parent_type , dbparent .name )
636
+ # Hub is an exception where the associated sysloc property has a different name
637
+ if parent_type == "hub" :
638
+ sysloc_property = "region"
639
+ else :
640
+ sysloc_property = parent_type
641
+ pan_assign (lines , prefix + "sysloc/" + sysloc_property , dbparent .name )
638
642
639
643
if dblocation .rack :
640
644
# If use_rack_fullname is True, use the rack_fullname instead of the generated rack name
@@ -646,5 +650,3 @@ def add_location_info(lines, dblocation, prefix="", use_rack_fullname=False):
646
650
pan_assign (lines , prefix + "rack/row" , dblocation .rack_row )
647
651
if dblocation .rack_column :
648
652
pan_assign (lines , prefix + "rack/column" , dblocation .rack_column )
649
- if dblocation .room :
650
- pan_assign (lines , prefix + "sysloc/room" , dblocation .room .name )
0 commit comments