summaryrefslogtreecommitdiff
path: root/cloudinit/sources/DataSourceAzure.py
diff options
context:
space:
mode:
authorChad Smith <chad.smith@canonical.com>2017-12-01 10:04:25 -0700
committerChad Smith <chad.smith@canonical.com>2017-12-01 10:04:25 -0700
commit9824cecf6d644093c5083ab2d550a58d18d207b0 (patch)
tree2a944c65afc7379211ffa6ce0b2f0841bded4c5a /cloudinit/sources/DataSourceAzure.py
parentd4dfa39f8c2d6e386303cbe6abb9bb1f804cae5f (diff)
parent7acc9e68fafbbd7c56587aebe752ba6ba8c8a3db (diff)
downloadvyos-cloud-init-9824cecf6d644093c5083ab2d550a58d18d207b0.tar.gz
vyos-cloud-init-9824cecf6d644093c5083ab2d550a58d18d207b0.zip
merge from master at 17.1-46-g7acc9e68
Diffstat (limited to 'cloudinit/sources/DataSourceAzure.py')
-rw-r--r--cloudinit/sources/DataSourceAzure.py29
1 files changed, 3 insertions, 26 deletions
diff --git a/cloudinit/sources/DataSourceAzure.py b/cloudinit/sources/DataSourceAzure.py
index 8c3492d9..14367e9c 100644
--- a/cloudinit/sources/DataSourceAzure.py
+++ b/cloudinit/sources/DataSourceAzure.py
@@ -11,7 +11,6 @@ from functools import partial
import os
import os.path
import re
-import time
from xml.dom import minidom
import xml.etree.ElementTree as ET
@@ -321,7 +320,7 @@ class DataSourceAzure(sources.DataSource):
# https://bugs.launchpad.net/cloud-init/+bug/1717611
missing = util.log_time(logfunc=LOG.debug,
msg="waiting for SSH public key files",
- func=wait_for_files,
+ func=util.wait_for_files,
args=(fp_files, 900))
if len(missing):
@@ -556,8 +555,8 @@ def address_ephemeral_resize(devpath=RESOURCE_DISK_PATH, maxwait=120,
is_new_instance=False):
# wait for ephemeral disk to come up
naplen = .2
- missing = wait_for_files([devpath], maxwait=maxwait, naplen=naplen,
- log_pre="Azure ephemeral disk: ")
+ missing = util.wait_for_files([devpath], maxwait=maxwait, naplen=naplen,
+ log_pre="Azure ephemeral disk: ")
if missing:
LOG.warning("ephemeral device '%s' did not appear after %d seconds.",
@@ -639,28 +638,6 @@ def pubkeys_from_crt_files(flist):
return pubkeys
-def wait_for_files(flist, maxwait, naplen=.5, log_pre=""):
- need = set(flist)
- waited = 0
- while True:
- need -= set([f for f in need if os.path.exists(f)])
- if len(need) == 0:
- LOG.debug("%sAll files appeared after %s seconds: %s",
- log_pre, waited, flist)
- return []
- if waited == 0:
- LOG.info("%sWaiting up to %s seconds for the following files: %s",
- log_pre, maxwait, flist)
- if waited + naplen > maxwait:
- break
- time.sleep(naplen)
- waited += naplen
-
- LOG.warning("%sStill missing files after %s seconds: %s",
- log_pre, maxwait, need)
- return need
-
-
def write_files(datadir, files, dirmode=None):
def _redact_password(cnt, fname):