summaryrefslogtreecommitdiff
path: root/cloudinit/url_helper.py
diff options
context:
space:
mode:
authorasakkurr <asakkurr@microsoft.com>2018-10-31 20:19:15 +0000
committerServer Team CI Bot <josh.powers+server-team-bot@canonical.com>2018-10-31 20:19:15 +0000
commit907395104bb5850d221924365102cc5ab0eca2f1 (patch)
tree0ce9d2eca6abde46bc75acb62e970ab52c751217 /cloudinit/url_helper.py
parentd74d3f0ff5c8d453f626b113f4e6065322f822fa (diff)
downloadvyos-cloud-init-907395104bb5850d221924365102cc5ab0eca2f1.tar.gz
vyos-cloud-init-907395104bb5850d221924365102cc5ab0eca2f1.zip
azure: report ready to fabric after reprovision and reduce logging
When reusing a preprovisioned VM, report ready to Azure fabric as soon as we get the reprovision data and the goal state so that we are not delayed by the cloud-init stage switch, saving 2-3 seconds. Also reduce logging when polling IMDS for reprovision data. LP: #1799594
Diffstat (limited to 'cloudinit/url_helper.py')
-rw-r--r--cloudinit/url_helper.py17
1 files changed, 11 insertions, 6 deletions
diff --git a/cloudinit/url_helper.py b/cloudinit/url_helper.py
index 8067979e..cf57dbd5 100644
--- a/cloudinit/url_helper.py
+++ b/cloudinit/url_helper.py
@@ -199,7 +199,7 @@ def _get_ssl_args(url, ssl_details):
def readurl(url, data=None, timeout=None, retries=0, sec_between=1,
headers=None, headers_cb=None, ssl_details=None,
check_status=True, allow_redirects=True, exception_cb=None,
- session=None, infinite=False):
+ session=None, infinite=False, log_req_resp=True):
url = _cleanurl(url)
req_args = {
'url': url,
@@ -256,9 +256,11 @@ def readurl(url, data=None, timeout=None, retries=0, sec_between=1,
continue
filtered_req_args[k] = v
try:
- LOG.debug("[%s/%s] open '%s' with %s configuration", i,
- "infinite" if infinite else manual_tries, url,
- filtered_req_args)
+
+ if log_req_resp:
+ LOG.debug("[%s/%s] open '%s' with %s configuration", i,
+ "infinite" if infinite else manual_tries, url,
+ filtered_req_args)
if session is None:
session = requests.Session()
@@ -294,8 +296,11 @@ def readurl(url, data=None, timeout=None, retries=0, sec_between=1,
break
if (infinite and sec_between > 0) or \
(i + 1 < manual_tries and sec_between > 0):
- LOG.debug("Please wait %s seconds while we wait to try again",
- sec_between)
+
+ if log_req_resp:
+ LOG.debug(
+ "Please wait %s seconds while we wait to try again",
+ sec_between)
time.sleep(sec_between)
if excps:
raise excps[-1]