{Core} Fix random_config_dir when AZURE_CONFIG_DIR is set#28673
Merged
{Core} Fix random_config_dir when AZURE_CONFIG_DIR is set#28673
random_config_dir when AZURE_CONFIG_DIR is set#28673Conversation
️✔️AzureCLI-FullTest
|
️✔️AzureCLI-BreakingChangeTest
|
Collaborator
|
Core |
513d591 to
bd388c6
Compare
jiasli
reviewed
Apr 2, 2024
Co-authored-by: Jiashuo Li <4003950+jiasli@users.noreply.github.com>
jiasli
reviewed
Apr 2, 2024
| super(DummyCli, self).__init__( | ||
| cli_name='az', | ||
| config_dir=config_dir, | ||
| config_dir=GLOBAL_CONFIG_DIR, |
Member
There was a problem hiding this comment.
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.
jiasli
approved these changes
Apr 2, 2024
bebound
commented
Apr 30, 2024
| 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. |
Contributor
Author
There was a problem hiding this comment.
self.config_dir = os.environ.get('{}CONFIG_DIR'.format(env_var_prefix), default_config_dir)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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