summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Rajnoha <prajnoha@redhat.com>2016-08-04 16:45:27 +0200
committerPeter Rajnoha <prajnoha@redhat.com>2016-08-09 18:49:11 +0200
commite805ef2d66bc8a06481de648497ff1369965d3c3 (patch)
tree6dfb976a95ecaa49c61d26475cfd529ebe3fe2b5
parentf21afddeb71c052617afb41fed9a2bd68ad532cf (diff)
downloadlvm2-e805ef2d66bc8a06481de648497ff1369965d3c3.tar.gz
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.
-rw-r--r--tools/lvmcmdline.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c
index 81118c115..cb41534ba 100644
--- a/tools/lvmcmdline.c
+++ b/tools/lvmcmdline.c
@@ -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;
}