redhat-cop/infra.osbuild

create_blueprint fails when a customization value is a boolean

jce-redhat opened this issue · 0 comments

Given the following task:

    - name: Test simplified installer blueprint
      infra.osbuild.create_blueprint:
        dest: '/tmp/simplified-installer.toml'
        name: 'SimplifiedInstaller'
        customizations:
          fdo:
            manufacturing_server_url: 'http://localhost:8080'
            diun_pub_key_insecure: true

the create_blueprint module fails:

The full traceback is:
Traceback (most recent call last):
  File "/home/localadmin/.ansible/tmp/ansible-tmp-1677269750.3140404-299139-251784242170772/AnsiballZ_create_blueprint.py", line 107, in <module>
    _ansiballz_main()
  File "/home/localadmin/.ansible/tmp/ansible-tmp-1677269750.3140404-299139-251784242170772/AnsiballZ_create_blueprint.py", line 99, in _ansiballz_main
    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
  File "/home/localadmin/.ansible/tmp/ansible-tmp-1677269750.3140404-299139-251784242170772/AnsiballZ_create_blueprint.py", line 47, in invoke_module
    runpy.run_module(mod_name='ansible_collections.infra.osbuild.plugins.modules.create_blueprint', init_globals=dict(_module_fqn='ansible_collections.infra.osbuild.plugins.modules.create_blueprint', _modlib_path=modlib_path),
  File "/usr/lib64/python3.9/runpy.py", line 225, in run_module
    return _run_module_code(code, init_globals, run_name, mod_spec)
  File "/usr/lib64/python3.9/runpy.py", line 97, in _run_module_code
    _run_code(code, mod_globals, init_globals,
  File "/usr/lib64/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/tmp/ansible_infra.osbuild.create_blueprint_payload_os36khxv/ansible_infra.osbuild.create_blueprint_payload.zip/ansible_collections/infra/osbuild/plugins/modules/create_blueprint.py", line 204, in <module>
  File "/tmp/ansible_infra.osbuild.create_blueprint_payload_os36khxv/ansible_infra.osbuild.create_blueprint_payload.zip/ansible_collections/infra/osbuild/plugins/modules/create_blueprint.py", line 181, in main
AttributeError: 'bool' object has no attribute 'startswith'

A workaround is to force the value to be a string, such as diun_pub_key_insecure: "true"