Commit 833112bc authored by Rémi Duraffort's avatar Rémi Duraffort
Browse files

Use the new AppendOverlays action when downloading

The overlays will be added automatically by the DownloaderAction itself.

This job definition will add the modules into the ramdisk.
```yaml
ramdisk: image_arg:  '-initrd {ramdisk}'
  url: http://example.com/rootfs.cpio.gz
  compression: gz
  format: cpio.newc
  overlays:
    modules:
      url: http://example.com/modules.tar.xz


      compression: xz
      format: tar
      path: /
```

Signed-off-by: default avatarRémi Duraffort <remi.duraffort@linaro.org>
parent 10eed80b
......@@ -35,6 +35,7 @@ import subprocess # nosec - verified.
from lava_dispatcher.power import ResetDevice
from lava_dispatcher.protocols.lxc import LxcProtocol
from lava_dispatcher.actions.deploy import DeployAction
from lava_dispatcher.actions.deploy.apply_overlay import AppendOverlays
from lava_dispatcher.actions.deploy.overlay import OverlayAction
from lava_dispatcher.connections.serial import ConnectDevice
from lava_common.exceptions import InfrastructureError, JobError, LAVABug
......@@ -103,6 +104,15 @@ class DownloaderAction(RetryAction):
else:
raise JobError("Unsupported url protocol scheme: %s" % url.scheme)
self.pipeline.add_action(action)
overlays = self.params.get("overlays", [])
for overlay in overlays:
self.pipeline.add_action(
DownloaderAction(
"%s.%s" % (self.key, overlay), self.path, params=overlays[overlay]
)
)
if overlays:
self.pipeline.add_action(AppendOverlays(self.key, params=self.params))
class DownloadHandler(Action):
......@@ -278,6 +288,13 @@ class DownloadHandler(Action):
if self.key == "ramdisk":
self.logger.debug("Not decompressing ramdisk as can be used compressed.")
self.set_namespace_data(
action="download-action",
label=self.key,
key="decompressed",
value=bool(compression),
)
md5sum = self.params.get("md5sum")
sha256sum = self.params.get("sha256sum")
sha512sum = self.params.get("sha512sum")
......
......@@ -624,6 +624,7 @@ def test_http_download_run(tmpdir):
"common": {
"download-action": {
"dtb": {
"decompressed": False,
"file": "%s/dtb/dtb" % str(tmpdir),
"md5": "fc5e038d38a57032085441e7fe7010b0",
"sha256": "936a185caaa266bb9cbe981e9e05cb78cd732b0b3280eb944412bb6f8f8f07af",
......@@ -682,6 +683,7 @@ def test_http_download_run_compressed(tmpdir):
"common": {
"download-action": {
"rootfs": {
"decompressed": True,
"file": "%s/rootfs/rootfs" % str(tmpdir),
"md5": "0107d527acf9b8de628b7b4d103c89d1",
"sha256": "3275a39be7b717d548b66f3c8f23d940603a63b0f13d84a596d979a7f66feb2c",
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment