Ejemplo n.º 1
0
def _check_and_clear_default_organization(organization):
    if organization is not None:
        from azext_devops.dev.common.config import azdevops_config
        from azext_devops.dev.common.const import DEFAULTS_SECTION, DEVOPS_ORGANIZATION_DEFAULT
        from .configure import configure
        current_org_default = None
        if azdevops_config.has_option(DEFAULTS_SECTION,
                                      DEVOPS_ORGANIZATION_DEFAULT):
            current_org_default = azdevops_config.get(
                DEFAULTS_SECTION, DEVOPS_ORGANIZATION_DEFAULT)
        if current_org_default == organization:
            configure(defaults=["organization=''"])
            logger.debug("Resetting default organization.")
        else:
            logger.debug(
                "Default org not reset. Different organization is set as default."
            )
Ejemplo n.º 2
0
def _check_and_set_default_organization(organization):
    if organization is not None:
        from azext_devops.dev.common.config import azdevops_config
        from azext_devops.dev.common.const import DEFAULTS_SECTION, DEVOPS_ORGANIZATION_DEFAULT
        from .configure import configure
        current_org_default = None
        if azdevops_config.has_option(DEFAULTS_SECTION,
                                      DEVOPS_ORGANIZATION_DEFAULT):
            current_org_default = azdevops_config.get(
                DEFAULTS_SECTION, DEVOPS_ORGANIZATION_DEFAULT)
        if current_org_default is None or current_org_default == '':
            configure(defaults=['organization={}'.format(organization)])
            logger.debug(
                "Setting this organization as default. No default was set earlier."
            )
        else:
            logger.debug("Another organization is already set as default.")