From c6d504edbb7d3ff808a20bcc2c87046106f1c84a Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 17 Jun 2015 13:49:18 +0200 Subject: [PATCH] Handle SSH hosts without a @ --- src/lib/Hydra/View/TT.pm | 12 +++++++++++- src/root/machine-status.tt | 4 ++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/lib/Hydra/View/TT.pm b/src/lib/Hydra/View/TT.pm index 2f9d4201..be3cf493 100644 --- a/src/lib/Hydra/View/TT.pm +++ b/src/lib/Hydra/View/TT.pm @@ -9,7 +9,7 @@ __PACKAGE__->config( ENCODING => 'utf-8', PRE_CHOMP => 1, POST_CHOMP => 1, - expose_methods => [qw/buildLogExists buildStepLogExists jobExists/]); + expose_methods => [qw/buildLogExists buildStepLogExists jobExists stripSSHUser/]); sub buildLogExists { my ($self, $c, $build) = @_; @@ -23,6 +23,16 @@ sub buildStepLogExists { return defined findLog($c, $step->drvpath, @outPaths); } + +sub stripSSHUser { + my ($self, $c, $name) = @_; + if ($name =~ /^.*@(.*)$/) { + return $1; + } else { + return $name; + } +} + # Check whether the given job is a member of the most recent jobset # evaluation. sub jobExists { diff --git a/src/root/machine-status.tt b/src/root/machine-status.tt index a1331378..5847c970 100644 --- a/src/root/machine-status.tt +++ b/src/root/machine-status.tt @@ -13,7 +13,7 @@ [% FOREACH m IN machines %] - [% name = m.key ? m.key.match('@(.*)').0 : "localhost" %] + [% name = m.key ? stripSSHUser(m.key) : "localhost" %] @@ -27,7 +27,7 @@ [% idle = 1 %] [% FOREACH step IN steps %] - [% name2 = step.machine ? step.machine.match('@(.*)').0 : "localhost" %] + [% name2 = step.machine ? stripSSHUser(step.machine) : "localhost" %] [% IF name == name2 %] [% idle = 0 %]