Skip to content

Commit

Permalink
boot_target: move most boot_target block into include
Browse files Browse the repository at this point in the history
so that it could be reused with different variables passed.

But since there are some blocks defined inside the
boot_target block, which could not be moved to
the include file, so just most of the lines are moved to
the include file, thus necessary lines like the "- boot:"
line should be added as well when reused in other places.

Signed-off-by: Yongqin Liu <yongqin.liu@linaro.org>
  • Loading branch information
liuyq committed Jul 27, 2023
1 parent cf7b84d commit 0bed479
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 27 deletions.
31 changes: 31 additions & 0 deletions lava_test_plans/include/boot_target/boot_target.jinja2
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{## NOTE: PLEASE DON'T ADD BLOCK HERE, AS ONLY THE RENDERED CONTENTS ##}
{## WILL BE RETURNED WHEN INCLUDED, WHICH DOES NOT HAVE THE BLOCK ##}
{## DEFINITION THEN, THE OVERRIDING CALLED AT OTHER PLACES WON'T WORK ##}

{% if kernel_start_message is defined and kernel_start_message %}
parameters:
kernel-start-message: {{ kernel_start_message }}
{% endif %}
{% if lxc_project == true %}
namespace: target
{% endif %}
{% include "include/boot_target/boot_os_prompt.jinja2" %}
{% include "include/boot_target/timeout_and_method.jinja2" %}
{% if FASTBOOT_COMMANDS is defined %}
commands:
{% for fcmd in FASTBOOT_COMMANDS %}
- {{ fcmd }}
{% endfor %}
{% endif %}
{% if lxc_project == true and pre_os_command is defined and pre_os_command == true %}
protocols:
lava-lxc:
- action: auto-login-action
request: pre-os-command
timeout:
minutes: 2
{% endif %}
{% if DOCKER_IMAGE_BOOT is defined %}
docker:
image: {{DOCKER_IMAGE_BOOT}}
{% endif %}
28 changes: 1 addition & 27 deletions lava_test_plans/include/fastboot.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -270,13 +270,6 @@ reboot_to_fastboot: {{ reboot_to_fastboot }}

{% block boot_target %}
- boot:
{% if kernel_start_message is defined and kernel_start_message %}
parameters:
kernel-start-message: {{ kernel_start_message }}
{% endif %}
{% if lxc_project == true %}
namespace: target
{% endif %}
{% block boot_commands %}
{% endblock boot_commands %}
{% if auto_login == true %}
Expand All @@ -285,26 +278,7 @@ reboot_to_fastboot: {{ reboot_to_fastboot }}
{% include "include/boot_target/auto_login_commands.jinja2" %}
{% endblock auto_login_commands %}
{% endif %}
{% include "include/boot_target/boot_os_prompt.jinja2" %}
{% include "include/boot_target/timeout_and_method.jinja2" %}
{% if FASTBOOT_COMMANDS is defined %}
commands:
{% for fcmd in FASTBOOT_COMMANDS %}
- {{ fcmd }}
{% endfor %}
{% endif %}
{% if lxc_project == true and pre_os_command is defined and pre_os_command == true %}
protocols:
lava-lxc:
- action: auto-login-action
request: pre-os-command
timeout:
minutes: 2
{% endif %}
{% if DOCKER_IMAGE_BOOT is defined %}
docker:
image: {{DOCKER_IMAGE_BOOT}}
{% endif %}
{% include "include/boot_target/boot_target.jinja2" %}
{% endblock boot_target %}

{% block post_boot_command %}
Expand Down

0 comments on commit 0bed479

Please sign in to comment.