If ruby-openssl detects the server's hostname is mismatched, it passes preverify_ok=false but sets the X509Store error to V_ERR_OK. See https://github.com/ruby/openssl/issues/244
This was fixed in https://github.com/ruby/openssl/commit/035a04ece237105ba3c91a8db8f81dc81d2dc452 and released in ruby-openssl 2.2.0 which has only been released in Ruby 3.0. As a result, the X509Store error is now correctly set to X509_V_ERR_HOSTNAME_MISMATCH (in openssl 1.1 and up) or X509_V_ERR_CERT_REJECTED. This causes puppet to raise a generic "CertVerifyError" exception instead of the more specific hostname mismatch error.