Repository navigation
Conversation
s-hertel
left a comment
There was a problem hiding this comment.
This change makes sense to me. Since the value is type "raw", I think we should add more validation. If the coerced value isn't "true" or "false", the module should give an error. If the vtype is not multiselect/boolean/seen, the module should check value is a string.
s-hertel
left a comment
There was a problem hiding this comment.
The same line in set_selection causes unclear failure messages for other vtypes too. Since set_selection is the only "validation" for other vtypes, it also means check mode won't detect the issue (and instead will always return changed as True).
from ansible.module_utils.common.validation import _check_type_str_no_conversion
if vtype not in ('boolean', 'seen', 'multiselect'):
value = _check_type_str_no_conversion(value) * Handled case when vtype is seen * Fixed idempotency for debconf settings where vtype is seen * Added tests for value conversion Fixes: ansible#85683 Signed-off-by: Abhijeet Kasurde <Akasurde@redhat.com>
s-hertel
left a comment
There was a problem hiding this comment.
This generally looks good to me. I noticed a couple little bugs with diff and check mode.
Diff mode shows the requested seen value replacing the value for the question. For example, this question was seen, setting seen to false shows:
--- before
+++ after
@@ -1,3 +1,3 @@
{
- "mypackage/some-feature": "value"
+ "mypackage/some-feature": "false"
}Not sure if the diff format should be kept the same for vtype seen, but this would at least compare the right values:
curr = {question: value}
if question in prev:
- prev = {question: prev[question]}
+ prev = {question: existing}The second bug is that invalid values for multiselect aren't detected in check mode when the question is not in the variable prev.
Signed-off-by: Abhijeet Kasurde <Akasurde@redhat.com>
SUMMARY
Fixes: #85683
Signed-off-by: Abhijeet Kasurde Akasurde@redhat.com
ISSUE TYPE
COMPONENT NAME
changelogs/fragments/debconf_seen_flag.yml
lib/ansible/modules/debconf.py
test/integration/targets/debconf/tasks/main.yml