if --storage-class is omitted, avoid dereferencing an empty optional
Fixes: https://tracker.ceph.com/issues/55548
Signed-off-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit
91931a38ce280132e270c80822f3f3b2cc0a3bf9)
Conflicts:
- path: src/rgw/rgw_admin.cc
comment: resolve minor conflict
else if (opt_cmd == OPT::USER_SUSPEND)
user_op.set_suspension(true);
- if (!placement_id.empty() ||
- (opt_storage_class && !opt_storage_class->empty())) {
+ if (!placement_id.empty()) {
rgw_placement_rule target_rule;
target_rule.name = placement_id;
- target_rule.storage_class = *opt_storage_class;
+ target_rule.storage_class = opt_storage_class.value_or("");
if (!store->get_zone()->get_params().valid_placement(target_rule)) {
cerr << "NOTICE: invalid dest placement: " << target_rule.to_str() << std::endl;
return EINVAL;