kdevops: fixes for new ansible and some nfsd default config changes
cover kdevops: fixes for new ansible and some nfsd default config changes
ansible-2.20 has a nasty surprise. Strings can no longer be evaluated as booleans. It throws an exception instead. The first patch fixes this up in the tree.
The last patches are more optional, but I've been carrying them for a while, and it would be nice to get them in. I think they make for reasonable changes to the existing workflows.
---
Jeff Layton (4):
ansible: fix bare conditionals for ansible-core 2.20+ strict booleans
gitr: enable verbose logging in the test harness
nfsd: use more reasonable defaults for local VM testing
devconfig: add some extra packages to the kdev tools
kconfigs/Kconfig.nfsd | 4 +- playbooks/roles/bootlinux/tasks/build/9p.yml | 2 +- playbooks/roles/bootlinux/tasks/build/builder.yml | 2 +- playbooks/roles/bootlinux/tasks/build/targets.yml | 2 +- playbooks/roles/bootlinux/tasks/main.yml | 4 +- playbooks/roles/build_linux/tasks/main.yml | 8 +- playbooks/roles/codereadyrepo/tasks/main.yml | 10 +- .../devconfig/tasks/install-deps/redhat/main.yml | 14 +- .../devconfig/tasks/install-deps/suse/main.yml | 2 +- playbooks/roles/devconfig/tasks/main.yml | 18 +- playbooks/roles/fstests/tasks/main.yml | 12 +- playbooks/roles/gen_hosts/tasks/main.yml | 80 +++---- playbooks/roles/gen_nodes/tasks/main.yml | 242 ++++++++++----------- playbooks/roles/gen_pci_kconfig/tasks/main.yml | 4 +- playbooks/roles/gen_tfvars/tasks/main.yml | 6 +- playbooks/roles/gitr/tasks/main.yml | 4 +- playbooks/roles/kdevops_archive/tasks/main.yml | 2 +- .../roles/nfsd/tasks/install-deps/redhat/main.yml | 2 +- .../roles/nfsd/tasks/install-deps/suse/main.yml | 2 +- playbooks/roles/nfsd/templates/nfs.conf.j2 | 5 + playbooks/roles/reboot-limit/tasks/do-reboot.yml | 4 +- playbooks/roles/update_etc_hosts/tasks/main.yml | 6 +- 22 files changed, 223 insertions(+), 212 deletions(-)
---
base-commit: 1a61f43dc2bc2e019fc4a35d9673cfa31909272d
change-id: 20260515-fixes-4e708e81ced8
Best regards,
Signature · 1 line
Jeff Layton <[email protected]>
PATCH 1/4 ansible: fix bare conditionals for ansible-core 2.20+ strict booleans
Starting with ansible-core 2.20, when: conditionals that evaluate to a string instead of a boolean cause a fatal error rather than a deprecation warning. This affected two categories of variables across 16 role files.
Kconfig boolean variables exported through extra_vars.yaml arrive as strings like "True" rather than native booleans and need the |bool filter appended. This covers variables such as kdevops_workflows_dedicated_workflow, kdevops_baseline_and_dev, kdevops_workflow_enable_*, kdevops_enable_terraform, kdevops_enable_guestfs, bootlinux_builder, workflows_reboot_limit, and several others in the gen_nodes, gen_hosts, gen_tfvars, devconfig, build_linux, codereadyrepo, gen_pci_kconfig, reboot-limit, update_etc_hosts, and kdevops_archive roles.
String variables like target_linux_install_b4, fstests_nfs_auth_flavor, and devconfig_custom_yum_repofile hold package names, paths, or configuration values that may be empty or None and need the "| default('', true) | length > 0" pattern to produce a proper boolean.
One registered variable was also fixed where devconfig checked "not grub_timeout_grep" (a result dict) instead of the correct "not grub_timeout_grep.changed" form.
--- playbooks/roles/bootlinux/tasks/build/9p.yml | 2 +- playbooks/roles/bootlinux/tasks/build/builder.yml | 2 +- playbooks/roles/bootlinux/tasks/build/targets.yml | 2 +- playbooks/roles/bootlinux/tasks/main.yml | 4 +- playbooks/roles/build_linux/tasks/main.yml | 8 +- playbooks/roles/codereadyrepo/tasks/main.yml | 10 +- .../devconfig/tasks/install-deps/redhat/main.yml | 8 +- .../devconfig/tasks/install-deps/suse/main.yml | 2 +- playbooks/roles/devconfig/tasks/main.yml | 18 +- playbooks/roles/fstests/tasks/main.yml | 12 +- playbooks/roles/gen_hosts/tasks/main.yml | 80 +++---- playbooks/roles/gen_nodes/tasks/main.yml | 242 ++++++++++----------- playbooks/roles/gen_pci_kconfig/tasks/main.yml | 4 +- playbooks/roles/gen_tfvars/tasks/main.yml | 6 +- playbooks/roles/kdevops_archive/tasks/main.yml | 2 +- .../roles/nfsd/tasks/install-deps/redhat/main.yml | 2 +- .../roles/nfsd/tasks/install-deps/suse/main.yml | 2 +- playbooks/roles/reboot-limit/tasks/do-reboot.yml | 4 +- playbooks/roles/update_etc_hosts/tasks/main.yml | 6 +- 19 files changed, 208 insertions(+), 208 deletions(-)
playbooks/roles/bootlinux/tasks/build/9p.yml +1 -1
@@ -13,7 +13,7 @@ - b4 when: - target_linux_install_b4 is defined - - target_linux_install_b4 + - target_linux_install_b4 | default('', true) | length > 0 - ansible_facts['os_family']|lower != 'debian' run_once: true delegate_to: localhost
playbooks/roles/bootlinux/tasks/build/builder.yml +1 -1
@@ -7,7 +7,7 @@ - b4 when: - target_linux_install_b4 is defined - - target_linux_install_b4 + - target_linux_install_b4 | default('', true) | length > 0 - ansible_os_family == "Debian" - name: Clone {{ target_linux_tree }}
playbooks/roles/bootlinux/tasks/build/targets.yml +1 -1
@@ -7,7 +7,7 @@ - b4 when: - target_linux_install_b4 is defined - - target_linux_install_b4 + - target_linux_install_b4 | default('', true) | length > 0 - ansible_facts['os_family']|lower != 'debian' - name: Git clone {{ target_linux_tree }} on the target nodes
playbooks/roles/bootlinux/tasks/main.yml +2 -2
@@ -56,8 +56,8 @@ name: - b4 when: - - target_linux_install_b4 is defined - - target_linux_install_b4 + - target_linux_install_b4 | default('', true) | length > 0 is defined + - target_linux_install_b4 | default('', true) | length > 0 - ansible_facts['os_family']|lower != 'debian' - not workflow_linux_packaged|bool
playbooks/roles/build_linux/tasks/main.yml +4 -4
@@ -37,7 +37,7 @@ - name: Setup dedicated build filesystem when: - - build_linux_storage_enable + - build_linux_storage_enable|bool block: - name: Check if device is already mounted become: yes
@@ -149,7 +149,7 @@ single_branch: yes when: - not linux_git_exists.stat.exists or git_repo_check.rc != 0 - - shallow_clone + - shallow_clone|bool - name: Clone Linux kernel source (full) ansible.builtin.git:
@@ -157,7 +157,7 @@ dest: "{{ linux_source_dir }}" when: - not linux_git_exists.stat.exists or git_repo_check.rc != 0 - - not shallow_clone + - not shallow_clone|bool retries: 3 delay: 10 register: git_result
@@ -173,7 +173,7 @@ args: chdir: "{{ linux_source_dir }}" when: - - build_linux_use_latest_tag + - build_linux_use_latest_tag|bool - linux_source_stat.stat.writeable - name: Ensure /data directory is writable
playbooks/roles/codereadyrepo/tasks/main.yml +5 -5
@@ -2,14 +2,14 @@ - name: Enable a CodeReady Builder repo for this distribution when: - ansible_distribution != "Fedora" - - not devconfig_custom_yum_repofile + - devconfig_custom_yum_repofile | default('', true) | length == 0 block: - name: Select the RHEL CodeReady Builder repo ansible.builtin.set_fact: codeready_repo: "codeready-builder-for-rhel-{{ ansible_distribution_major_version }}-{{ ansible_architecture }}-rpms" when: - ansible_distribution == 'RedHat' - - kdevops_enable_guestfs + - kdevops_enable_guestfs|bool - name: Select the Oracle Linux CodeReady Builder repo ansible.builtin.set_fact:
@@ -28,7 +28,7 @@ codeready_repo: "codeready-builder-for-rhel-{{ ansible_distribution_major_version }}-rhui-rpms" when: - ansible_distribution == 'RedHat' - - kdevops_enable_terraform + - kdevops_enable_terraform|bool - kdevops_terraform_provider == "aws" - name: Select the Azure RHEL CodeReady Builder repo
@@ -36,7 +36,7 @@ codeready_repo: "codeready-builder-for-rhel-{{ ansible_distribution_major_version }}-{{ ansible_architecture }}-rhui-rpms" when: - ansible_distribution == 'RedHat' - - kdevops_enable_terraform + - kdevops_enable_terraform|bool - kdevops_terraform_provider == "azure" - name: Select the Google Cloud RHEL CodeReady Builder repo
@@ -44,7 +44,7 @@ codeready_repo: "rhui-codeready-builder-for-rhel-{{ ansible_distribution_major_version }}-{{ ansible_architecture }}-rhui-rpms" when: - ansible_distribution == 'RedHat' - - kdevops_enable_terraform + - kdevops_enable_terraform|bool - kdevops_terraform_provider == "gce" - name: The distribution/provisioner combo isn't recognized
playbooks/roles/devconfig/tasks/install-deps/redhat/main.yml +4 -4
@@ -9,15 +9,15 @@ activationkey: "{{ rhel_activation_key }}" force_register: true when: - - rhel_org_id - - rhel_activation_key + - rhel_org_id | default('', true) | length > 0 + - rhel_activation_key | default('', true) | length > 0 - name: Check whether custom repofile exists ansible.builtin.stat: path: "{{ devconfig_custom_yum_repofile }}" register: custom_repofile delegate_to: localhost - when: devconfig_custom_yum_repofile + when: devconfig_custom_yum_repofile | default('', true) | length > 0 - name: Add custom yum repo become: true
@@ -29,7 +29,7 @@ group: root mode: "0644" when: - - devconfig_custom_yum_repofile + - devconfig_custom_yum_repofile | default('', true) | length > 0 - custom_repofile.stat.exists - name: Discover the fastest package update mirrors
playbooks/roles/devconfig/tasks/install-deps/suse/main.yml +1 -1
@@ -377,7 +377,7 @@ install_snmp: true install_kdump: true when: - - is_sle15|bool or is_tumbleweed + - is_sle15|bool or is_tumbleweed|bool tags: ["vars"] - name: Install snmp
playbooks/roles/devconfig/tasks/main.yml +9 -9
@@ -22,16 +22,16 @@ ansible.builtin.command: "whoami" register: declared_host_user when: - - kdevops_use_declared_hosts - - workflow_infer_user_and_group + - kdevops_use_declared_hosts|bool + - workflow_infer_user_and_group|bool changed_when: false - name: Infer group on declared hosts ansible.builtin.command: "id -g -n" register: declared_host_group when: - - kdevops_use_declared_hosts - - workflow_infer_user_and_group + - kdevops_use_declared_hosts|bool + - workflow_infer_user_and_group|bool changed_when: false - name: Set inferred user and group for declared hosts
@@ -39,8 +39,8 @@ data_user: "{{ declared_host_user.stdout | default(data_user) }}" data_group: "{{ declared_host_group.stdout | default(data_group) }}" when: - - kdevops_use_declared_hosts - - workflow_infer_user_and_group + - kdevops_use_declared_hosts|bool + - workflow_infer_user_and_group|bool # Update /etc/hostname first so the change gets picked up by the reboot # that occurs during the distro-specific tasks
@@ -436,7 +436,7 @@ when: - grub2_config_file.stat.exists - devconfig_enable_console|bool - - not grub_timeout_grep + - not grub_timeout_grep.changed tags: ["console"] - name: Check to see if the GRUB serial command is defined
@@ -720,8 +720,8 @@ sysctl_set: true reload: true when: - - devconfig_enable_sysctl_tuning - - devconfig_enable_sysctl_mm_overcommit_memory + - devconfig_enable_sysctl_tuning|bool + - devconfig_enable_sysctl_mm_overcommit_memory|bool tags: ["sysctl"] - name: Rev the kernel to the latest distribution kotd
playbooks/roles/fstests/tasks/main.yml +6 -6
@@ -801,8 +801,8 @@ register: nfsmount_conf when: - fstests_fstyp == "nfs" - - fstests_nfs_auth_flavor is defined - - fstests_nfs_auth_flavor + - fstests_nfs_auth_flavor | default('', true) | length > 0 is defined + - fstests_nfs_auth_flavor | default('', true) | length > 0 - name: Create /etc/nfsmount.conf become: true
@@ -816,8 +816,8 @@ mode: "0644" when: - fstests_fstyp == "nfs" - - fstests_nfs_auth_flavor is defined - - fstests_nfs_auth_flavor + - fstests_nfs_auth_flavor | default('', true) | length > 0 is defined + - fstests_nfs_auth_flavor | default('', true) | length > 0 - not nfsmount_conf.stat.exists - name: Set auth flavor for NFS
@@ -830,8 +830,8 @@ line: "Sec={{ fstests_nfs_auth_flavor }}" when: - fstests_fstyp == "nfs" - - fstests_nfs_auth_flavor is defined - - fstests_nfs_auth_flavor + - fstests_nfs_auth_flavor | default('', true) | length > 0 is defined + - fstests_nfs_auth_flavor | default('', true) | length > 0 - name: Create SMB share for test vol ansible.builtin.include_role:
playbooks/roles/gen_hosts/tasks/main.yml +40 -40
215 lines not on this page · raw message
playbooks/roles/gen_nodes/tasks/main.yml +121 -121
631 lines not on this page · raw message
playbooks/roles/gen_pci_kconfig/tasks/main.yml +2 -2
@@ -2,9 +2,9 @@ - name: Dump pci output in machine-readible form ansible.builtin.shell: "lspci -Dvmmm > {{ topdir_path }}/.dynamic-kconfig.pci.txt" when: - - kdevops_pcie_dynamic_kconfig + - kdevops_pcie_dynamic_kconfig|bool - name: Generate libvirt PCI-E kcofig files ansible.builtin.shell: "./python/workflows/dynamic-kconfig/gen-dynamic-pci.py {{ topdir_path }}/.dynamic-kconfig.pci.txt > {{ topdir_path }}/Kconfig.passthrough_libvirt.generated" when: - - kdevops_pcie_dynamic_kconfig + - kdevops_pcie_dynamic_kconfig|bool
playbooks/roles/gen_tfvars/tasks/main.yml +3 -3
@@ -34,7 +34,7 @@ patterns: "Kconfig*.generated" register: provider_kconfig_files when: - - kdevops_enable_terraform + - kdevops_enable_terraform|bool - name: Check if any dynamic Kconfig files are empty ansible.builtin.fail:
@@ -52,7 +52,7 @@ For more information, run 'make help' and see the cloud-config targets section. when: - - kdevops_enable_terraform + - kdevops_enable_terraform|bool - provider_kconfig_files.matched > 0 - item.size == 0 loop: "{{ provider_kconfig_files.files }}"
@@ -79,5 +79,5 @@ dest: "{{ topdir_path }}/{{ kdevops_terraform_tfvars }}" force: true when: - - kdevops_enable_terraform + - kdevops_enable_terraform|bool - terraform_tfvars_template.stat.exists
playbooks/roles/kdevops_archive/tasks/main.yml +1 -1
@@ -228,7 +228,7 @@ environment: GIT_LFS_SKIP_SMUDGE: "1" when: - - kdevops_archive_mirror_present + - kdevops_archive_mirror_present|bool register: git_clone_result - name: Remind user this is a demo
playbooks/roles/nfsd/tasks/install-deps/redhat/main.yml +1 -1
@@ -19,7 +19,7 @@ nfsd_packages: "{{ nfsd_packages + [fsprogs] }}" when: - fsprogs is defined - - fsprogs + - fsprogs | default('', true) | length > 0 - name: Install nfsd dependencies become: true
playbooks/roles/nfsd/tasks/install-deps/suse/main.yml +1 -1
@@ -19,7 +19,7 @@ nfsd_packages: "{{ nfsd_packages + [fsprogs] }}" when: - fsprogs is defined - - fsprogs + - fsprogs | default('', true) | length > 0 - name: Add additional packages needed for krb5 to the nfsd packages list ansible.builtin.set_fact:
playbooks/roles/reboot-limit/tasks/do-reboot.yml +2 -2
@@ -171,7 +171,7 @@ ansible.builtin.shell: echo 1 > /proc/sys/kernel/sysrq tags: ["run_tests", "read_count", "vars", "crash-check"] when: - - reboot_limit_boot_count_crash_enable + - reboot_limit_boot_count_crash_enable|bool - ((reboot_limit_count | int % reboot_limit_boot_crash_count | int) == 0) - name: Force a crash if we were asked to
@@ -181,7 +181,7 @@ ignore_errors: true tags: ["run_tests", "read_count", "vars", "crash-check"] when: - - reboot_limit_boot_count_crash_enable + - reboot_limit_boot_count_crash_enable|bool - ((reboot_limit_count | int % reboot_limit_boot_crash_count | int) == 0) - name: Write current updated boot count variable file to be {{ reboot_limit_count }}
playbooks/roles/update_etc_hosts/tasks/main.yml +3 -3
@@ -22,7 +22,7 @@ ansible.builtin.set_fact: private_network: "{{ terraform_private_net_prefix }}/{{ terraform_private_net_mask }}" when: - - terraform_private_net_enabled + - terraform_private_net_enabled|bool - name: Build list of hosts ansible.builtin.set_fact:
@@ -56,7 +56,7 @@ state: present with_items: "{{ ueh_hosts }}" when: - - terraform_private_net_enabled + - terraform_private_net_enabled|bool - not (kdevops_enable_nixos | default(false)) - name: Add IP address of all hosts to all hosts
@@ -69,7 +69,7 @@ state: present with_items: "{{ ueh_hosts }}" when: - - not terraform_private_net_enabled + - not terraform_private_net_enabled|bool - not (kdevops_enable_nixos | default(false)) - name: Fix up hostname on Debian guestfs hosts
Signature · 1 line
2.54.0
PATCH 2/4 gitr: enable verbose logging in the test harness
In reply to Jeff LaytonIt's pretty difficult to suss out what failed when the gitr suite fails. Make it do verbose logging so that there is some indication of what failed when it does occur.
--- playbooks/roles/gitr/tasks/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
playbooks/roles/gitr/tasks/main.yml +2 -2
@@ -264,7 +264,7 @@ environment: GIT_TEST_CLONE_2GB: "true" ansible.builtin.shell: - cmd: "prove -Q -a /tmp/{{ gitr_run_uniqifier }}.tgz --jobs {{ gitr_test_thread_count }} ./t[0-9]*.sh" + cmd: "prove -Q -a /tmp/{{ gitr_run_uniqifier }}.tgz --jobs {{ gitr_test_thread_count }} ./t[0-9]*.sh :: --verbose-log" chdir: "{{ gitr_mnt }}/git/t" register: gitr_results failed_when: false
@@ -273,7 +273,7 @@ - name: Run specific git regression tests tags: run_specific_tests ansible.builtin.command: - cmd: "prove -Q -a /tmp/{{ gitr_run_uniqifier }}.tgz {{ gitr_test_list }}" + cmd: "prove -Q -a /tmp/{{ gitr_run_uniqifier }}.tgz {{ gitr_test_list }} :: --verbose-log" chdir: "{{ gitr_mnt }}/git/t" register: gitr_results failed_when: false
Signature · 1 line
2.54.0
PATCH 3/4 nfsd: use more reasonable defaults for local VM testing
In reply to Jeff Layton128 threads is a more reasonable default with modern machine sizes, and 30s is a more reasonable default grace period for localized testing with knfsd. Also, some other default config changes:
- enable v4.0 since we still need to test it
- min-threads setting to use dynamic threading by default on newer kernels.
- have mountd do manage_gids to exercise those codepaths
--- kconfigs/Kconfig.nfsd | 4 ++-- playbooks/roles/nfsd/templates/nfs.conf.j2 | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-)
kconfigs/Kconfig.nfsd +2 -2
@@ -56,13 +56,13 @@ config NFSD_EXPORT_OPTIONS config NFSD_THREADS int "Number of nfsd threads to spawn" - default 8 + default 128 help Number of nfsd threads to start up for testing. config NFSD_LEASE_TIME int "NFSv4 lease time and grace period, in seconds" - default 90 + default 30 help Time, in seconds, that the NFS server will wait before expiring a client lease. Production servers typically use 90 seconds to
playbooks/roles/nfsd/templates/nfs.conf.j2 +5 -0
@@ -1,9 +1,14 @@ [general] pipefs-directory={{ pipefs_directory }} +[mountd] +manage-gids=y + [nfsd] udp=y rdma=y +vers4.0=y +min-threads=1 threads={{ nfsd_threads }} grace-time={{ nfsd_lease_time }} lease-time={{ nfsd_lease_time }}
Signature · 1 line
2.54.0
PATCH 4/4 devconfig: add some extra packages to the kdev tools
In reply to Jeff LaytonInstall some more useful tools as part of devconfig. This only adds them to the redhat configs, as I wasn't sure of package names for the other distros.
--- playbooks/roles/devconfig/tasks/install-deps/redhat/main.yml | 6 ++++++ 1 file changed, 6 insertions(+)
playbooks/roles/devconfig/tasks/install-deps/redhat/main.yml +6 -0
@@ -108,6 +108,12 @@ - net-snmp - trace-cmd - perf + - strace + - lsof + - git + - wireshark-cli + - rsync + - time when: - devconfig_try_install_kdevtools|bool
Signature · 1 line
2.54.0
Re: [PATCH 1/4] ansible: fix bare conditionals for ansible-core 2.20+ strict booleans
In reply to Jeff LaytonQuoted 7 lines · Jeff Layton
Starting with ansible-core 2.20, when: conditionals that evaluate to a string instead of a boolean cause a fatal error rather than a deprecation warning. This affected two categories of variables across 16 role files.
Kconfigboolean variables exported throughextra_vars.yamlarrive as strings like "True" rather than native booleans and need the |bool
Is not a Kconfig's yaml issue but rather the old legacy Makefile extra vars propagation. Example:
scripts/gen-hosts.Makefile:GENHOSTS_EXTRA_ARGS += kdevops_workflows_dedicated_workflow='True'
FYI, at some point we need to promote these variables to Kconfig and cleaned them up from Makefiles. Considering the reports from Chuck and you with configs being gated behind if-conditionals, I changed kconfig to always generate the symbols:
scripts/kconfig/confdata.c +21 -2
@@ -888,8 +888,13 @@ int conf_write_defconfig(const char *filename)continue ;sym_calc_value (sym); -if (!(sym->flags &SYMBOL_WRITE )) +if (!(sym->flags &SYMBOL_WRITE )) { +/* See conf_write() for the yaml-override rationale. */ +if (yaml_out && (sym->flags &SYMBOL_YAML )) +__print_yaml_symbol (yaml_out, sym, +OUTPUT_N , true);continue ; + } sym->flags &= ~SYMBOL_WRITE ;/* Skip unchangeable symbols */ if (!sym_is_changeable (sym))
@@ -990,8 +995,22 @@ int conf_write(const char *name) }else if (!sym_is_choice (sym) && !(sym->flags &SYMBOL_WRITTEN )) {sym_calc_value (sym); -if (!(sym->flags &SYMBOL_WRITE )) +if (!(sym->flags &SYMBOL_WRITE )) { +/* +* .config omits hidden bools that evaluate to +* n and symbols inside a disabled `if`, per +* Linux convention. An explicit `output yaml` +* declaration overrides that for YAML so a +* consumer never sees an undefined key for a +* symbol the producer declared. +*/ +if (yaml_config && (sym->flags &SYMBOL_YAML )) { + sym->flags |=SYMBOL_WRITTEN ; +__print_yaml_symbol (yaml_out, sym, +OUTPUT_N , true); + } goto next; + }if (need_newline) {fprintf (out,"\n" ); need_newline = false;
But it's tedious work and needs testing. I already have some downstream changes that I intend to send soon that should help with this patch. Can you share which kind of workloads you run so I double check before sending?
playbooks/roles/bootlinux/tasks/build/9p.yml line 16
Quoted 10 lines
playbooks/roles/bootlinux/tasks/build/9p.yml +1
-1@@ -13,7 +13,7 @@ - b4 when: - target_linux_install_b4 is defined - - target_linux_install_b4 + - target_linux_install_b4 | default('', true) | length > 0
Changes are inconsistent. See the other target_linux_install_b4 hunk below.
playbooks/roles/bootlinux/tasks/build/9p.yml line 62
Quoted 10 lines
playbooks/roles/bootlinux/tasks/build/9p.yml +2
-2@@ -56,8 +56,8 @@ name: - b4 when: - - target_linux_install_b4 is defined - - target_linux_install_b4 + - target_linux_install_b4 | default('', true) | length > 0 is defined + - target_linux_install_b4 | default('', true) | length > 0 - ansible_facts['os_family']|lower != 'debian' - not workflow_linux_packaged|bool
We probably don't need the 'is defined' condition as we are ensuring the variable always gets a default value even when it's not propagated through.
Re: [PATCH 1/4] ansible: fix bare conditionals for ansible-core 2.20+ strict booleans
Quoted 63 lines · Daniel Gomez
Quoted 7 lines · Jeff Layton
Starting with ansible-core 2.20, when: conditionals that evaluate to a string instead of a boolean cause a fatal error rather than a deprecation warning. This affected two categories of variables across 16 role files.
Kconfigboolean variables exported throughextra_vars.yamlarrive as strings like "True" rather than native booleans and need the |boolIs not a Kconfig's yaml issue but rather the old legacy
Makefileextra vars propagation. Example:scripts/gen-hosts.Makefile:GENHOSTS_EXTRA_ARGS += kdevops_workflows_dedicated_workflow='True'
FYI, at some point we need to promote these variables to
Kconfigand cleaned them up from Makefiles. Considering the reports from Chuck and you with configs being gated behind if-conditionals, I changed kconfig to always generate the symbols:scripts/kconfig/confdata.c +21
-2@@ -888,8 +888,13 @@ int conf_write_defconfig(const char *filename)continue ;sym_calc_value (sym); -if (!(sym->flags &SYMBOL_WRITE )) +if (!(sym->flags &SYMBOL_WRITE )) { +/* See conf_write() for the yaml-override rationale. */ +if (yaml_out && (sym->flags &SYMBOL_YAML )) +__print_yaml_symbol (yaml_out, sym, +OUTPUT_N , true);continue ; + } sym->flags &= ~SYMBOL_WRITE ;/* Skip unchangeable symbols */ if (!sym_is_changeable (sym))@@ -990,8 +995,22 @@ int conf_write(const char *name) }else if (!sym_is_choice (sym) && !(sym->flags &SYMBOL_WRITTEN )) {sym_calc_value (sym); -if (!(sym->flags &SYMBOL_WRITE )) +if (!(sym->flags &SYMBOL_WRITE )) { +/* +* .config omits hidden bools that evaluate to +* n and symbols inside a disabled `if`, per +* Linux convention. An explicit `output yaml` +* declaration overrides that for YAML so a +* consumer never sees an undefined key for a +* symbol the producer declared. +*/ +if (yaml_config && (sym->flags &SYMBOL_YAML )) { + sym->flags |=SYMBOL_WRITTEN ; +__print_yaml_symbol (yaml_out, sym, +OUTPUT_N , true); + } goto next; + }if (need_newline) {fprintf (out,"\n" ); need_newline = false;
Quoted 4 lines
But it's tedious work and needs testing. I already have some downstream changes that I intend to send soon that should help with this patch. Can you share which kind of workloads you run so I double check before sending?
Mostly NFS workloads with fstests, pynfs, etc.
I'm not clear -- do you want me to wait on merging this patch until your change goes in, or will you be doing that on top of this one?
Quoted 13 lines
playbooks/roles/bootlinux/tasks/build/9p.yml line 16
Quoted 10 lines
playbooks/roles/bootlinux/tasks/build/9p.yml +1
-1@@ -13,7 +13,7 @@ - b4 when: - target_linux_install_b4 is defined - - target_linux_install_b4 + - target_linux_install_b4 | default('', true) | length > 0Changes are inconsistent. See the other
target_linux_install_b4hunk below.
Quoted 14 lines
playbooks/roles/bootlinux/tasks/build/9p.yml line 62
Quoted 10 lines
playbooks/roles/bootlinux/tasks/build/9p.yml +2
-2@@ -56,8 +56,8 @@ name: - b4 when: - - target_linux_install_b4 is defined - - target_linux_install_b4 + - target_linux_install_b4 | default('', true) | length > 0 is defined + - target_linux_install_b4 | default('', true) | length > 0 - ansible_facts['os_family']|lower != 'debian' - not workflow_linux_packaged|boolWe probably don't need the 'is defined' condition as we are ensuring the variable always gets a default value even when it's not propagated through.
Good point. Will fix.
Signature · 1 line
Jeff Layton <[email protected]>