diff --git a/infrastructure/lib/DPB/Core.pm b/infrastructure/lib/DPB/Core.pm index 286c2006b4c..6deaa752510 100644 --- a/infrastructure/lib/DPB/Core.pm +++ b/infrastructure/lib/DPB/Core.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Core.pm,v 1.44 2013/09/18 15:30:40 espie Exp $ +# $OpenBSD: Core.pm,v 1.45 2013/09/21 08:40:09 espie Exp $ # # Copyright (c) 2010 Marc Espie # @@ -31,13 +31,14 @@ sub shell sub new { my ($class, $name, $prop) = @_; + if ($class->name_is_localhost($name)) { + $class = "DPB::Host::Localhost"; + $name = 'localhost'; + } else { + require DPB::Core::Distant; + $class = "DPB::Host::Distant"; + } if (!defined $hosts->{$name}) { - if ($class->name_is_localhost($name)) { - $class = "DPB::Host::Localhost"; - } else { - require DPB::Core::Distant; - $class = "DPB::Host::Distant"; - } my $h = bless {host => $name, prop => DPB::HostProperties->finalize($prop) }, $class; # XXX have to register *before* creating the shell diff --git a/infrastructure/lib/DPB/Core/Init.pm b/infrastructure/lib/DPB/Core/Init.pm index 71454cfa6b7..d15534ab4eb 100644 --- a/infrastructure/lib/DPB/Core/Init.pm +++ b/infrastructure/lib/DPB/Core/Init.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Init.pm,v 1.2 2013/09/08 11:10:59 espie Exp $ +# $OpenBSD: Init.pm,v 1.3 2013/09/21 08:40:09 espie Exp $ # # Copyright (c) 2010 Marc Espie # @@ -81,11 +81,9 @@ sub new { my ($class, $host, $prop) = @_; if (DPB::Host->name_is_localhost($host)) { - return $init->{localhost} //= DPB::Core::Local->new_noreg($host, $prop); - } else { - require DPB::Core::Distant; - return $init->{$host} //= DPB::Core::Distant->new_noreg($host, $prop); + $host = 'localhost'; } + return $init->{$host} //= DPB::Core->new_noreg($host, $prop); }