1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-03-10 16:58:47 +03:00

lvmcmdline: profile: early profile load for lvm shell

Make it possible to also load profile for lvm shell by honouring
LVM_COMMAND_PROFILE environment variable.
This commit is contained in:
Peter Rajnoha 2016-08-04 16:45:27 +02:00
parent f21afddeb7
commit e805ef2d66

View File

@ -1395,6 +1395,7 @@ static int _prepare_profiles(struct cmd_context *cmd)
cmd->profile_params->global_metadata_profile = profile;
}
remove_config_tree_by_source(cmd, source);
if (!override_config_tree_from_profile(cmd, profile)) {
log_error(_failed_to_apply_profile_msg, source_name, name);
return 0;
@ -1420,6 +1421,8 @@ static int _prepare_profiles(struct cmd_context *cmd)
log_error(_failed_to_add_profile_msg, source_name, name);
return 0;
}
remove_config_tree_by_source(cmd, CONFIG_PROFILE_COMMAND);
if (!override_config_tree_from_profile(cmd, profile)) {
log_error(_failed_to_apply_profile_msg, source_name, name);
return 0;
@ -1438,6 +1441,7 @@ static int _prepare_profiles(struct cmd_context *cmd)
log_error(_failed_to_add_profile_msg, source_name, name);
return 0;
}
remove_config_tree_by_source(cmd, CONFIG_PROFILE_METADATA);
if (!override_config_tree_from_profile(cmd, profile)) {
log_error(_failed_to_apply_profile_msg, source_name, name);
return 0;
@ -2217,6 +2221,10 @@ int lvm2_main(int argc, char **argv)
#ifdef READLINE_SUPPORT
if (!alias && argc == 1) {
_nonroot_warning();
if (!_prepare_profiles(cmd)) {
ret = ECMD_FAILED;
goto out;
}
ret = lvm_shell(cmd, &_cmdline);
goto out;
}