action #35377
closed
dump-templates renders versions not always as string
Added by okurz over 6 years ago.
Updated over 5 years ago.
Category:
Regressions/Crashes
Description
Observation¶
Using the command specified in #25032#note-8 openqa-dump-templates
creates output with format version => 42.3,
which I converted with sed into version => 15.0,
which I consequently loaded with openqa-load-templates
causing a medium with version "15" to be generated instead of the expected "15.0".
Problem¶
I assume that openqa-dump-templates outputs the float values as invalid number or openqa-load-templates is the culprit not parsing that token correctly.
- Related to action #25032: enable openQA maintenance testing added
- Target version set to Ready
- Subject changed from dump-templates outputs invalid float numbers to dump-templates renders versions not always as string
- Priority changed from Normal to Low
The version is a string and not a float in the openQA database. This should actually help to preserve the exact format. For some reason the dump-templates renders the version as number, though.
That shouldn't prevent you from passing a string. I just tried your command with sed -e 's/version.*=>.*42\.3/version => "15.0"/g'
and the .0
is preserved. If you then dump again, you'll see that even openqa-dump-templates
now renders the version as string. So export/import using the scripts shouldn't cause any data loss.
If we're lazy we can just say fix the way you're invoking the script to pass the value as string (just change the sed command like I've just did). If we like consistency we can fix openqa-dump-templates
to always render the version as string. Not that important in my opinion.
the problem was less that dump-template rendered 42.3 as number. The problem was more that load-templates parsed 15.0 as 15. To avoid that it should be strings
- Status changed from New to Rejected
The problem was more that load-templates parsed 15.0 as 15.
But as I said in the previous comment: If one passes a string to openqa-load-templates
it will preserve that string. One just has to use a string literal and not a number literal. The only problem I see is that the command from @okurz was using a number literal. I also don't think it is possible to fix this easily without writing our own JSON parser which would interpret certain number literals as strings.
The only thing left to improve would be rendering the version via dump-template
always as a string. But as @coolo says that was less the problem.
So I'd say rejected unless anybody disagrees.
- Target version changed from Ready to Done
Also available in: Atom
PDF