Skip to content

Commit

Permalink
Fixes Azure#4953: Updating getSiteCredentials to get the correct cred…
Browse files Browse the repository at this point in the history
…entials (Azure#5015)

* Fixes Azure#4953: Updating getSiteCredentials to get the correct credentials
for a slot

* FW:updating to use generic_site_operation instead of if -else block

* FW: updating signature to not use client object & updating the caller

* updating version & updating history

* Fixing history

* Removing unneeded variable

* Remove unneeded client variable

* Updating to pass slot to the siteCredentials
  • Loading branch information
panchagnula authored and tjprescott committed Jan 9, 2018
1 parent 7c8615f commit 429a793
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
1 change: 1 addition & 0 deletions src/command_modules/azure-cli-appservice/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Release History
0.1.24
++++++
* `webapp config ssl upload`: fix a bug where the hosting_environment_profile was null
* `webapp log tail`: fixing a bug where support for slots was not working

0.1.23
++++++
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1219,8 +1219,7 @@ def get_streaming_log(cmd, resource_group_name, name, provider=None, slot=None):
if provider:
streaming_url += ('/' + provider.lstrip('/'))

client = web_client_factory(cmd.cli_ctx)
user, password = _get_site_credential(client, resource_group_name, name)
user, password = _get_site_credential(resource_group_name, name, slot)
t = threading.Thread(target=_get_log, args=(streaming_url, user, password))
t.daemon = True
t.start()
Expand All @@ -1232,14 +1231,13 @@ def get_streaming_log(cmd, resource_group_name, name, provider=None, slot=None):
def download_historical_logs(cmd, resource_group_name, name, log_file=None, slot=None):
scm_url = _get_scm_url(cmd, resource_group_name, name, slot)
url = scm_url.rstrip('/') + '/dump'
client = web_client_factory(cmd.cli_ctx)
user_name, password = _get_site_credential(client, resource_group_name, name)
user_name, password = _get_site_credential(resource_group_name, name, slot)
_get_log(url, user_name, password, log_file)
logger.warning('Downloaded logs to %s', log_file)


def _get_site_credential(client, resource_group_name, name):
creds = client.web_apps.list_publishing_credentials(resource_group_name, name)
def _get_site_credential(resource_group_name, name, slot=None):
creds = _generic_site_operation(resource_group_name, name, 'list_publishing_credentials', slot)
creds = creds.result()
return (creds.publishing_user_name, creds.publishing_password)

Expand Down Expand Up @@ -1603,10 +1601,9 @@ def list_locations(cmd, sku, linux_workers_enabled=None):
return client.list_geo_regions(full_sku, linux_workers_enabled)


def enable_zip_deploy(cmd, resource_group_name, name, src, slot=None):
client = web_client_factory(cmd.cli_ctx)
user_name, password = _get_site_credential(client, resource_group_name, name)
scm_url = _get_scm_url(cmd, resource_group_name, name, slot)
def enable_zip_deploy(resource_group_name, name, src, slot=None):
user_name, password = _get_site_credential(resource_group_name, name, slot)
scm_url = _get_scm_url(resource_group_name, name, slot)
zip_url = scm_url + '/api/zipdeploy'

import urllib3
Expand Down

0 comments on commit 429a793

Please sign in to comment.