diff options
author | Lars Wirzenius <lars.wirzenius@codethink.co.uk> | 2013-06-20 12:49:28 +0000 |
---|---|---|
committer | Tiago Gomes <tiago.gomes@codethink.co.uk> | 2013-06-15 15:21:13 +0000 |
commit | d4e8c5d4efe2a12627fcde05cbe05686b6f87e37 (patch) | |
tree | 0f79733dc44188c615d94862118cb73bca5594cd /morphlib | |
parent | e4f189dd026a0146aeaed8893e4f84515c89bd85 (diff) | |
download | morph-d4e8c5d4efe2a12627fcde05cbe05686b6f87e37.tar.gz |
Fix warnings and test suite
Diffstat (limited to 'morphlib')
-rw-r--r-- | morphlib/builder2.py | 4 | ||||
-rw-r--r-- | morphlib/morphologyfactory.py | 24 | ||||
-rw-r--r-- | morphlib/morphologyfactory_tests.py | 6 |
3 files changed, 14 insertions, 20 deletions
diff --git a/morphlib/builder2.py b/morphlib/builder2.py index abde72ce..452bbe36 100644 --- a/morphlib/builder2.py +++ b/morphlib/builder2.py @@ -529,10 +529,6 @@ class SystemBuilder(BuilderBase): # pragma: no cover self.kwargs = kwargs def build_and_cache(self): - system_kind = self.artifact.source.morphology['system-kind'] - if system_kind != 'rootfs-tarball': - raise morphlib.Error( - 'System kind %s not support (only rootfs-tarball is)') self.app.status(msg='Building system %(system_name)s', system_name=self.artifact.source.morphology['name']) diff --git a/morphlib/morphologyfactory.py b/morphlib/morphologyfactory.py index 5b68f1a8..7f5cd94a 100644 --- a/morphlib/morphologyfactory.py +++ b/morphlib/morphologyfactory.py @@ -116,20 +116,18 @@ class MorphologyFactory(object): 'supports the following architectures: %s' % (morphology['arch'], ', '.join(valid_archs))) - if not morphology['system-kind']: - raise morphlib.Error('No system-kind defined in system %s ' - '(it is a mandatory field)' % filename) - - if morphology['system-kind'] != 'rootfs-tarball': + kind = morphology['system-kind'] + if kind == 'rootfs-tarball': # pragma: no cover 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']) + msg='WARNING: Obsolete field system-kind used in morphology ' + '(it is harmless, but should be removed)') + elif kind: + raise morphlib.Error( + 'System kind %s is not supported (anymore), ' + 'the whole system-kind field is deprecated. ' + 'Please remove system-kind from your system ' + 'morphologies and morph deploy to create ' + 'the desired output format.' % kind) name = morphology['name'] morphology.builds_artifacts = [name + '-rootfs'] diff --git a/morphlib/morphologyfactory_tests.py b/morphlib/morphologyfactory_tests.py index dd454a30..b1a6a621 100644 --- a/morphlib/morphologyfactory_tests.py +++ b/morphlib/morphologyfactory_tests.py @@ -74,7 +74,7 @@ class FakeLocalRepo(object): def __init__(self): self.arch = 'x86_64' - self.system_kind = 'unknown' + self.system_kind = '' def cat(self, sha1, filename): if filename in self.morphologies: @@ -252,8 +252,8 @@ class MorphologyFactoryTests(unittest.TestCase): morph = self.mf.get_morphology('reponame', 'sha1', 'system.morph') self.assertEqual(morph['arch'], 'armv7l') - def test_fails_if_system_does_not_define_system_kind(self): - self.lr.system_kind = '' + def test_fails_if_system_define_system_kind_that_is_not_tarball(self): + self.lr.system_kind = 'blahblah' self.assertRaises(morphlib.Error, self.mf.get_morphology, 'reponame', 'sha1', 'system.morph') |