summaryrefslogtreecommitdiff
path: root/tests/unittests/helpers.py
diff options
context:
space:
mode:
authorChad Smith <chad.smith@canonical.com>2017-05-25 11:04:55 -0600
committerScott Moser <smoser@brickies.net>2017-05-31 16:43:12 -0400
commit0a448dd034883c07f85091dbfc9117de7227eb8d (patch)
treefe9610a93f165324fbf343d6748d2964e89f3ef6 /tests/unittests/helpers.py
parent00b678c61a54f176625d3f937971215faf6af2cd (diff)
downloadvyos-cloud-init-0a448dd034883c07f85091dbfc9117de7227eb8d.tar.gz
vyos-cloud-init-0a448dd034883c07f85091dbfc9117de7227eb8d.zip
ntp: Add schema definition and passive schema validation.
cloud-config files are very flexible and permissive. This adds a jsonsschema definition to the cc_ntp module and validation functions in cloudinit/config/schema which will log warnings about invalid configuration values in the ntp section. A cmdline tools/cloudconfig-schema is added which can be used in our dev environments to quickly attempt to exercise the ntp schema. It is also exposed as a main in cloudinit.config.schema. (python3 -m cloudinit.config.schema) LP: #1692916
Diffstat (limited to 'tests/unittests/helpers.py')
-rw-r--r--tests/unittests/helpers.py6
1 files changed, 1 insertions, 5 deletions
diff --git a/tests/unittests/helpers.py b/tests/unittests/helpers.py
index 9ff15993..e78abce2 100644
--- a/tests/unittests/helpers.py
+++ b/tests/unittests/helpers.py
@@ -19,10 +19,6 @@ try:
from contextlib import ExitStack
except ImportError:
from contextlib2 import ExitStack
-try:
- from cStringIO import StringIO
-except ImportError:
- from io import StringIO
from cloudinit import helpers as ch
from cloudinit import util
@@ -102,7 +98,7 @@ class CiTestCase(TestCase):
if self.with_logs:
# Create a log handler so unit tests can search expected logs.
logger = logging.getLogger()
- self.logs = StringIO()
+ self.logs = six.StringIO()
handler = logging.StreamHandler(self.logs)
self.old_handlers = logger.handlers
logger.handlers = [handler]