mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-08 06:12:51 +00:00
move extravars and option vars loading into VM (#51070)
* move extravars and option vars loading into VM also safedir setting, all these are intrinsic to VM avoid uneeded and inefectual shallow copy remove setters/getters as VM now does most of the work in init updated and added tests * feedback + fixes * keep extra_vars property for vars_prompt * pass values not objects
This commit is contained in:
@@ -27,7 +27,6 @@ from ansible.parsing.dataloader import DataLoader
|
||||
from ansible.release import __version__
|
||||
from ansible.utils.display import Display
|
||||
from ansible.utils.path import unfrackpath
|
||||
from ansible.utils.vars import load_extra_vars, load_options_vars
|
||||
from ansible.vars.manager import VariableManager
|
||||
from ansible.parsing.vault import PromptVaultSecret, get_file_vault_secret
|
||||
|
||||
@@ -520,19 +519,7 @@ class CLI(with_metaclass(ABCMeta, object)):
|
||||
|
||||
# create the variable manager, which will be shared throughout
|
||||
# the code, ensuring a consistent view of global variables
|
||||
variable_manager = VariableManager(loader=loader, inventory=inventory)
|
||||
|
||||
# If the basedir is specified as the empty string then it results in cwd being used. This
|
||||
# is not a safe location to load vars from
|
||||
if options.get('basedir', False) is not False:
|
||||
if basedir:
|
||||
variable_manager.safe_basedir = True
|
||||
else:
|
||||
variable_manager.safe_basedir = True
|
||||
|
||||
# load vars from cli options
|
||||
variable_manager.extra_vars = load_extra_vars(loader=loader)
|
||||
variable_manager.options_vars = load_options_vars(CLI.version_info(gitinfo=False))
|
||||
variable_manager = VariableManager(loader=loader, inventory=inventory, version_info=CLI.version_info(gitinfo=False))
|
||||
|
||||
return loader, inventory, variable_manager
|
||||
|
||||
|
||||
Reference in New Issue
Block a user