Skip to content

Commit

Permalink
rgw: lifcycle: don't reject compound rules with empty prefix
Browse files Browse the repository at this point in the history
A rule containing a tag filter but no constraining prefix is
legal, as is a sequence of >1 such rules.

Signed-off-by: Matt Benjamin <[email protected]>
  • Loading branch information
mattbenjamin committed Jan 15, 2019
1 parent fad75f1 commit fdc1c25
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/rgw/rgw_lc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,14 @@ bool RGWLifecycleConfiguration::_add_rule(LCRule *rule)
if (rule->get_filter().has_tags()){
op.obj_tags = rule->get_filter().get_tags();
}
auto ret = prefix_map.emplace(std::move(prefix), std::move(op));
return ret.second;

/* prefix is optional, update prefix map only if prefix...exists */
if (!prefix.empty()) {
auto ret = prefix_map.emplace(std::move(prefix), std::move(op));
return ret.second;
}

return true;
}

int RGWLifecycleConfiguration::check_and_add_rule(LCRule *rule)
Expand Down

0 comments on commit fdc1c25

Please sign in to comment.