Although this code path is not used for creating entities yet, it is
better to fix the bug sooner than later. Method
AuthMonitor::_update_or_create_entity() must exit (with appropriate
error code) when entity to be created on the Ceph cluster is already
present.
Signed-off-by: Rishabh Dave <ridave@redhat.com>
KeyServerData::Incremental auth_inc;
auth_inc.name = entity;
+ // if entity to be created is already present.
+ if (create_entity &&
+ mon.key_server.get_auth(auth_inc.name, auth_inc.auth)) {
+ ss << "entity already exists" << auth_inc.name;
+ return -EEXIST;
+ }
+
+ // if entity to be updated is absent.
if (!create_entity &&
!mon.key_server.get_auth(auth_inc.name, auth_inc.auth)) {
ss << "couldn't find entry " << auth_inc.name;