diff --git a/lib/aquilon/worker/templates/base.py b/lib/aquilon/worker/templates/base.py index b18752306..b6e5848c1 100644 --- a/lib/aquilon/worker/templates/base.py +++ b/lib/aquilon/worker/templates/base.py @@ -629,12 +629,16 @@ def transaction(self, verbose=False): def add_location_info(lines, dblocation, prefix=""): - # FIXME: sort out hub/region - for parent_type in ["continent", "country", "city", "campus", "building", - "bunker"]: + for parent_type in ["hub", "continent", "country", "city", "campus", "building", + "room", "bunker"]: dbparent = getattr(dblocation, parent_type) if dbparent: - pan_assign(lines, prefix + "sysloc/" + parent_type, dbparent.name) + # Hub is an exception where the associated sysloc property has a different name + if parent_type == "hub": + sysloc_property = "region" + else: + sysloc_property = parent_type + pan_assign(lines, prefix + "sysloc/" + sysloc_property, dbparent.name) if dblocation.rack: pan_assign(lines, prefix + "rack/name", dblocation.rack.name) @@ -642,5 +646,3 @@ def add_location_info(lines, dblocation, prefix=""): pan_assign(lines, prefix + "rack/row", dblocation.rack_row) if dblocation.rack_column: pan_assign(lines, prefix + "rack/column", dblocation.rack_column) - if dblocation.room: - pan_assign(lines, prefix + "sysloc/room", dblocation.room.name) diff --git a/lib/aquilon/worker/templates/city.py b/lib/aquilon/worker/templates/city.py index ed97b618c..837ff3c46 100644 --- a/lib/aquilon/worker/templates/city.py +++ b/lib/aquilon/worker/templates/city.py @@ -30,7 +30,7 @@ class PlenaryCity(Plenary): @classmethod def template_name(cls, dbcity): - return "%s/%s/%s/config" % (cls.prefix, dbcity.hub.fullname.lower(), + return "%s/%s/%s/config" % (cls.prefix, dbcity.continent.name, dbcity.name) def body(self, lines): diff --git a/lib/aquilon/worker/templates/machine.py b/lib/aquilon/worker/templates/machine.py index e10955ec2..21ea2facd 100755 --- a/lib/aquilon/worker/templates/machine.py +++ b/lib/aquilon/worker/templates/machine.py @@ -40,7 +40,7 @@ class PlenaryMachineInfo(StructurePlenary): @classmethod def template_name(cls, dbmachine): loc = dbmachine.location - return "%s/%s/%s/%s/%s" % (cls.prefix, loc.hub.fullname.lower(), + return "%s/%s/%s/%s/%s" % (cls.prefix, loc.continent.name, loc.building, loc.rack, dbmachine.label) def __init__(self, dbobj, **kwargs):