Skip to content

Commit

Permalink
Regression fix for knack config file chaining functionality (#577)
Browse files Browse the repository at this point in the history
* Configure list should not show secrests
* Regression fix for knack local config functionality
  • Loading branch information
atbagga committed May 6, 2019
1 parent 8f42238 commit c2283e5
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 26 deletions.
8 changes: 2 additions & 6 deletions .azure-pipelines/templates/install-azure-cli-edge.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
steps:
# commented out for now because DevOps CLI is broken with latest Azure CLI build
# - script: 'pip install --pre azure-cli --extra-index-url https://azurecliprod.blob.core.windows.net/edge'
# displayName: 'Install Azure CLI Edge'

- script: pip install azure-cli
displayName: 'Install Azure CLI released version (in place of edge due to active bug)'
- script: 'pip install --pre azure-cli --extra-index-url https://azurecliprod.blob.core.windows.net/edge'
displayName: 'Install Azure CLI Edge'
21 changes: 2 additions & 19 deletions azure-devops/azext_devops/dev/common/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
# --------------------------------------------------------------------------------------------

import os
import stat
from six.moves import configparser

from knack.config import CLIConfig, get_config_parser
from knack.util import ensure_dir
Expand Down Expand Up @@ -39,24 +37,9 @@ def __init__(self, config_dir=AZ_DEVOPS_GLOBAL_CONFIG_DIR, config_env_var_prefix
azdevops_config.config_parser.read(AZ_DEVOPS_GLOBAL_CONFIG_PATH)


def set_global_config(config):
ensure_dir(AZ_DEVOPS_GLOBAL_CONFIG_DIR)
with open(AZ_DEVOPS_GLOBAL_CONFIG_PATH, 'w') as configfile:
config.write(configfile)
os.chmod(AZ_DEVOPS_GLOBAL_CONFIG_PATH, stat.S_IRUSR | stat.S_IWUSR)
# reload config
azdevops_config.config_parser.read(AZ_DEVOPS_GLOBAL_CONFIG_PATH)


def set_global_config_value(section, option, value):
config = get_config_parser()
config.read(AZ_DEVOPS_GLOBAL_CONFIG_PATH)
try:
config.add_section(section)
except configparser.DuplicateSectionError:
pass
config.set(section, option, _normalize_config_value(value))
set_global_config(config)
azdevops_config.set_value(section, option, _normalize_config_value(value))
azdevops_config.config_parser.read(AZ_DEVOPS_GLOBAL_CONFIG_PATH)


def _normalize_config_value(value):
Expand Down
2 changes: 1 addition & 1 deletion azure-devops/azext_devops/dev/team/configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def print_current_configuration(file_config=None):
env_vars = [ev for ev in os.environ if ev.startswith(CLI_ENV_VARIABLE_PREFIX)]
if env_vars:
print(MSG_HEADING_ENV_VARS)
print('\n'.join(['{} = {}'.format(ev, os.environ[ev]) for ev in env_vars]))
print('\n'.join(['{}'.format(ev) for ev in env_vars]))


MSG_INTRO = '\nWelcome to the Azure DevOps CLI! This command will guide you through setting some default values.\n'
Expand Down

0 comments on commit c2283e5

Please sign in to comment.