action #35377


dump-templates renders versions not always as string

Added by okurz about 6 years ago. Updated almost 5 years ago.

Target version:
Start date:
Due date:
% Done:


Estimated time:



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".


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 issues 1 (0 open1 closed)

Related to openSUSE Leap 15.0 - action #25032: enable openQA maintenance testingResolvedokurz2018-04-012018-04-19

Actions #1

Updated by okurz about 6 years ago

  • Related to action #25032: enable openQA maintenance testing added
Actions #2

Updated by coolo about 6 years ago

  • Target version set to Ready
Actions #3

Updated by mkittler almost 6 years ago

  • 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.

Actions #4

Updated by coolo almost 6 years ago

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

Actions #5

Updated by mkittler about 5 years ago

  • 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.

Actions #6

Updated by coolo almost 5 years ago

  • Target version changed from Ready to Done

Also available in: Atom PDF