-
Notifications
You must be signed in to change notification settings - Fork 3.3k
{Core} Fix random_config_dir when AZURE_CONFIG_DIR is set
#28673
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
️✔️AzureCLI-FullTest
|
️✔️AzureCLI-BreakingChangeTest
|
|
Core |
513d591 to
bd388c6
Compare
Co-authored-by: Jiashuo Li <[email protected]>
| super(DummyCli, self).__init__( | ||
| cli_name='az', | ||
| config_dir=config_dir, | ||
| config_dir=GLOBAL_CONFIG_DIR, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is what it looks like before #25689. As we are already overriding GLOBAL_CONFIG_DIR with environment variable AZURE_CONFIG_DIR, setting config_dir is unnecessary.
| if random_config_dir: | ||
| config_dir = os.path.join(GLOBAL_CONFIG_DIR, 'dummy_cli_config_dir', random_string()) | ||
| # Knack prioritizes the AZURE_CONFIG_DIR env over the config_dir param, and other functions may call | ||
| # get_config_dir directly. We need to set the env to make sure the config_dir is used. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self.config_dir = os.environ.get('{}CONFIG_DIR'.format(env_var_prefix), default_config_dir)
Resolve #28668
Knack ignores the
config_dirparam whenAZURE_CONFIG_DIRenv is set, and other functions may callget_config_dirdirectly.So this PR patches
AZURE_CONFIG_DIRenv whenrandom_config_dir=trueduring test