summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémi Duraffort <remi.duraffort@linaro.org>2014-11-20 09:53:37 (GMT)
committerRémi Duraffort <remi.duraffort@linaro.org>2014-11-20 10:09:26 (GMT)
commitdcd1531b2448dccd820708d7b9313e1894067cc2 (patch)
tree5d9a17e5af34aad7d05248fcfa46222d22e15336
parent78da3ecfcf6c216d4aa23a5407158e8b4c636cdf (diff)
downloadlava-dispatcher-dcd1531b2448dccd820708d7b9313e1894067cc2.tar.gz
lava-dispatcher-dcd1531b2448dccd820708d7b9313e1894067cc2.tar.xz
Remove duplicated code
Change-Id: I58632dc3e7242bc50d587adeb14d5fa2988d4352
-rw-r--r--lava_dispatcher/pipeline/actions/deploy/image.py2
-rw-r--r--lava_dispatcher/pipeline/actions/deploy/overlay.py62
-rw-r--r--lava_dispatcher/pipeline/test/test_job.py4
3 files changed, 3 insertions, 65 deletions
diff --git a/lava_dispatcher/pipeline/actions/deploy/image.py b/lava_dispatcher/pipeline/actions/deploy/image.py
index c09e289..bc1012d 100644
--- a/lava_dispatcher/pipeline/actions/deploy/image.py
+++ b/lava_dispatcher/pipeline/actions/deploy/image.py
@@ -30,10 +30,10 @@ from lava_dispatcher.pipeline.actions.deploy.mount import (
MountAction,
UnmountAction,
)
+from lava_dispatcher.pipeline.actions.deploy.apply_overlay import ApplyOverlayImage
from lava_dispatcher.pipeline.actions.deploy.overlay import (
CustomisationAction,
OverlayAction,
- ApplyOverlayImage,
)
diff --git a/lava_dispatcher/pipeline/actions/deploy/overlay.py b/lava_dispatcher/pipeline/actions/deploy/overlay.py
index 32cd97a..f9f2cf8 100644
--- a/lava_dispatcher/pipeline/actions/deploy/overlay.py
+++ b/lava_dispatcher/pipeline/actions/deploy/overlay.py
@@ -280,65 +280,3 @@ class CompressOverlay(Action):
os.chdir(cur_dir)
self.data[self.name]['output'] = output
return connection
-
-
-class ApplyOverlayAction(Action):
- """
- Base class for applying the overlay tarball
- Will generate errors if added to a deployment directly.
- SELinux support would need a separate class using external tar
- """
- def __init__(self):
- super(ApplyOverlayAction, self).__init__()
- # unnamed base class action
-
- def validate(self):
- super(ApplyOverlayAction, self).validate()
-
- def run(self, connection, args=None):
- raise NotImplementedError("base class")
-
-
-class ApplyOverlayImage(ApplyOverlayAction):
- """
- Applies the overlay to an image using mntdir
- * checks that the filesystem we need is actually mounted.
- """
- def __init__(self):
- super(ApplyOverlayImage, self).__init__()
- self.name = "apply-overlay-image"
- self.summary = "unpack overlay onto image"
- self.description = "unpack overlay onto image mountpoint"
-
- def run(self, connection, args=None):
- if not self.data['compress-overlay'].get('output'):
- raise RuntimeError("Unable to find the overlay")
- if not os.path.ismount(self.data['loop_mount']['mntdir']):
- raise RuntimeError("Image overlay requested to be applied but %s is not a mountpoint" %
- self.data['loop_mount']['mntdir'])
- # use tarfile module - no SELinux support here yet
- try:
- tar = tarfile.open(self.data['compress-overlay'].get('output'))
- tar.extractall(self.data['loop_mount']['mntdir'])
- tar.close()
- except tarfile.TarError as exc:
- raise RuntimeError("Unable to unpack overlay: %s" % exc)
- self._log("that might have worked.... %s" % self.data['loop_mount']['mntdir'])
- return connection
-
-
-# FIXME: needs the UBoot classes in place and code to open the initrd etc.
-class ApplyOverlayTftp(ApplyOverlayAction):
- """
- Unpacks the overlay on top of the ramdisk or rootfs
- """
- def __init__(self):
- super(ApplyOverlayTftp, self).__init__()
- self.name = "apply-overlay-tftp"
- self.summary = "apply lava overlay test files"
- self.description = "unpack the overlay into the rootfs or ramdisk"
-
- def run(self, connection, args=None):
- if not self.data['compress-overlay'].get('output'):
- raise RuntimeError("Unable to apply overlay, not output file")
- return connection
diff --git a/lava_dispatcher/pipeline/test/test_job.py b/lava_dispatcher/pipeline/test/test_job.py
index ce1eeb6..ec74cc4 100644
--- a/lava_dispatcher/pipeline/test/test_job.py
+++ b/lava_dispatcher/pipeline/test/test_job.py
@@ -27,6 +27,7 @@ from lava_dispatcher.pipeline.test.test_basic import Factory
from lava_dispatcher.pipeline.actions.deploy.download import DownloaderAction, DownloadHandler, HttpDownloadAction
from lava_dispatcher.pipeline.job import Job
from lava_dispatcher.pipeline.actions.deploy import DeployAction
+from lava_dispatcher.pipeline.actions.deploy.apply_overlay import ApplyOverlayImage
from lava_dispatcher.pipeline.actions.deploy.mount import (
MountAction,
LoopCheckAction,
@@ -37,7 +38,6 @@ from lava_dispatcher.pipeline.actions.deploy.mount import (
from lava_dispatcher.pipeline.actions.deploy.overlay import (
OverlayAction,
CustomisationAction,
- ApplyOverlayAction,
)
from lava_dispatcher.pipeline.actions.deploy.testdef import TestDefinitionAction
from lava_dispatcher.pipeline.actions.boot.kvm import BootAction
@@ -242,7 +242,7 @@ class TestKVMBasicDeploy(unittest.TestCase):
customise = action.pipeline.children[action.pipeline][3]
self.assertIsInstance(customise, CustomisationAction)
apply_overlay = action.pipeline.children[action.pipeline][5]
- self.assertIsInstance(apply_overlay, ApplyOverlayAction)
+ self.assertIsInstance(apply_overlay, ApplyOverlayImage)
overlay = action.pipeline.children[action.pipeline][4]
self.assertIsInstance(overlay, OverlayAction)
unmount = action.pipeline.children[action.pipeline][6]