dmin
dmin

Reputation: 434

How to avoid type conversion warnings?

When I use the dconf module with a loop

- name: dconf | modify settings
  dconf:
    key: "{{ item.key }}"
    value: "{{ item.value }}"
    state: present
  loop:
    - key: "/org/gnome/libgnomekbd/keyboard/layouts"
      value: "['us', 'se']"
    - key: "/org/cinnamon/panels-height"
      value: "['1:40']"
  tags: "dconf"

I get such warnings:

[WARNING]: The value ['us', 'se'] (type list) in a string field was converted to "['us', 'se']" (type string). If this does not look like what you expect, quote the entire value to ensure it does not change.

[WARNING]: The value ['1:40'] (type list) in a string field was converted to "['1:40']" (type string). If this does not look like what you expect, quote the entire value to ensure it does not change.

I tried all possible ways to quote the value but without result

Upvotes: 6

Views: 7354

Answers (2)

Mohammad Ravanbakhsh
Mohammad Ravanbakhsh

Reputation: 3046

In my case I used static value and i got this warning. when I put my value in ' ' (Quotation) the warning didn't show any more.

Upvotes: 0

lewer
lewer

Reputation: 431

Have you tried

value: "{{ item.value |string }}"

Upvotes: 12

Related Questions