diff options
-rw-r--r-- | cloudinit/DataSourceEc2.py | 1 | ||||
-rw-r--r-- | cloudinit/DataSourceMaaS.py | 8 | ||||
-rw-r--r-- | cloudinit/util.py | 10 | ||||
-rw-r--r-- | tests/unittests/test_datasource/test_maas.py | 2 |
4 files changed, 8 insertions, 13 deletions
diff --git a/cloudinit/DataSourceEc2.py b/cloudinit/DataSourceEc2.py index 4e06803d..7051ecda 100644 --- a/cloudinit/DataSourceEc2.py +++ b/cloudinit/DataSourceEc2.py @@ -24,7 +24,6 @@ from cloudinit import seeddir as base_seeddir from cloudinit import log import cloudinit.util as util import socket -import urllib2 import time import boto.utils as boto_utils import os.path diff --git a/cloudinit/DataSourceMaaS.py b/cloudinit/DataSourceMaaS.py index fc4e890d..08a48443 100644 --- a/cloudinit/DataSourceMaaS.py +++ b/cloudinit/DataSourceMaaS.py @@ -26,7 +26,6 @@ import cloudinit.util as util import errno import oauth.oauth as oauth import os.path -import socket import urllib2 import time @@ -185,7 +184,7 @@ def read_maas_seed_url(seed_url, header_cb=None, timeout=None): def check_seed_contents(content, seed): - """Validate if content is Is the content a dict that is valid as a + """Validate if content is Is the content a dict that is valid as a return for a datasource. Either return a (userdata, metadata) tuple or Raise MaasSeedDirMalformed or MaasSeedDirNone @@ -201,12 +200,12 @@ def check_seed_contents(content, seed): raise MaasSeedDirMalformed("%s: missing files %s" % (seed, missing)) userdata = content['user-data'] - md = { } + md = {} for (key, val) in content.iteritems(): if key == 'user-data': continue md[key] = val - + return(userdata, md) @@ -260,4 +259,3 @@ if __name__ == "__main__": pprint.pprint(metadata) main() - diff --git a/cloudinit/util.py b/cloudinit/util.py index 897f0a0d..35d194ba 100644 --- a/cloudinit/util.py +++ b/cloudinit/util.py @@ -752,6 +752,7 @@ def mount_callback_umount(device, callback, data=None): return(ret) + def wait_for_url(urls, max_wait=None, timeout=None, status_cb=None, headers_cb=None): """ @@ -826,10 +827,9 @@ def wait_for_url(urls, max_wait=None, timeout=None, except Exception as e: reason = "unexpected error [%s]" % e - if log: - status_cb("'%s' failed [%s/%ss]: %s" % - (url, int(time.time() - starttime), max_wait, - reason)) + status_cb("'%s' failed [%s/%ss]: %s" % + (url, int(time.time() - starttime), max_wait, + reason)) if timeup(max_wait, starttime): break @@ -838,5 +838,3 @@ def wait_for_url(urls, max_wait=None, timeout=None, time.sleep(sleeptime) return False - - diff --git a/tests/unittests/test_datasource/test_maas.py b/tests/unittests/test_datasource/test_maas.py index dc8964d3..4f896add 100644 --- a/tests/unittests/test_datasource/test_maas.py +++ b/tests/unittests/test_datasource/test_maas.py @@ -39,7 +39,7 @@ class TestMaasDataSource(TestCase): # verify that 'userdata' is not returned as part of the metadata self.assertFalse(('user-data' in metadata)) - + def test_seed_dir_valid_extra(self): """Verify extra files do not affect seed_dir validity """ |