Uploaded image for project: 'RHEL'
  1. RHEL
  2. RHEL-84940

bug in toml rendering of `podman_containers_conf`

Linking RHIVOS CVEs to...Migration: Automation ...SWIFT: POC ConversionSync from "Extern...XMLWordPrintable

    • rhel-system-roles
    • 0
    • QE ack, Dev ack
    • False
    • False
    • Hide

      None

      Show
      None
    • Yes
    • Red Hat Enterprise Linux
    • None
    • Bug Fix
    • Hide
      .Boolean options are correctly written and handled in TOML files

      Before this update, boolean options were not correctly handled because the code that formats into TOML format did not convert boolean values to the correct string representation.

      With this update, we convert boolean options to string and then to lower case, which is the correct TOML boolean format. This ensures that TOML files correctly write and handle boolean options.
      Show
      .Boolean options are correctly written and handled in TOML files Before this update, boolean options were not correctly handled because the code that formats into TOML format did not convert boolean values to the correct string representation. With this update, we convert boolean options to string and then to lower case, which is the correct TOML boolean format. This ensures that TOML files correctly write and handle boolean options.
    • Done
    • Done
    • Done
    • Not Required
    • None

      Controller Ansible: 2.18.3
      Controller Python: 3.12.9
      Controller OS: macos

      Host Python: 3.9
      Host OS: RHEL 9.5

      Collection version: latest off ansible galaxy

      Podman running rootless

      Hello, I'm trying to apply the following configuration:

      ```yaml
      podman_containers_conf:
      containers:
      container_name_as_hostname: true
      log_driver: journald
      mounts: []
      tz: "{{ ansible_date_time.tz }}"
      engine:
      events_logger: journald
      healthcheck_events: false
      pull_policy: missing
      network:
      default_rootless_network_cmd: pasta
      network_backend: netavark
      ```

      I would expect to get output like

      ```toml
      #

      1. Ansible managed
        #
      2. system_role:podman

      [containers]
      container_name_as_hostname=true
      log_driver="journald"
      mounts=[]
      tz="CET"
      [engine]
      events_logger="journald"
      healthcheck_events=false
      pull_policy="missing"
      [network]
      default_rootless_network_cmd="pasta"
      network_backend="netavark"
      ```

      but instead i'm getting output of

      ```toml
      #

      1. Ansible managed
        #
      2. system_role:podman

      [containers]
      container_name_as_hostname = True
      log_driver="journald"
      mounts=[]
      tz="CET"
      [engine]
      events_logger="journald"
      healthcheck_events = False
      pull_policy="missing"
      [network]
      default_rootless_network_cmd="pasta"
      network_backend="netavark"
      ```

      which causes the following error:

      ```
      Mar 10 09:43:05 hostname systemd[15782]: 755dd2504963d286f699e262fe93cb49f8d6a95a522e01a8c87099b9a8f30820-4440e4c1d9912144.service: Failed with result 'exit-code'.
      Mar 10 09:43:06 hostname python3.9[150086]: ansible-systemd Invoked with name=podman-user-wait-network-online.service state=started scope=user daemon_reload=False daemon_reexec=False no_block=False enabled=None force=None masked=None
      Mar 10 09:43:12 hostname podman[150148]: time="2025-03-10T09:43:12+01:00" level=error msg="reading system config \"/home/podman/.config/containers/containers.conf.d/50-systemroles.conf\": decode configuration /home/podman/.config/containers/containers.conf.d/50-systemroles.conf: toml: line 7 (last key \"containers.container_name_as_hostname\"): expected value but found \"True\" instead"
      Mar 10 09:43:12 hostname systemd[15782]: 9f0e45aa2512750e3a1179221146cc79fb396699e430c59d6f0ac8d1632ccb8a-601bc5ac3b283d4f.service: Main process exited, code=exited, status=1/FAILURE
      ```

      It seems to be something in the Jinja2 template, i took a look at it but I'm not very familiar with Jinja. It seems like the bool isn't being converted properly?

              rmeggins@redhat.com Richard Megginson
              rmeggins@redhat.com Richard Megginson
              Richard Megginson Richard Megginson
              David Jez David Jez
              Mugdha Soni Mugdha Soni
              Votes:
              0 Vote for this issue
              Watchers:
              9 Start watching this issue

                Created:
                Updated: