-
-
Notifications
You must be signed in to change notification settings - Fork 291
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix yaml hashtag handling from config panel's custom getter #2016
base: dev
Are you sure you want to change the base?
Fix yaml hashtag handling from config panel's custom getter #2016
Conversation
Eeeeh I'm not sure that's an appropriate fix though, because the point is that custom getters are supposed to be able to return yaml, for example as in : https://github.com/YunoHost-Apps/vpnclient_ynh/blob/master/scripts/config#L49 So wrapping the result in quote is gonna makes this case explode As far as I understand, the edge case for hex color code is sort of a "feature" because, well, it starts with To me the fix is that the custom getter should return the color code wrapped in quote to disambiguate from it being a comment |
OK, I hadn't that case in mind.
That's what I've done for now and I don't mind so much if it is becomes permanent, although it feels a bit of a hack.
Maybe the issue is that point, i.e. that in practice getters return either litteral yaml (as in the example you give), or values that are kind of turned into yaml via the Popen constructor used in In the case of fontcompare_ynh,
before going through
Another idea for a general fix would be to use a regex to identify values in |
We could create a helper to help packager ?
Note that However, I am not sure it's a good idea to add double quote in the value, cause this value could be used by other part of the code of the script config (like validators or setter...). And thinking this, i think i discover a bug with yaml complex data structure in getter: https://github.com/YunoHost/yunohost/blob/dev/helpers/helpers.v2.1.d/config#L216 : the settings seems to be considered as changed everytime /o... BUT it's an other bug. An other way could be to declare properly if the return is a composite yaml or a single value. For example, |
The problem
Cf. Point 1 there: YunoHost/issues#2501
Solution
Add quotes to the getter ouput so that
read_yaml
does not read#
as a comment sign.PR Status
Tested successfully with fontcompare_ynh.
I also tried to run
yunohost app config get $app --full --debug
with a few other apps (including borg_ynh which has some custom getters defined, and YAML output looked clean for each of them (additional quotes did not seem to break anything).How to test
Before the fix:
yunohost app config get fontcompare --full --debug
will showNone
as values forbackground_color
andfont_color
.After the fix:
yunohost app config get fontcompare --full --debug
will show#{HTML_COLOR_CODE}
as values forbackground_color
andfont_color
.