If one passes a trueish value for $prospective, selecthost does not
worry about whether any host has actually been selected. It does a
limited amount of prep work.
This will be useful if we want to know some of the non-host-specific
information selecthost computes - in particular, $ho->{Suite} etc.
No functional change with existing callers.
Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
#---------- host selection and properties ----------
-sub selecthost ($;$);
-sub selecthost ($;$) {
- my ($ident, $none_ok) = @_;
+sub selecthost ($;$$);
+sub selecthost ($;$$) {
+ my ($ident, $none_ok, $prospective) = @_;
# must be run outside transaction
# $ident is <identspec>
$r{$ident}= $name;
} else {
$name= $r{$ident};
- if (!defined $name) {
+ if (!defined $name and !$prospective) {
return undef if $none_ok;
die "no specified $ident";
}
$ho->{OS} = target_var($ho, "os") // "debian";
}
+ return $ho if $prospective;
+
#----- handle hosts which are themselves guests (nested) -----
if ($name =~ s/^(.*)://) {