action #80662
closeduninitialized value in string eq at .../load_templates line 137
Description
In a local openQA instance, still managed with templates.json
I inadvertently saved as YAML the PowerPC job group via openQA UI.
On subsequent use of load_templates there was an unexpected "uninitialized value in string" error.
$/usr/share/openqa/script/load_templates --clean /tmp/mytemplate.json
...
Use of uninitialized value in string eq at /usr/share/openqa/script/load_templates line 137.
Bad Request: Group Fedora PowerPC must be updated through the YAML template at /usr/share/openqa/script/load_templates line 139.
1- I do not understand what is wrong with "reftype $json_err eq 'ARRAY';"
https://github.com/os-autoinst/openQA/blob/master/script/load_templates#L137
2- Is there a way to clean my openQA local instance to remove the yaml saved data to be able to continue to use json templates ?
Updated by michel_mno almost 4 years ago
proposed patch:
$diff -u /usr/share/openqa/script/load_templates.ref20201201 /usr/share/openqa/script/load_templates
--- /usr/share/openqa/script/load_templates.ref20201201 2020-08-07 22:54:00.000000000 +0200
+++ /usr/share/openqa/script/load_templates 2020-12-02 15:33:23.743520132 +0100
@@ -135,7 +135,7 @@
if (my $json = $res->json) {
if (my $json_err = $json->{error}) {
die "$err->{message}: " . join("\n", @{$json_err})
- if reftype $json_err eq 'ARRAY';
+ if reftype $json_err // '' eq 'ARRAY';
die "$err->{message}: $json_err";
}
}
Updated by livdywan almost 4 years ago
What did you use for /tmp/mytemplate.json
?
I wonder how $json_err
could even be undefined here, within the if. But the unit test for load_templates
is pretty basic so it probbly doesn't cover this case.
Updated by mkittler almost 4 years ago
But reftype $json_err
might be undef
. I would suggest to simply use ref
here instead. It will return an empty string if $json_err
is not a reference.
It would look like this: https://github.com/os-autoinst/openQA/pull/3615
Updated by okurz almost 4 years ago
- Category set to Regressions/Crashes
- Status changed from New to Feedback
- Assignee set to mkittler
- Target version set to Ready
https://github.com/os-autoinst/openQA/pull/3615 looks good and should as an alternative cover what was proposed in #80662#note-1 . It's merged. The next openSUSE package from devel:openQA should have that fix included.
@michel_mno please let us know if the above code change fixes the problem for you or if this just leads us to any underlying further problem.
Updated by michel_mno almost 4 years ago
- Status changed from Feedback to Resolved
okurz wrote:
https://github.com/os-autoinst/openQA/pull/3615 looks good and should as an alternative cover what was proposed in #80662#note-1 . It's merged. The next openSUSE package from devel:openQA should have that fix included.
@michel_mno please let us know if the above code change fixes the problem for you or if this just leads us to any underlying further problem.
I confirm pr#3615 code change is fixing my problem.
$/usr/share/openqa/script/load_templates --clean /tmp/templates.json >/tmp/x2
Bad Request: Group Fedora PowerPC must be updated through the YAML template at /usr/share/openqa/script/load_templates line 138.
so change status to resolved.