diff --git a/lib/activate/dev_manager.c b/lib/activate/dev_manager.c index 7054656c9..d07e04aea 100644 --- a/lib/activate/dev_manager.c +++ b/lib/activate/dev_manager.c @@ -1560,7 +1560,7 @@ static int _thin_pool_callback(struct dm_tree_node *node, const struct dm_config_node *cn; const struct dm_config_value *cv; const char *thin_check = - find_config_tree_str_allow_empty(data->pool_lv->vg->cmd, global_thin_check_executable_CFG); + find_config_tree_str_allow_empty(data->pool_lv->vg->cmd, global_thin_check_executable_CFG, NULL); const struct logical_volume *mlv = first_seg(data->pool_lv)->metadata_lv; size_t len = strlen(dmdir) + 2 * (strlen(mlv->vg->name) + strlen(mlv->name)) + 3; char meta_path[len]; diff --git a/lib/commands/toolcontext.c b/lib/commands/toolcontext.c index c593f5e6b..f5b8d4854 100644 --- a/lib/commands/toolcontext.c +++ b/lib/commands/toolcontext.c @@ -202,7 +202,7 @@ static void _init_logging(struct cmd_context *cmd) init_indent(find_config_tree_bool(cmd, log_indent_CFG)); init_abort_on_internal_errors(find_config_tree_bool(cmd, global_abort_on_internal_errors_CFG)); - cmd->default_settings.msg_prefix = find_config_tree_str_allow_empty(cmd, log_prefix_CFG); + cmd->default_settings.msg_prefix = find_config_tree_str_allow_empty(cmd, log_prefix_CFG, NULL); init_msg_prefix(cmd->default_settings.msg_prefix); cmd->default_settings.cmd_name = find_config_tree_bool(cmd, log_command_names_CFG); diff --git a/lib/config/config.c b/lib/config/config.c index 52674245c..15761534e 100644 --- a/lib/config/config.c +++ b/lib/config/config.c @@ -821,17 +821,27 @@ const char *find_config_tree_str(struct cmd_context *cmd, int id, struct profile return str; } -const char *find_config_tree_str_allow_empty(struct cmd_context *cmd, int id) +const char *find_config_tree_str_allow_empty(struct cmd_context *cmd, int id, struct profile *profile) { cfg_def_item_t *item = cfg_def_get_item_p(id); const char *path = cfg_def_get_path(item); + int profile_applied = 0; + const char *str; if (item->type != CFG_TYPE_STRING) log_error(INTERNAL_ERROR "%s cfg tree element not declared as string.", path); if (!(item->flags & CFG_ALLOW_EMPTY)) log_error(INTERNAL_ERROR "%s cfg tree element not declared to allow empty values.", path); - return dm_config_tree_find_str_allow_empty(cmd->cft, path, cfg_def_get_default_value(item, CFG_TYPE_STRING)); + if (profile && !cmd->profile_params->global_profile) + profile_applied = override_config_tree_from_profile(cmd, profile); + + str = dm_config_tree_find_str_allow_empty(cmd->cft, path, cfg_def_get_default_value(item, CFG_TYPE_STRING)); + + if (profile_applied) + remove_config_tree_by_source(cmd, CONFIG_PROFILE); + + return str; } int find_config_tree_int(struct cmd_context *cmd, int id) diff --git a/lib/config/config.h b/lib/config/config.h index 6c6089edf..56ed4ea30 100644 --- a/lib/config/config.h +++ b/lib/config/config.h @@ -166,7 +166,7 @@ int merge_config_tree(struct cmd_context *cmd, struct dm_config_tree *cft, */ const struct dm_config_node *find_config_tree_node(struct cmd_context *cmd, int id, struct profile *profile); const char *find_config_tree_str(struct cmd_context *cmd, int id, struct profile *profile); -const char *find_config_tree_str_allow_empty(struct cmd_context *cmd, int id); +const char *find_config_tree_str_allow_empty(struct cmd_context *cmd, int id, struct profile *profile); int find_config_tree_int(struct cmd_context *cmd, int id); int64_t find_config_tree_int64(struct cmd_context *cmd, int id); float find_config_tree_float(struct cmd_context *cmd, int id);