Skip to content

Commit 366f936

Browse files
peter-bodendupondje
authored andcommitted
core: fix NPE in CreateOvaCommand
Prevent failure of ova export when tpm or nvram value are `null`. Signed-off-by: Peter Boden <[email protected]>
1 parent c036868 commit 366f936

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CreateOvaCommand.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,8 +207,12 @@ private AnsibleCommandParameters createPackOvaParameters(String ovf,
207207
vars.put("ova_name", getParameters().getName());
208208
vars.put("ovirt_ova_pack_ovf", encodedOvf);
209209
vars.put("ovirt_ova_pack_disks", genDiskParameters(disks, diskIdToPath));
210-
vars.put("ovirt_ova_pack_tpm", tpmData.getValue());
211-
vars.put("ovirt_ova_pack_nvram", nvramData.getValue());
210+
if (!SecretValue.isNull(tpmData) && !tpmData.getValue().isEmpty()) {
211+
vars.put("ovirt_ova_pack_tpm", tpmData.getValue());
212+
}
213+
if (!SecretValue.isNull(nvramData) && !nvramData.getValue().isEmpty()) {
214+
vars.put("ovirt_ova_pack_nvram", nvramData.getValue());
215+
}
212216
vars.put("ovirt_ova_pack_padding", Boolean.toString(compatibilityVersion.greater(Version.v4_6)));
213217
params.setVariables(vars);
214218
return params;

0 commit comments

Comments
 (0)