如何避免类型转换警告? [英] How to avoid type conversion warnings?
问题描述
当我将 dconf模块与循环一起使用>
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"
我收到这样的警告:
[警告]:字符串字段中的值['us','se'](类型列表)被转换为"['us','se']"(类型 细绳).如果这看起来不符合您的期望,请引用整个值以确保它不会 改变.
[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.
[警告]:字符串字段中的值['1:40'](类型列表)已转换为"['1:40']"(类型字符串). 如果这看起来不符合您的期望,请引用整个值以确保其不变.
[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
推荐答案
您尝试过
value: "{{ item.value |string }}"
这篇关于如何避免类型转换警告?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!