Can’t remove a file with a comma in its name from collection
If you want to configure insights-core to remove a file from collection, it’s not possible if the filename contains a , comma. The reason is there when a configuration file is parsed, the value of the remove key is split by a comma and each fragment is treated as a separate filename. See https://github.com/RedHatInsights/insights-core/blob/39643a8c72bb89cf84fa4501988dad1abb6a8fb7/insights/client/collection_rules.py#L181
This can be resolved either by escaping or by allowing to set the value as some kind of array.
@Glutexo @miclark I guess the , is to remove multiple files at a time and to treat all files as separate we are splitting the names by ,. Will it be better to constrict naming files so that there should be no , in a file name?, or we can also clean file names consisting of , so that there is no , at all in any file name. Please let me know so that I can try solving this issue.
Hey, @ritwik12, thanks for getting to this!
I think that there are two ways to do this properly:
- Introduce some escaping so that the names could be split unambigously. It won’t be as easy as
str.split(',') though. - Change the specs of the config file to this value can provide an array of values instead of a single string.
I like the array-approach more. Still it’s necessary to keep the compatibility. All current config files (even though they don’t support all filenames) must remain working. Also please note that a UNIX filename can contain virtually anything except a slash and a null character.
Maybe @gravitypriest has some thoughts on this?
The headaches of remove.conf are endless. I've been working through a similar issue recently. Comma separation was an implementation decision in 2014, and it's evident now that it's insufficient for our needs. Simply put, remove.conf needs an overhaul. I'm thinking the new format will be something like a YAML doc. It's a non-trivial amount of work but this feature needs to be reworked and the current method should be deprecated.