<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <p><br>
    </p>
    <br>
    <div class="moz-cite-prefix">On 07.07.2016 08:09, Oleg Fayans wrote:<br>
    </div>
    <blockquote cite="mid:577DF223.5010302@redhat.com" type="cite">Updated
      version of the patch is attached with the failing tests marked as
      xfailed (let's make the jenkins green).
      <br>
      <br>
      On 07/04/2016 10:50 PM, Oleg Fayans wrote:
      <br>
      <blockquote type="cite">2 out of 7 tests currently fail due to a
        known issue [1], others pass.
        <br>
        <br>
        [1] <a class="moz-txt-link-freetext" href="https://fedorahosted.org/freeipa/ticket/6029">https://fedorahosted.org/freeipa/ticket/6029</a>
        <br>
        <br>
        <br>
        <br>
        <br>
      </blockquote>
      <br>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
    </blockquote>
    This is wrong:<br>
    <br>
    1)<br>
    you are not getting SSHFP records, just SSH public key (with your
    changes)<br>
    <br>
    2)<br>
    you are using host-find without any arguments, so it will returns
    SSH key for all hosts, the code before was getting SSHFP only for
    one host. Would be better to use host-show?<br>
    <br>
    3) <br>
    you actually found a bug, because host-find and host-show should
    print only SSH fingerprints not SSH keys<br>
    <a class="moz-txt-link-freetext" href="https://fedorahosted.org/freeipa/ticket/6042">https://fedorahosted.org/freeipa/ticket/6042</a><br>
    <a class="moz-txt-link-freetext" href="https://fedorahosted.org/freeipa/ticket/6043">https://fedorahosted.org/freeipa/ticket/6043</a><br>
    <br>
    4)<br>
    don't call it SSHFP records in code, because it is not DNS related,
    probably you want to get SSH fingerprints instead of SSH keys<br>
    <br>
    5)<br>
    It may contain multiple SSH keys, you always return only the first
    (the original code returns all values)<br>
    <br>
        def get_sshfp_record(self):<br>
    -        sshfp_record = ''<br>
    -        client_host = self.clients[0].hostname.split('.')[0]<br>
    -<br>
             result = self.master.run_command(<br>
    -            ['ipa', 'dnsrecord-show', self.master.domain.name,
    client_host]<br>
    +            ['ipa', 'host-find']<br>
             )<br>
    -<br>
    -        lines = result.stdout_text.splitlines()<br>
    -        for line in lines:<br>
    -            if 'SSHFP record:' in line:<br>
    -                sshfp_record = line.replace('SSHFP record:',
    '').strip()<br>
    -<br>
    -        assert sshfp_record, 'SSHFP record not found'<br>
    -<br>
    -        sshfp_record = set(sshfp_record.split(', '))<br>
    -        self.log.debug("SSHFP record for host %s: %s", client_host,
    str(sshfp_record))<br>
    -<br>
    -        return sshfp_record<br>
    +        records = result.stdout_text.split('\n\n')<br>
    +        sshkey_re = re.compile('.+SSH public key: ssh-\w+
    (\S+?),.+')<br>
    +        for hostrecord in records:<br>
    +            if self.clients[0].hostname in hostrecord:<br>
    +                sshfps = sshkey_re.findall(hostrecord)<br>
    +                assert sshfps, 'SSHFP record not found'<br>
    +                sshfp = sshfps[0]<br>
    +        return sshfp<br>
  </body>
</html>