summaryrefslogtreecommitdiffstats
path: root/src/tools
diff options
context:
space:
mode:
authorsongweibin <song.weibin@zte.com.cn>2018-11-19 12:23:51 +0100
committersongweibin <song.weibin@zte.com.cn>2018-11-19 12:27:39 +0100
commit93ab2d4959941118fc6dcc63739be85ce7fbd4df (patch)
tree02fba8e1817b5b9b65b4692e3ea400f1210580e6 /src/tools
parentMerge pull request #24789 from Ranjitha-G/dashboard-test-erasure (diff)
downloadceph-93ab2d4959941118fc6dcc63739be85ce7fbd4df.tar.xz
ceph-93ab2d4959941118fc6dcc63739be85ce7fbd4df.zip
rbd: fix error parse arg when getting config key
Signed-off-by: songweibin <song.weibin@zte.com.cn>
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/rbd/action/Config.cc31
1 files changed, 20 insertions, 11 deletions
diff --git a/src/tools/rbd/action/Config.cc b/src/tools/rbd/action/Config.cc
index 0f1932d3bfc..40093172ff8 100644
--- a/src/tools/rbd/action/Config.cc
+++ b/src/tools/rbd/action/Config.cc
@@ -71,11 +71,14 @@ int get_pool(const po::variables_map &vm, std::string *pool_name) {
return 0;
}
-int get_key(const po::variables_map &vm, std::string *key) {
- *key = utils::get_positional_argument(vm, 1);
+int get_key(const po::variables_map &vm, size_t *arg_index,
+ std::string *key) {
+ *key = utils::get_positional_argument(vm, *arg_index);
if (key->empty()) {
std::cerr << "rbd: config key was not specified" << std::endl;
return -EINVAL;
+ } else {
+ ++(*arg_index);
}
if (!boost::starts_with(*key, "rbd_")) {
@@ -203,7 +206,8 @@ int execute_global_get(const po::variables_map &vm,
}
std::string key;
- r = get_key(vm, &key);
+ size_t arg_index = 1;
+ r = get_key(vm, &arg_index, &key);
if (r < 0) {
return r;
}
@@ -248,7 +252,8 @@ int execute_global_set(const po::variables_map &vm,
}
std::string key;
- r = get_key(vm, &key);
+ size_t arg_index = 1;
+ r = get_key(vm, &arg_index, &key);
if (r < 0) {
return r;
}
@@ -294,7 +299,8 @@ int execute_global_remove(
}
std::string key;
- r = get_key(vm, &key);
+ size_t arg_index = 1;
+ r = get_key(vm, &arg_index, &key);
if (r < 0) {
return r;
}
@@ -406,7 +412,8 @@ int execute_pool_get(const po::variables_map &vm,
}
std::string key;
- r = get_key(vm, &key);
+ size_t arg_index = 1;
+ r = get_key(vm, &arg_index, &key);
if (r < 0) {
return r;
}
@@ -453,7 +460,8 @@ int execute_pool_set(const po::variables_map &vm,
}
std::string key;
- r = get_key(vm, &key);
+ size_t arg_index = 1;
+ r = get_key(vm, &arg_index, &key);
if (r < 0) {
return r;
}
@@ -493,7 +501,8 @@ int execute_pool_remove(const po::variables_map &vm,
}
std::string key;
- r = get_key(vm, &key);
+ size_t arg_index = 1;
+ r = get_key(vm, &arg_index, &key);
if (r < 0) {
return r;
}
@@ -607,7 +616,7 @@ int execute_image_get(const po::variables_map &vm,
}
std::string key;
- r = get_key(vm, &key);
+ r = get_key(vm, &arg_index, &key);
if (r < 0) {
return r;
}
@@ -662,7 +671,7 @@ int execute_image_set(const po::variables_map &vm,
}
std::string key;
- r = get_key(vm, &key);
+ r = get_key(vm, &arg_index, &key);
if (r < 0) {
return r;
}
@@ -711,7 +720,7 @@ int execute_image_remove(
}
std::string key;
- r = get_key(vm, &key);
+ r = get_key(vm, &arg_index, &key);
if (r < 0) {
return r;
}