Bug #12616
closed
${const.dollar} in generic method parameter leads to missing report
Added by François ARMAND over 6 years ago.
Updated over 6 years ago.
Category:
Web - Compliance & node report
Description
The following parameter on generic method "command_execution_result" leads to a missing:
[ ${const.dollar}(touch /tmp/constdollar && echo "enabled") = 'enabled' ]
I'm not sure what started it, but at some point, I also got an unexpected which make sense:
[ $(touch /tmp/constdollar && echo "enabled") = 'enabled' ] Unexpected
[ ${const.dollar}(touch /tmp/constdollar && echo "enabled") = 'enabled' ] Missing
At least that means that we don't escape correctly the expected report in Rudder side or that the agent send the expanded value where it should not.
I'm not sure what/where to correct that. On the one hand, it seems that the agent should send back the actual value. On the other hand, we are already doing a match on Rudder side between the value we saved as "expected" and the actual agent value, with for ex. variable replaced agent side.
Actually, what we really want is a report id, unique at component value level (with added rules to know if the value actually matches, and the mutliplicity of the reports in the case of a list being processed agent side).
So I propose to add a matching rule in Rudder server for `${const.dollar} == $`
- Status changed from New to In progress
- Assignee set to François ARMAND
There is something strange with "\" matching in the corresponding code.
In fact, the problem is not with the escape of ${const.dollar}, but with the incorrect escape of regex chars in the value. So () is interpreted as regex char, and are not used in the matches. We need to correctly escape them.
- Status changed from In progress to Pending technical review
- Assignee changed from François ARMAND to Vincent MEMBRÉ
- Pull Request set to https://github.com/Normation/rudder/pull/1930
The "\" thing was most likely to avoid having "\x" sequence being interpreted as a regex character classes. It was not sufficient at all to avoid problems, and it is not necessary anymore with correct quotation.
- Assignee changed from Vincent MEMBRÉ to François ARMAND
- Status changed from Pending technical review to Pending release
- Status changed from Pending release to Released
This bug has been fixed in Rudder 4.1.12, 4.2.6 and 4.3.1 which were released today.
Also available in: Atom
PDF