diff options
author | Ryan Harper <ryan.harper@canonical.com> | 2018-09-05 14:17:16 +0000 |
---|---|---|
committer | Server Team CI Bot <josh.powers+server-team-bot@canonical.com> | 2018-09-05 14:17:16 +0000 |
commit | db50bc0d999e3a90136864a774f85e4e15b144e8 (patch) | |
tree | c0233ddee1fdec72c19500217ae001fa41d9a051 /cloudinit/tests | |
parent | 3f6d0972d83c8bfd6a5e666d73cb84a8cfe9c8b6 (diff) | |
download | vyos-cloud-init-db50bc0d999e3a90136864a774f85e4e15b144e8.tar.gz vyos-cloud-init-db50bc0d999e3a90136864a774f85e4e15b144e8.zip |
sysconfig: refactor sysconfig to accept distro specific templates paths
Multiple distros use sysconfig format but have different content
and paths to certain files. Update distros to specify these
template paths in their renderer_configs dictionary.
Diffstat (limited to 'cloudinit/tests')
-rw-r--r-- | cloudinit/tests/helpers.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/cloudinit/tests/helpers.py b/cloudinit/tests/helpers.py index de24e25d..9a21426e 100644 --- a/cloudinit/tests/helpers.py +++ b/cloudinit/tests/helpers.py @@ -16,9 +16,9 @@ import six import unittest2 try: - from contextlib import ExitStack + from contextlib import ExitStack, contextmanager except ImportError: - from contextlib2 import ExitStack + from contextlib2 import ExitStack, contextmanager try: from configparser import ConfigParser @@ -326,6 +326,13 @@ class FilesystemMockingTestCase(ResourceUsingTestCase): self.patchOS(root) return root + @contextmanager + def reRooted(self, root=None): + try: + yield self.reRoot(root) + finally: + self.patched_funcs.close() + class HttprettyTestCase(CiTestCase): # necessary as http_proxy gets in the way of httpretty |