@@ -1170,9 +1170,9 @@ sub power_state ($$;$) {
#---------- 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>
@@ -1199,7 +1199,7 @@ sub selecthost ($;$) {
$r{$ident}= $name;
} else {
$name= $r{$ident};
- if (!defined $name) {
+ if (!defined $name and !$prospective) {
return undef if $none_ok;
die "no specified $ident";
}
@@ -1220,6 +1220,8 @@ sub selecthost ($;$) {
$ho->{OS} = target_var($ho, "os") // "debian";
}
+ return $ho if $prospective;
+
#----- handle hosts which are themselves guests (nested) -----
if ($name =~ s/^(.*)://) {