From 584c978fcad2aa32a68992dbccf3801086d8c81b Mon Sep 17 00:00:00 2001 From: Michel Jouvin Date: Fri, 13 Jul 2018 10:19:08 +0200 Subject: [PATCH] Export the hub name as sysloc/region in the object plenary - Contributes to https://github.com/quattor/aquilon/issues/104 Change-Id: I061147728c376e722b1ffd67665921416e1291d8 --- lib/aquilon/worker/templates/base.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) 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)