summaryrefslogtreecommitdiff
path: root/morphlib
diff options
context:
space:
mode:
Diffstat (limited to 'morphlib')
-rw-r--r--morphlib/bins_tests.py5
-rw-r--r--morphlib/morph2_tests.py2
-rw-r--r--morphlib/morphologyfactory.py11
-rw-r--r--morphlib/morphologyfactory_tests.py8
4 files changed, 22 insertions, 4 deletions
diff --git a/morphlib/bins_tests.py b/morphlib/bins_tests.py
index d7ed1656..edefb092 100644
--- a/morphlib/bins_tests.py
+++ b/morphlib/bins_tests.py
@@ -137,8 +137,9 @@ class ChunkTests(BinsTest):
def test_does_not_compress_artifact(self):
self.create_chunk(['bin'])
- with gzip.open(self.chunk_file) as f:
- self.assertRaises(IOError, f.read)
+ f = gzip.open(self.chunk_file)
+ self.assertRaises(IOError, f.read)
+ f.close()
class ExtractTests(unittest.TestCase):
diff --git a/morphlib/morph2_tests.py b/morphlib/morph2_tests.py
index 49be9c8c..1a0b4822 100644
--- a/morphlib/morph2_tests.py
+++ b/morphlib/morph2_tests.py
@@ -309,7 +309,7 @@ class MorphologyTests(unittest.TestCase):
"kind": "system",
"disk-size": "1g",
"arch": "x86_64",
- "system-kind": "syslinux-disk"
+ "system-kind": "rootfs-tarball"
}'''
def test_writing_preserves_disk_size(self):
diff --git a/morphlib/morphologyfactory.py b/morphlib/morphologyfactory.py
index 7ae68697..54ad6364 100644
--- a/morphlib/morphologyfactory.py
+++ b/morphlib/morphologyfactory.py
@@ -110,6 +110,17 @@ class MorphologyFactory(object):
raise morphlib.Error('No system-kind defined in system %s '
'(it is a mandatory field)' % filename)
+ if morphology['system-kind'] != 'rootfs-tarball':
+ self._app.status(
+ msg='You are using a system-kind %(kind)s. '
+ 'This is deprecated and untested functionality that will '
+ 'be removed in a future version of Baserock. The only '
+ 'supported system-kind is rootfs-tarball. '
+ 'Please convert your system morphologies to '
+ 'rootfs-tarball and use morph deploy to create '
+ 'disk images.',
+ kind=morphology['system-kind'])
+
name = morphology['name']
morphology.builds_artifacts = [name + '-rootfs']
diff --git a/morphlib/morphologyfactory_tests.py b/morphlib/morphologyfactory_tests.py
index 30cfb8fb..798e2e22 100644
--- a/morphlib/morphologyfactory_tests.py
+++ b/morphlib/morphologyfactory_tests.py
@@ -106,13 +106,19 @@ class FakeLocalRepoCache(object):
return self.lr
+class FakeApp(object):
+
+ def status(self, **kwargs):
+ pass
+
+
class MorphologyFactoryTests(unittest.TestCase):
def setUp(self):
self.lr = FakeLocalRepo()
self.lrc = FakeLocalRepoCache(self.lr)
self.rrc = FakeRemoteRepoCache()
- self.mf = MorphologyFactory(self.lrc, self.rrc)
+ self.mf = MorphologyFactory(self.lrc, self.rrc, app=FakeApp())
self.lmf = MorphologyFactory(self.lrc, None)
def nolocalfile(self, *args):