Skip to content

Commit

Permalink
Merge branch 'acquisition-pip' into acquisition-pip-updates-explicit
Browse files Browse the repository at this point in the history
# Conflicts:
#	setup.py
#	src/command_modules/azure-cli-component/azure/cli/command_modules/component/__init__.py
  • Loading branch information
derekbekoe committed Apr 6, 2016
2 parents 28b3449 + 06b4bbb commit b2c75fd
Show file tree
Hide file tree
Showing 21 changed files with 650 additions and 188 deletions.
2 changes: 2 additions & 0 deletions azure-cli.pyproj
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
<Compile Include="azure\cli\main.py" />
<Compile Include="azure\cli\tests\command_specs\test_spec_network.py" />
<Compile Include="azure\cli\tests\command_specs\test_spec_resource.py" />
<Compile Include="azure\cli\tests\command_specs\test_spec_storage_account.py" />
<Compile Include="azure\cli\tests\command_specs\test_spec_vm.py" />
<Compile Include="azure\cli\tests\command_specs\__init__.py" />
<Compile Include="azure\cli\parser.py" />
Expand All @@ -54,6 +55,7 @@
<Compile Include="azure\cli\tests\test_connection_verify.py" />
<Compile Include="azure\cli\tests\test_application.py" />
<Compile Include="azure\cli\tests\test_output.py" />
<Compile Include="azure\cli\_azure_env.py" />
<Compile Include="azure\cli\_debug.py" />
<Compile Include="azure\cli\tests\test_help.py" />
<Compile Include="azure\cli\tests\test_output.py" />
Expand Down
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ requests==2.9.1
six==1.10.0
vcrpy==1.7.4

#Same as: -e git+https://github.com/yugangw-msft/azure-activedirectory-library-for-python.git@0.2.0#egg=azure-activedirectory-library-for-python
http://40.112.211.51:8080/packages/adal-0.2.0.zip
#-e git+https://github.com/yugangw-msft/azure-activedirectory-library-for-python@v2.1#egg=azure-activedirectory-library-for-python
http://40.112.211.51:8080/packages/adal-0.2.1.zip
4 changes: 1 addition & 3 deletions scripts/command_modules/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,12 @@

from _common import get_all_command_modules, exec_command, print_summary

dev_null_file = open(os.devnull, 'w')

all_command_modules = get_all_command_modules()
print("Installing command modules.")

failed_module_names = []
for name, fullpath in all_command_modules:
success = exec_command("pip install -e "+fullpath, stdout=dev_null_file)
success = exec_command("pip install -e "+fullpath)
if not success:
failed_module_names.append(name)

Expand Down
9 changes: 5 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
]

DEPENDENCIES = [
'adal==0.2.1', #from internal index server.
'applicationinsights',
'argcomplete',
'azure==2.0.0rc1',
Expand All @@ -81,15 +82,15 @@ def _post_install(dir):
# Upgrade/update will install if it doesn't exist.
# We do this so these components are updated when the user updates the CLI.
if INSTALL_FROM_PUBLIC:
pip.main(['install', '--upgrade', 'azure-cli-components', '--disable-pip-version-check'])
check_call(['az', 'components', 'update', '-n', 'profile', '--disable-version-check'])
pip.main(['install', '--upgrade', 'azure-cli-component', '--disable-pip-version-check'])
check_call(['az', 'component', 'update', '-n', 'profile'])
else:

# use private PyPI server.
pip.main(['install', '--upgrade', 'azure-cli-components', '--extra-index-url',
pip.main(['install', '--upgrade', 'azure-cli-component', '--extra-index-url',
PRIVATE_PYPI_URL, '--trusted-host', PRIVATE_PYPI_HOST,
'--disable-pip-version-check'])
check_call(['az', 'components', 'update', '-n', 'profile', '-p', '--disable-version-check'])
check_call(['az', 'component', 'update', '-n', 'profile', '-p'])

class OnInstall(install):
def run(self):
Expand Down
43 changes: 43 additions & 0 deletions src/azure/cli/_azure_env.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
CLIENT_ID = '04b07795-8ddb-461a-bbee-02f9e1bf7b46'

ENV_DEFAULT = 'AzureCloud'
ENV_US_GOVERNMENT = 'AzureUSGovernment'
ENV_CHINA = 'AzureChinaCloud'

COMMON_TENANT = 'common'

#ported from https://github.com/Azure/azure-xplat-cli/blob/dev/lib/util/profile/environment.js
class ENDPOINT_URLS: #pylint: disable=too-few-public-methods,old-style-class,no-init
MANAGEMENT = 'management'
ACTIVE_DIRECTORY_AUTHORITY = 'active_directory_authority'

_environments = {
ENV_DEFAULT: {
ENDPOINT_URLS.MANAGEMENT: 'https://management.core.windows.net/',
ENDPOINT_URLS.ACTIVE_DIRECTORY_AUTHORITY : 'https://login.microsoftonline.com'
},
ENV_CHINA: {
ENDPOINT_URLS.MANAGEMENT: 'https://management.core.chinacloudapi.cn/',
ENDPOINT_URLS.ACTIVE_DIRECTORY_AUTHORITY: 'https://login.chinacloudapi.cn'
},
ENV_US_GOVERNMENT: {
ENDPOINT_URLS.MANAGEMENT: 'https://management.core.usgovcloudapi.net/',
ENDPOINT_URLS.ACTIVE_DIRECTORY_AUTHORITY: 'https://login.microsoftonline.com'
}
}

def get_env(env_name=None):
if env_name is None:
env_name = ENV_DEFAULT
elif env_name not in _environments:
raise ValueError
return _environments[env_name]

def get_authority_url(tenant=None, env_name=None):
env = get_env(env_name)
return env[ENDPOINT_URLS.ACTIVE_DIRECTORY_AUTHORITY] + '/' + (tenant or COMMON_TENANT)

def get_management_endpoint_url(env_name=None):
env = get_env(env_name)
return env[ENDPOINT_URLS.MANAGEMENT]

Loading

0 comments on commit b2c75fd

Please sign in to comment.