File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed
Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -341,6 +341,15 @@ end = struct
341341 in
342342 let fingerprint_sha256 = pp_fingerprint ~hash_type:`SHA256 certificate in
343343 let fingerprint_sha1 = pp_fingerprint ~hash_type:`SHA1 certificate in
344+ let expr =
345+ let open Xapi_database.Db_filter_types in
346+ let type' = Record_util.certificate_type_to_string _type in
347+ let type' = Eq (Field "type", Literal type') in
348+ let fingerprint_sha256 = Eq (Field "type", Literal fingerprint_sha256) in
349+ And (type', fingerprint_sha256)
350+ in
351+ if Db.Certificate.get_refs_where ~__context ~expr <> [] then
352+ raise_server_error [name] certificate_already_exists ;
344353 let uuid = Uuidx.(to_string (make ())) in
345354 let ref' = Ref.make () in
346355 Db.Certificate.create ~__context ~ref:ref' ~uuid ~host ~not_before
You can’t perform that action at this time.
0 commit comments