[PATCH v2 07/15] devconfig: fix undefined custom repos/packages variables
Daniel Gomez <[email protected]> Wed, 29 Oct 2025 13:40:49 +0100
| Newsgroups | dev.linux.lists.kdevops |
|---|---|
| Message-ID | <[email protected]> |
From: Daniel Gomez <[email protected]> Ansible fails with "'kdevops_devconfig_custom_repos' is undefined" when KDEVOPS_DEVCONFIG_ENABLE_CUSTOM_REPOS is disabled (the default). Kconfig has a limitation where "output yaml" will not export variables that have unmet "depends on" conditions, leaving them completely undefined in extra_vars.yaml. This causes Ansible to fail when checking these variables even though they have default values in Kconfig. The fix migrates both variables to proper output yaml in Kconfig while removing the redundant legacy Makefile ANSIBLE_EXTRA_ARGS exports. To ensure the variables always exist regardless of kconfig conditions, the devconfig role's defaults/main.yml now provides empty string fallbacks. This follows standard Ansible patterns and makes the playbook portable for standalone use outside kdevops. Generated-by: Claude AI Signed-off-by: Daniel Gomez <[email protected]> --- Makefile | 7 ------- kconfigs/Kconfig.ansible_provisioning | 2 ++ playbooks/roles/devconfig/defaults/main.yml | 4 ++++ 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index bf72eee9..f8d36572 100644 --- a/Makefile +++ b/Makefile @@ -213,13 +213,6 @@ endif KDEVOPS_ANSIBLE_PROVISION_PLAYBOOK:=$(subst ",,$(CONFIG_KDEVOPS_ANSIBLE_PROVISION_PLAYBOOK)) ifeq (y,$(CONFIG_KDEVOPS_ANSIBLE_PROVISION_ENABLE)) ANSIBLE_EXTRA_ARGS += kdevops_ansible_provision_playbook='$(KDEVOPS_ANSIBLE_PROVISION_PLAYBOOK)' - -KDEVOPS_DEVCONFIG_CUSTOM_REPOS:=$(subst ",,$(CONFIG_KDEVOPS_DEVCONFIG_CUSTOM_REPOS)) -ANSIBLE_EXTRA_ARGS += kdevops_devconfig_custom_repos='$(KDEVOPS_DEVCONFIG_CUSTOM_REPOS)' - -KDEVOPS_DEVCONFIG_CUSTOM_PACKAGES:=$(subst ",,$(CONFIG_KDEVOPS_DEVCONFIG_CUSTOM_PACKAGES)) -ANSIBLE_EXTRA_ARGS += kdevops_devconfig_custom_packages='$(KDEVOPS_DEVCONFIG_CUSTOM_PACKAGES)' - endif include scripts/gen-hosts.Makefile diff --git a/kconfigs/Kconfig.ansible_provisioning b/kconfigs/Kconfig.ansible_provisioning index 590a1148..93cc395f 100644 --- a/kconfigs/Kconfig.ansible_provisioning +++ b/kconfigs/Kconfig.ansible_provisioning @@ -245,6 +245,7 @@ config KDEVOPS_DEVCONFIG_ENABLE_CUSTOM_REPOS config KDEVOPS_DEVCONFIG_CUSTOM_REPOS string "Comma separated list of custom repositories to be enabled" default "" + output yaml depends on KDEVOPS_DEVCONFIG_ENABLE_CUSTOM_REPOS=y help Comma separated list of custom repositories to be enabled @@ -252,6 +253,7 @@ config KDEVOPS_DEVCONFIG_CUSTOM_REPOS config KDEVOPS_DEVCONFIG_CUSTOM_PACKAGES string "Comma separated list of custom packages to be installed" default "" + output yaml depends on KDEVOPS_DEVCONFIG_ENABLE_CUSTOM_REPOS=y help Comma separated list of custom packages to be installed diff --git a/playbooks/roles/devconfig/defaults/main.yml b/playbooks/roles/devconfig/defaults/main.yml index b5d4724d..122cb898 100644 --- a/playbooks/roles/devconfig/defaults/main.yml +++ b/playbooks/roles/devconfig/defaults/main.yml @@ -60,3 +60,7 @@ unattended_upgrades_installed: false workflow_infer_user_and_group: false kdevops_use_declared_hosts: false kdevops_enable_terraform: false + +# Custom repository and package installation defaults +kdevops_devconfig_custom_repos: "" +kdevops_devconfig_custom_packages: "" -- 2.51.0