From 263bc431c750d268c14be209fb73008adff7a2bc Mon Sep 17 00:00:00 2001
From: Jorrit Schaap <schaap@astron.nl>
Date: Fri, 18 Jan 2019 14:33:57 +0000
Subject: [PATCH] SW-567: minor bug fix in hostname2stationname conversion

---
 LCS/PyCommon/lcu_utils.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/LCS/PyCommon/lcu_utils.py b/LCS/PyCommon/lcu_utils.py
index ae7c88de51d..3d78d29916e 100644
--- a/LCS/PyCommon/lcu_utils.py
+++ b/LCS/PyCommon/lcu_utils.py
@@ -79,7 +79,7 @@ def get_current_stations(station_group='today', as_host_names=True):
         station_hostnames.append(station_hostname)
 
     if as_host_names:
-        logger.info("stations in group '%s': %s", station_group, ' '.join(station_hostnames))
+        logger.info("station hostnames in group '%s': %s", station_group, ' '.join(station_hostnames))
         return station_hostnames
 
     station_names = [hostname2stationname(x) for x in station_hostnames]
@@ -98,7 +98,7 @@ def stationname2hostname(station_name):
 def hostname2stationname(station_hostname):
     '''Convert a lcu hostname to a parset-like station name , like cs001c or cs001c.control.lofar to CS001'''
     # assume a hostname is encoded as stationname in lowercase with a c appended, like cs001c for CS001
-    return station_name.split('.')[0].strip()[-1].upper()
+    return station_hostname.split('.')[0].strip()[:-1].upper()
 
 def get_stations_rcu_mode(stations=None):
     '''
-- 
GitLab