All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH OSSTEST RFC] Osstest/Debian.pm: Use Fqdn hostprop when collecting host keys
@ 2015-05-01 13:42 Ian Campbell
  2015-05-01 13:51 ` Ian Jackson
  0 siblings, 1 reply; 5+ messages in thread
From: Ian Campbell @ 2015-05-01 13:42 UTC (permalink / raw)
  To: ian.jackson; +Cc: Ian Campbell, xen-devel

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 ... root@10.80.250.26 xl migrate debian.guest.osstest moss-bug
Host key verification failed.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
---
 Osstest/Debian.pm | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/Osstest/Debian.pm b/Osstest/Debian.pm
index 69530fb..b6c5844 100644
--- a/Osstest/Debian.pm
+++ b/Osstest/Debian.pm
@@ -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");
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH OSSTEST RFC] Osstest/Debian.pm: Use Fqdn hostprop when collecting host keys
  2015-05-01 13:42 [PATCH OSSTEST RFC] Osstest/Debian.pm: Use Fqdn hostprop when collecting host keys Ian Campbell
@ 2015-05-01 13:51 ` Ian Jackson
  2015-05-01 13:59   ` Ian Campbell
  0 siblings, 1 reply; 5+ messages in thread
From: Ian Jackson @ 2015-05-01 13:51 UTC (permalink / raw)
  To: Ian Campbell; +Cc: xen-devel

Ian Campbell writes ("[PATCH OSSTEST RFC] 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

Oops.

>      $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}";

Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>

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.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH OSSTEST RFC] Osstest/Debian.pm: Use Fqdn hostprop when collecting host keys
  2015-05-01 13:51 ` Ian Jackson
@ 2015-05-01 13:59   ` Ian Campbell
  2015-05-01 14:05     ` Ian Jackson
  0 siblings, 1 reply; 5+ messages in thread
From: Ian Campbell @ 2015-05-01 13:59 UTC (permalink / raw)
  To: Ian Jackson; +Cc: xen-devel

On Fri, 2015-05-01 at 14:51 +0100, Ian Jackson wrote:
> Ian Campbell writes ("[PATCH OSSTEST RFC] 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
> 
> Oops.
> 
> >      $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}";
> 
> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
> 
> 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.

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;

?

>   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.

> so I won't block your fixup for this.

Thanks.

Ian.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH OSSTEST RFC] Osstest/Debian.pm: Use Fqdn hostprop when collecting host keys
  2015-05-01 13:59   ` Ian Campbell
@ 2015-05-01 14:05     ` Ian Jackson
  2015-05-01 14:09       ` Ian Campbell
  0 siblings, 1 reply; 5+ messages in thread
From: Ian Jackson @ 2015-05-01 14:05 UTC (permalink / raw)
  To: Ian Campbell; +Cc: xen-devel

Ian Campbell writes ("Re: [PATCH OSSTEST RFC] Osstest/Debian.pm: Use Fqdn hostprop when collecting host keys"):
> 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;
> 
> ?

Sure.  Except you probably mean

          my $longname= $props{Fqdn} // $defaultfqdn;

> Mainly becuase here in preseed_create we lack a $ho object I think.

Indeed.

Ian.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH OSSTEST RFC] Osstest/Debian.pm: Use Fqdn hostprop when collecting host keys
  2015-05-01 14:05     ` Ian Jackson
@ 2015-05-01 14:09       ` Ian Campbell
  0 siblings, 0 replies; 5+ messages in thread
From: Ian Campbell @ 2015-05-01 14:09 UTC (permalink / raw)
  To: Ian Jackson; +Cc: xen-devel

On Fri, 2015-05-01 at 15:05 +0100, Ian Jackson wrote:
> Ian Campbell writes ("Re: [PATCH OSSTEST RFC] Osstest/Debian.pm: Use Fqdn hostprop when collecting host keys"):
> > 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;
> > 
> > ?
> 
> 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.

> 
> > Mainly becuase here in preseed_create we lack a $ho object I think.
> 
> Indeed.
> 
> Ian.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-05-01 14:09 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-01 13:42 [PATCH OSSTEST RFC] Osstest/Debian.pm: Use Fqdn hostprop when collecting host keys Ian Campbell
2015-05-01 13:51 ` Ian Jackson
2015-05-01 13:59   ` Ian Campbell
2015-05-01 14:05     ` Ian Jackson
2015-05-01 14:09       ` Ian Campbell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.