std::string_view account = !info.account_id.empty() ? info.account_id : info.tenant;
info.arn = string_cat_reserve(role_arn_prefix, account, ":role", info.path, info.name);
- // Creation time
- real_clock::time_point t = real_clock::now();
-
- struct timeval tv;
- real_clock::to_timeval(t, tv);
-
- char buf[30];
- struct tm result;
- gmtime_r(&tv.tv_sec, &result);
- strftime(buf,30,"%Y-%m-%dT%H:%M:%S", &result);
- sprintf(buf + strlen(buf),".%03dZ",(int)tv.tv_usec/1000);
- info.creation_date.assign(buf, strlen(buf));
+ if (info.creation_date.empty()) {
+ // Creation time
+ real_clock::time_point t = real_clock::now();
+
+ struct timeval tv;
+ real_clock::to_timeval(t, tv);
+
+ char buf[30];
+ struct tm result;
+ gmtime_r(&tv.tv_sec, &result);
+ strftime(buf,30,"%Y-%m-%dT%H:%M:%S", &result);
+ sprintf(buf + strlen(buf),".%03dZ",(int)tv.tv_usec/1000);
+ info.creation_date.assign(buf, strlen(buf));
+ }
auto& pool = store->svc()->zone->get_zone_params().roles_pool;
ret = store_info(dpp, exclusive, y);
try {
if (role_obj) {
RGWXMLDecoder::decode_xml("RoleId", role_id, role_obj, true);
+ RGWXMLDecoder::decode_xml("CreateDate", role->get_info().creation_date, role_obj);
}
} catch (RGWXMLDecoder::err& err) {
ldpp_dout(this, 5) << "ERROR: unexpected xml: RoleId" << dendl;
op_ret = -EINVAL;
return;
}
- ldpp_dout(this, 0) << "role_id decoded from master zonegroup response is" << role_id << dendl;
+ ldpp_dout(this, 0) << "role_id decoded from master zonegroup response is " << role_id << dendl;
}
op_ret = role->create(s, true, role_id, y);