Skip to content

Commit 3d99915

Browse files
committed
base_image: fix missing guestfs_distro_source_and_dest_file in yaml output
The GUESTFS_DISTRO_SOURCE_AND_DEST_FILE kconfig variable was missing the "output yaml" directive, causing it to be defined in .config but not exported to extra_vars.yaml that Ansible actually consumes. This resulted in the variable being undefined in Ansible templates: jinja2.exceptions.UndefinedError: 'target_dir' is undefined TypeError: expected str, bytes or os.PathLike object, not AnsibleUndefined The issue only manifested on some machines due to different Ansible execution contexts - the variable was in .config but missing from extra_vars.yaml where templates expect it. Fixed by adding "output yaml" to GUESTFS_DISTRO_SOURCE_AND_DEST_FILE kconfig definition, ensuring proper variable export to Ansible. Generated-by: Claude AI Signed-off-by: Daniel Gomez <[email protected]>
1 parent 453a5b2 commit 3d99915

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

kconfigs/Kconfig.guestfs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ config GUESTFS_COPY_SOURCES_FROM_HOST_TO_GUEST
6060
config GUESTFS_DISTRO_SOURCE_AND_DEST_FILE
6161
string
6262
depends on GUESTFS_COPY_SOURCES_FROM_HOST_TO_GUEST
63+
output yaml
6364
default "/etc/apt/sources.list" if GUESTFS_DEBIAN
6465

6566
endif

playbooks/roles/base_image/templates/virt-builder.j2

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ copy-in {{ kdevops_custom_yum_repofile }}:/etc/yum.repos.d
77
{% endif %}
88

99
{% if guestfs_copy_sources_from_host_to_guest %}
10+
{% set target_dir = guestfs_distro_source_and_dest_file | dirname %}
1011
mkdir {{ target_dir }}
1112
copy-in {{ guestfs_distro_source_and_dest_file }}:{{ target_dir }}
1213
{% endif %}

0 commit comments

Comments
 (0)