From: Yehuda Sadeh Date: Tue, 17 Apr 2012 23:45:19 +0000 (-0700) Subject: rgw-admin: user create is idempotent X-Git-Tag: v0.46~63 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=5a6bbd0c473e15aa7642da367e7936015d19d77a;p=ceph.git rgw-admin: user create is idempotent Signed-off-by: Yehuda Sadeh Reviewed-by: Sage Weil --- diff --git a/src/rgw/rgw_admin.cc b/src/rgw/rgw_admin.cc index b915147869d05..692f2f83fec77 100644 --- a/src/rgw/rgw_admin.cc +++ b/src/rgw/rgw_admin.cc @@ -723,8 +723,14 @@ int main(int argc, char **argv) if (opt_cmd == OPT_USER_CREATE) { if (found) { - cerr << "error: user already exists" << std::endl; - return 1; + if (info.display_name.compare(display_name) != 0 || + info.user_email.compare(user_email) != 0) { + cerr << "error: user already exists with different display_name/email" << std::endl; + return 1; + } + /* turn into OPT_USER_MODIFY */ + opt_cmd = OPT_USER_MODIFY; + user_modify_op = true; } } else if (!found) { cerr << "error reading user info, aborting" << std::endl;