Bug #11129
closedUsing of two "File ensure key value in parameter list" methods in the same technique causes the second one to report failed if the first one fails.
Description
Please see the attached screenshots for the definition of the technique. the directive created from this technique is set to audit mode.
The initial contents of the file (/tmp/test) being operated on is as follows:
options color=blue height=4 width=5
The result of the agent running is:
A| compliant test File ensure key value pa| /tmp/test Add key non existing options with value height=4 in /tmp/test was correct A| compliant test File ensure key value pa| /tmp/test Add key non existing options with value width=5 in /tmp/test was correct
When the contents of the file change to:
options color=blue height=99 width=5
the result becomes:
A| non-compliant test File ensure key value pa| /tmp/test Add key non existing options with value height=4 in /tmp/test was not correct A| non-compliant test File ensure key value pa| /tmp/test Add key non existing options with value width=5 in /tmp/test was not correct
However, if the contents of the file are:
options color=blue height=4 width=99
the result becomes:
A| compliant test File ensure key value pa| /tmp/test Add key non existing options with value height=4 in /tmp/test was correct A| non-compliant test File ensure key value pa| /tmp/test Add key non existing options with value width=5 in /tmp/test was not correct
If the order of the methods that are defined in the technique is exchanged, the behavior is the exact opposite, so it seems that whichever method is listed first, if it fails, makes the status of the second method fail even if it should be successful.
Files
Updated by Hamlyn Mootoo over 7 years ago
More information:
After creating two DIFFERENT techniques, each having the same method, and creating 1 directive from each, the failure still occurs.
File contents:
options color=blue height=99 width=5
Result:
A| non-compliant test File ensure key value pa| /tmp/test Add key non existing options with value height=4 in /tmp/test was not correct
A| non-compliant test2 File ensure key value pa| /tmp/test Add key non existing options with value width=5 in /tmp/test was not correct
Updated by Janos Mattyasovszky over 7 years ago
This is probably the same as #10838
Updated by Janos Mattyasovszky over 7 years ago
- Is duplicate of Bug #10838: File content (Key/value pair) reports for all entries, even if only one changes added
Updated by Hamlyn Mootoo over 7 years ago
Although the cause might certainly be related to #10838 there is a subtle but distinct difference in behavior. In #10838, the first incorrect repair is signaled prior to evaluating the one that actually needs to be repaired. In this bug, the order definitely matters as only a prior negative (non-compliant) method status feeds through to the status of the second method. If the order is reversed (i.e. the first method's status is evaluated as successful), the second method is evaluated independently.
Updated by Janos Mattyasovszky over 7 years ago
The base problem is basically the same, that the reporting is only done on per-file basis, and not on per-key-in-file basis for the class file_ensure_key_value_${file}
, if the reporting could be make for more than one "composite keys" (like ${file}_${key}
), then each would could get a different report.
Updated by Hamlyn Mootoo over 7 years ago
Bug #10838 is related to method file_ensure_key_value, whereas this bug uses a different method, namely file_ensure_key_value_parameter_in_list.
Updated by Nicolas CHARLES over 6 years ago
- Status changed from New to Rejected
- Priority changed from 49 to 43
This has been fixed in https://www.rudder-project.org/redmine/issues/12414
Updated by Nicolas CHARLES over 6 years ago
- Is duplicate of User story #12414: Make reporting work when targeting several time the same item with several generic method added