Remove empty strings from AutoYaST values#3302
Conversation
4f175dd to
5585063
Compare
5585063 to
4a0d5db
Compare
| new_value = clean_value(value) | ||
| all[key] = new_value unless new_value.nil? | ||
| end | ||
| new_hash unless new_hash.empty? |
There was a problem hiding this comment.
if my internal parser works correctly this leads to filtering the key / value pair out in clean_profile so in general empty hashes are not converted. I'm fine with that but do not understand why the same doesn't happen for arrays (clean_array doesn't care about empty arrays)
There was a problem hiding this comment.
Because an empty array can be used to remove some predefined (like a list of subvolumes).
There was a problem hiding this comment.
that is already covered by not doing filtering on storage section at all, isn't it? Any other example? I'm just curious.
There was a problem hiding this comment.
That's the point. I am not 100% sure if it happens in any other place. So I prefer to be conservative.
There was a problem hiding this comment.
Having said that, we could change that, but for sure not now (it needs further testing and we are already late :-)).
| # | ||
| # @param profile [Hash] | ||
| # @return [Hash] | ||
| def clean_profile(profile) |
There was a problem hiding this comment.
NP: in theory there is place for de-duplication ... the profile is implemented as a Hash ... so clean_profile and clean_hash are kind of duplicates (I'm aware of that "partitioning" condition)
There was a problem hiding this comment.
I mean in theory clean_profile is something like:
clean_hash(profile.except("partitioning")).merge(profile["partitioning"])
or something like that
There was a problem hiding this comment.
Well, that code will crash (as profile["partitioning"] could be nil), but I get the idea. However, you still need some place to implement that logic. Not to mention that we would like to avoid hashes that turn into nil (because they are empty).
Prepare to release version 20. * #3294 * #3295 * #3296 * #3297 * #3298 * #3299 * #3300 * #3301 * #3302 * #3303 * #3304 * #3305 * #3306 * #3307 * #3308 * #3309 * #3310 * #3311 * #3312 * #3313 * #3315 * #3316 * #3317 * #3318 * #3319 * #3320 * #3322 * #3323 * #3325 * #3326 * #3327 * #3329 * #3330 * #3331 * #3333 * #3334 * #3336 * #3338 * #3339 * #3342 * #3343 * #3349 * #3351 * #3352 * #3353 * #3354 * #3356 * #3357 * #3358 * #3359 * #3360 * #3361 * #3362 * #3363 * #3364 * #3365 * #3366 * #3367 * #3368 * #3371 * #3372 * #3373 * #3375 * #3376 * #3378 * #3379 * #3380 * #3381 * #3382 * #3385 * #3386
It is really uncommon to use empty strings as values in AutoYaST. Those values are not a problem in AutoYaST, but they can cause problems in Agama. For instance, an empty element is ignored in AutoYaST, but not in Agama.
In order to make the migration from AutoYaST to Agama easier, the conversion removes empty string values. The exception is the section, which is handled by yast2-storage-ng. Actually, this section contains the <subvolumes_prefix />, which can be set to an empty string as described in the AutoYaST documentation.