Skip to content

Commit 3cd68cc

Browse files
committed
Adding a call to scm to warm up kudu for zipdeploy
updating index.json
1 parent 132c063 commit 3cd68cc

File tree

4 files changed

+33
-9
lines changed

4 files changed

+33
-9
lines changed

src/index.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -370,9 +370,9 @@
370370
],
371371
"webapp": [
372372
{
373-
"filename": "webapp-0.0.6-py2.py3-none-any.whl",
374-
"sha256Digest": "65ffc1f0c34bb4b7b3fa0e3d3b3c49b745d8b46d04c2653ae0e0a22d01329669",
375-
"downloadUrl": "https://github.com/panchagnula/azure-cli-extensions/raw/sisirap-extensions-whl/dist/webapp-0.0.6-py2.py3-none-any.whl",
373+
"filename": "webapp-0.0.7-py2.py3-none-any.whl",
374+
"sha256Digest": "a80346e84390a17dde170efa7ad09934b0c3079ba377aa16e68f74423b24592b",
375+
"downloadUrl": "https://github.com/panchagnula/azure-cli-extensions/raw/sisirap-extensions-whl/dist/webapp-0.0.7-py2.py3-none-any.whl",
376376
"metadata": {
377377
"classifiers": [
378378
"Development Status :: 4 - Beta",
@@ -409,7 +409,7 @@
409409
"metadata_version": "2.0",
410410
"name": "webapp",
411411
"summary": "An Azure CLI Extension to manage appservice resources",
412-
"version": "0.0.6"
412+
"version": "0.0.7"
413413
}
414414
}
415415
]

src/webapp/azext_webapp/create_util.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,3 +83,11 @@ def check_if_asp_exists(cmd, rg_name, asp_name):
8383
if item.name == asp_name:
8484
return True
8585
return False
86+
87+
88+
def check_app_exists(cmd, rg_name, app_name):
89+
client = web_client_factory(cmd.cli_ctx)
90+
for item in list(client.web_apps.list_by_resource_group(rg_name)):
91+
if item.name == app_name:
92+
return True
93+
return False

src/webapp/azext_webapp/custom.py

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
enable_zip_deploy,
1313
create_webapp,
1414
update_app_settings,
15+
_get_site_credential,
16+
_get_scm_url,
1517
_get_sku_name)
1618

1719
from .create_util import (
@@ -22,6 +24,7 @@
2224
check_resource_group_exists,
2325
check_resource_group_supports_linux,
2426
check_if_asp_exists,
27+
check_app_exists,
2528
web_client_factory
2629
)
2730

@@ -126,16 +129,29 @@ def create_deploy_webapp(cmd, name, location=None, dryrun=False):
126129
logger.warning("App service plan '%s' already exists.", asp)
127130

128131
# create the Linux app
129-
logger.warning("Creating app '%s' ....", name)
130-
create_webapp(cmd, rg_name, name, asp, runtime_version)
131-
logger.warning("Webapp creation complete")
132+
if not check_app_exists(cmd, rg_name, name):
133+
logger.warning("Creating app '%s' ....", name)
134+
create_webapp(cmd, rg_name, name, asp, runtime_version)
135+
logger.warning("Webapp creation complete")
136+
else:
137+
logger.warning("App '%s' already exists", name)
132138

133139
# setting to build after deployment
134140
logger.warning("Updating app settings to enable build after deployment")
135141
update_app_settings(cmd, rg_name, name, ["SCM_DO_BUILD_DURING_DEPLOYMENT=true"])
142+
# work around until the timeout limits issue for linux is investigated & fixed
143+
# wakeup kudu, by making an SCM call
144+
145+
import requests
146+
# work around until the timeout limits issue for linux is investigated & fixed
147+
user_name, password = _get_site_credential(cmd.cli_ctx, rg_name, name)
148+
scm_url = _get_scm_url(cmd, rg_name, name)
149+
import urllib3
150+
authorization = urllib3.util.make_headers(basic_auth='{0}:{1}'.format(user_name, password))
151+
requests.get(scm_url + '/api/settings', headers=authorization)
136152

137-
# zip contents & deploy
138153
logger.warning("Creating zip with contents of dir %s ...", src_dir)
154+
# zip contents & deploy
139155
zip_file_path = zip_contents_from_dir(src_dir)
140156

141157
logger.warning("Deploying and building contents to app."

src/webapp/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from codecs import open
99
from setuptools import setup, find_packages
1010

11-
VERSION = "0.0.6"
11+
VERSION = "0.0.7"
1212

1313
CLASSIFIERS = [
1414
'Development Status :: 4 - Beta',

0 commit comments

Comments
 (0)