{"record":{"id":"cfa6a0f884e0ba61","repo":"theforeman/foreman","slug":"the-remote-system-presented-a-public-key-with-hash","errorCode":null,"errorMessage":"The remote system presented a public key with hash %s but we're expecting a different hash. If you are sure the remote system is authentic, go to the compute resource edit page, press the 'Test Connection' or 'Load Datacenters' button and submit","messagePattern":"The remote system presented a public key with hash (.+?) but we're expecting a different hash\\. If you are sure the remote system is authentic, go to the compute resource edit page, press the 'Test Connection' or 'Load Datacenters' button and submit","errorType":"exception","errorClass":"Foreman::FingerprintException","httpStatus":null,"severity":"error","filePath":"app/models/compute_resources/foreman/model/vmware.rb","lineNumber":796,"sourceCode":"    def update_public_key(options = {})\n      return unless pubkey_hash.blank? || options[:force]\n      client\n    rescue Foreman::FingerprintException => e\n      self.pubkey_hash = e.fingerprint\n    end\n\n    def client\n      @client ||= ::Fog::Compute.new(\n        :provider                     => \"vsphere\",\n        :vsphere_username             => user,\n        :vsphere_password             => password,\n        :vsphere_server               => server,\n        :vsphere_expected_pubkey_hash => pubkey_hash\n      )\n    rescue => e\n      case e.message\n      when /The remote system presented a public key with hash (\\w+) but we're expecting a hash of/\n        raise Foreman::FingerprintException.new(\n          N_(\"The remote system presented a public key with hash %s but we're expecting a different hash. If you are sure the remote system is authentic, go to the compute resource edit page, press the 'Test Connection' or 'Load Datacenters' button and submit\"), Regexp.last_match(1))\n      when /Cannot complete login due to an incorrect user name or password./\n        raise Foreman::UsernameOrPasswordException.new(\n          N_(\"Can not load datacenters due to an incorrect user name or password.\"))\n      else\n        raise e\n      end\n    end\n\n    def unused_vnc_port(ip)\n      10.times do\n        port   = rand(5901..5964)\n        unused = (TCPSocket.connect(ip, port).close rescue true)\n        return port if unused\n      end\n      raise \"no unused port found\"\n    end\n","sourceCodeStart":778,"sourceCodeEnd":814,"githubUrl":"https://github.com/theforeman/foreman/blob/6b05625475cfe6aac31a88f8c8ee6e62e4efe620/app/models/compute_resources/foreman/model/vmware.rb#L778-L814","documentation":"Error \"The remote system presented a public key with hash %s but we're expecting a different hash. If you are sure the remote system is authentic, go to the compute resource edit page, press the 'Test Connection' or 'Load Datacenters' button and submit\" thrown in theforeman/foreman.","triggerScenarios":"Thrown at app/models/compute_resources/foreman/model/vmware.rb:796 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"6b05625475cfe6aac31a88f8c8ee6e62e4efe620","analyzedAt":"2026-08-23T17:46:34.094Z","schemaVersion":2},"datasetVersion":"2026-08-23T21:17:23.414Z"}