зеркало из https://github.com/Azure/azure-cli.git
{testsdk} Copy command index to random config dir (#28853)
This commit is contained in:
Родитель
24ea870eb9
Коммит
c605365ac7
|
@ -31,6 +31,9 @@ steps:
|
|||
if [ "${{ parameters.EnableCompactAAZ }}" == 'True' ]; then
|
||||
python $CLI_REPO_PATH/scripts/compact_aaz.py
|
||||
fi
|
||||
|
||||
# Verify installation and build command index
|
||||
az --version
|
||||
displayName: 'azdev setup'
|
||||
env:
|
||||
CLI_REPO_PATH: ${{ parameters.CLIRepoPath }}
|
||||
|
|
|
@ -32,17 +32,23 @@ class DummyCli(AzCli):
|
|||
self.env_patch = patch.dict(os.environ, {'AZURE_CONFIG_DIR': config_dir})
|
||||
self.env_patch.start()
|
||||
|
||||
# Always copy command index to avoid initializing it again
|
||||
files_to_copy = ['commandIndex.json']
|
||||
# In recording mode, copy login credentials from global config dir to the dummy config dir
|
||||
if os.getenv(ENV_VAR_TEST_LIVE, '').lower() == 'true':
|
||||
if os.path.exists(GLOBAL_CONFIG_DIR):
|
||||
ensure_dir(config_dir)
|
||||
import shutil
|
||||
for file in ['azureProfile.json', 'msal_token_cache.bin', 'clouds.config', 'msal_token_cache.json',
|
||||
'service_principal_entries.json']:
|
||||
try:
|
||||
shutil.copy(os.path.join(GLOBAL_CONFIG_DIR, file), config_dir)
|
||||
except FileNotFoundError:
|
||||
pass
|
||||
files_to_copy.extend([
|
||||
'azureProfile.json', 'clouds.config',
|
||||
'msal_token_cache.bin', 'msal_token_cache.json',
|
||||
'service_principal_entries.bin', 'service_principal_entries.json'
|
||||
])
|
||||
|
||||
ensure_dir(config_dir)
|
||||
import shutil
|
||||
for file in files_to_copy:
|
||||
try:
|
||||
shutil.copy(os.path.join(GLOBAL_CONFIG_DIR, file), config_dir)
|
||||
except FileNotFoundError:
|
||||
pass
|
||||
|
||||
super(DummyCli, self).__init__(
|
||||
cli_name='az',
|
||||
|
|
Загрузка…
Ссылка в новой задаче