action #35377

dump-templates renders versions not always as string

Added by okurz almost 2 years ago. Updated 9 months ago.

Status:RejectedStart date:23/04/2018
Priority:LowDue date:
Assignee:-% Done:

0%

Category:Concrete Bugs
Target version:Done
Difficulty:
Duration:

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 issues

Related to openSUSE Leap 15.0 - action #25032: enable openQA maintenance testing Resolved 01/04/2018 19/04/2018

History

#1 Updated by okurz almost 2 years ago

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

#2 Updated by coolo almost 2 years ago

  • Target version set to Ready

#3 Updated by mkittler almost 2 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.

#4 Updated by coolo almost 2 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

#5 Updated by mkittler 10 months 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.

#6 Updated by coolo 9 months ago

  • Target version changed from Ready to Done

Also available in: Atom PDF