The "ceph config dump" command without the json formatted output shows
the localized option names and their values. An example of a normalized
vs localized option is shown below:
Normalized: mgr/dashboard/ssl_server_port (maintaned within Option struct)
Localized: mgr/dashboard/x/ssl_server_port (maintained in mon store)
But the "ceph config dump --format json*" output showed the normalized
option names which was not consistent with the "config dump" output.
The output of the command along with variations for pretty printing must
show the same content.
This commit introduces a new member within the ConfigMap's MaskedOption
struct called "localized_name". This is initialized to the localized name
as part of ConfigMonitor::load_config() method.
The MaskedOption::dump() used for the json formatting is modified to
display the localized_name instead of the normalized name.
Fixes: https://tracker.ceph.com/issues/62379
Signed-off-by: Sridhar Seshasayee <sseshasa@redhat.com>
(cherry picked from commit
3821722e5660437298a7c0f41e1061d363090103)
void MaskedOption::dump(Formatter *f) const
{
- f->dump_string("name", opt->name);
+ f->dump_string("name", localized_name);
f->dump_string("value", raw_value);
f->dump_string("level", Option::level_to_str(opt->level));
f->dump_bool("can_update_at_runtime", opt->can_update_at_runtime());
ostream& operator<<(ostream& out, const MaskedOption& o)
{
- out << o.opt->name;
+ out << o.localized_name;
if (o.mask.location_type.size()) {
out << "@" << o.mask.location_type << '=' << o.mask.location_value;
}
const Option *opt; ///< the option
OptionMask mask;
std::unique_ptr<const Option> unknown_opt; ///< if fabricated for an unknown option
+ std::string localized_name; ///< localized name for the option
MaskedOption(const Option *o, bool fab=false) : opt(o) {
if (fab) {
opt = o.opt;
mask = std::move(o.mask);
unknown_opt = std::move(o.unknown_opt);
+ localized_name = std::move(o.localized_name);
}
const MaskedOption& operator=(const MaskedOption& o) = delete;
const MaskedOption& operator=(MaskedOption&& o) = delete;
MaskedOption mopt(opt);
mopt.raw_value = value;
+ mopt.localized_name = name;
string section_name;
if (who.size() &&
!ConfigMap::parse_mask(who, §ion_name, &mopt.mask)) {