return ret;
}
-static int send_to_url(const string& url, RGWAccessKey& key, req_info& info,
+static int send_to_url(const string& url, const string& access,
+ const string& secret, req_info& info,
bufferlist& in_data, JSONParser& parser)
{
+ if (access.empty() || secret.empty()) {
+ cerr << "An --access-key and --secret must be provided with --url." << std::endl;
+ return -EINVAL;
+ }
+ RGWAccessKey key;
+ key.id = access;
+ key.key = secret;
+
list<pair<string, string> > params;
RGWRESTSimpleRequest req(g_ceph_context, url, NULL, ¶ms);
if (url.empty()) {
return send_to_remote_gateway(remote, info, in_data, parser);
}
-
- if (access.empty() || secret.empty()) {
- cerr << "An --access-key and --secret must be provided with --url." << std::endl;
- return -EINVAL;
- }
- RGWAccessKey key;
- key.id = access;
- key.key = secret;
- return send_to_url(url, key, info, in_data, parser);
+ return send_to_url(url, access, secret, info, in_data, parser);
}
static int commit_period(RGWRealm& realm, RGWPeriod& period,
break;
case OPT_REALM_PULL:
{
+ if (url.empty()) {
+ cerr << "A --url must be provided." << std::endl;
+ return EINVAL;
+ }
RGWEnv env;
req_info info(g_ceph_context, &env);
info.method = "GET";
bufferlist bl;
JSONParser p;
- int ret = send_to_remote_or_url(remote, url, access_key, secret_key,
- info, bl, p);
+ int ret = send_to_url(url, access_key, secret_key, info, bl, p);
if (ret < 0) {
cerr << "request failed: " << cpp_strerror(-ret) << std::endl;
if (ret == -EACCES) {