Osstest/Debian.pm: Use Fqdn hostprop when collecting host keys
RFC PATCH 1/1 Osstest/Debian.pm: Use Fqdn hostprop when collecting host keys
Otherwise hosts which are not in the same DnsDomain are not processed, resulting in log messages such as:
2015-05-01 10:06:19 Z skipping host key for nonexistent host marilith-n4.xs.citrite.net 2015-05-01 10:06:20 Z skipping host key for nonexistent host lace-bug.xs.citrite.net
The practical impact of this appears to be that the pair migration tests can fail with:
2015-05-01 13:18:03 Z executing ssh ... [email protected] xl migrate debian.guest.osstest moss-bug
Host key verification failed.
--- Osstest/Debian.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
Osstest/Debian.pm +3 -1
@@ -659,7 +659,9 @@ sub preseed_create ($$;@) { END $hostsq->execute($flight); while (my ($node) = $hostsq->fetchrow_array()) { - my $longname= "$node.$c{TestHostDomain}"; + my %props; + $mhostdb->get_properties($node, \%props); + my $longname= $props{Fqdn} ? $props{Fqdn} : "$node.$c{TestHostDomain}"; my (@hostent)= gethostbyname($longname); if (!@hostent) { logm("skipping host key for nonexistent host $longname");
Signature · 1 line
2.1.4
Ian Campbell writes ("[PATCH OSSTEST RFC] Osstest/Debian.pm: Use Fqdn hostprop when collecting host keys"):
Quoted 5 lines
Otherwise hosts which are not in the same DnsDomain are not processed, resulting in log messages such as:
2015-05-01 10:06:19 Z skipping host key for nonexistent host marilith-n4.xs.citrite.net 2015-05-01 10:06:20 Z skipping host key for nonexistent host lace-bug.xs.citrite.net
Oops.
Osstest/Debian.pm sub preseed_create ($$;@) { · line 664
Quoted 6 lines
$hostsq->execute($flight); while (my ($node) = $hostsq->fetchrow_array()) {Osstest/Debian.pm +3
-1- my $longname= "$node.$c{TestHostDomain}"; + my %props; + $mhostdb->get_properties($node, \%props); + my $longname= $props{Fqdn} ? $props{Fqdn} : "$node.$c{TestHostDomain}";
Although, there is very similar logic in selecthost() (see near $defaultfqdn). The code here in preseed_create lacks the check to see whether the hostname is the fqdn to start with. Merging these two may be a bit awkward (and involve more code than just duplicating the logic), given their different environments, so I won't block your fixup for this.
Thanks,
Ian.
Quoted 16 lines · Ian Jackson
Ian Campbell writes ("[PATCH OSSTEST RFC] Osstest/Debian.pm: Use Fqdn hostprop when collecting host keys"):
Quoted 5 lines
Otherwise hosts which are not in the same DnsDomain are not processed, resulting in log messages such as:
2015-05-01 10:06:19 Z skipping host key for nonexistent host marilith-n4.xs.citrite.net 2015-05-01 10:06:20 Z skipping host key for nonexistent host lace-bug.xs.citrite.netOops.
Osstest/Debian.pm sub preseed_create ($$;@) { · line 664
Quoted 6 lines
$hostsq->execute($flight); while (my ($node) = $hostsq->fetchrow_array()) {Osstest/Debian.pm +3
-1- my $longname= "$node.$c{TestHostDomain}"; + my %props; + $mhostdb->get_properties($node, \%props); + my $longname= $props{Fqdn} ? $props{Fqdn} : "$node.$c{TestHostDomain}";
Quoted 5 lines
Acked-by Ian Jackson <[email protected]>Although, there is very similar logic in
selecthost()(see near $defaultfqdn). The code here inpreseed_createlacks the check to see whether the hostname is the fqdn to start with.
That code is:
my $defaultfqdn = $name;
$defaultfqdn .= ".$c{TestHostDomain}" unless $defaultfqdn =~ m/\./;
$ho->{Fqdn} = get_host_property($ho,'fqdn',$defaultfqdn);Perhaps for now I should write:
my $defaultfqdn = $node;
$defaultfqdn .= ".$c{TestHostDomain}" unless $defaultfqdn =~ m/\./;
my %props;
$mhostdb->get_properties($node, \%props);
my $longname= $props{Fqdn} ? $props{Fqdn} : $defaultfqdn;?
Quoted 3 lines
Merging these two may
be a bit awkward (and involve more code than just duplicating the logic), given their different environments,
Mainly becuase here in preseed_create we lack a $ho object I think.
Quoted 1 line
so I won't block your fixup for this.
Thanks.
Ian.
Ian Campbell writes ("Re: [PATCH OSSTEST RFC] Osstest/Debian.pm: Use Fqdn hostprop when collecting host keys"):
Quoted 16 lines
That code is:
my $defaultfqdn = $name; $defaultfqdn .= ".$c{TestHostDomain}" unless $defaultfqdn =~ m/\./; $ho->{Fqdn} = get_host_property($ho,'fqdn',$defaultfqdn);Perhaps for now I should write:
my $defaultfqdn = $node; $defaultfqdn .= ".$c{TestHostDomain}" unless $defaultfqdn =~ m/\./; my %props; $mhostdb->get_properties($node, \%props); my $longname= $props{Fqdn} ? $props{Fqdn} : $defaultfqdn;
Quoted 1 line
?
Sure. Except you probably mean
my $longname= $props{Fqdn} // $defaultfqdn;Quoted 1 line
Mainly becuase here in
preseed_createwe lack a $ho object I think.
Indeed.
Ian.
Quoted 15 lines · Ian Jackson
Ian Campbell writes ("Re: [PATCH OSSTEST RFC] Osstest/Debian.pm: Use Fqdn hostprop when collecting host keys"):
Quoted 14 lines
That code is:
my $defaultfqdn = $name; $defaultfqdn .= ".$c{TestHostDomain}" unless $defaultfqdn =~ m/\./; $ho->{Fqdn} = get_host_property($ho,'fqdn',$defaultfqdn);Perhaps for now I should write:
my $defaultfqdn = $node; $defaultfqdn .= ".$c{TestHostDomain}" unless $defaultfqdn =~ m/\./; my %props; $mhostdb->get_properties($node, \%props);
Quoted 7 lines
Quoted 3 lines
my $longname= $props{Fqdn} ? $props{Fqdn} : $defaultfqdn;?
Sure. Except you probably mean
my $longname= $props{Fqdn} // $defaultfqdn;
Indeed I do, thanks.
I'll push the resulting patch to the Cambridge instance production branch.
Quoted 6 lines
Quoted 2 lines
Mainly becuase here in
preseed_createwe lack a $ho object I think.Indeed.
Ian.