OVA post-processor is broken
johananl opened this issue · 3 comments
What steps did you take and what happened:
Run make build-node-ova-vsphere-ubuntu-2004
(or any other OVA build) against some vSphere environment. After the image is built on vSphere and a VMDK file is downloaded, the Packer post-processor named vsphere
fails with the following error:
==> vsphere: Running post-processor: packer-manifest (type manifest)
==> vsphere: Running post-processor: vsphere (type shell-local)
==> vsphere (shell-local): Running local shell script: /tmp/packer-shell294747125
vsphere (shell-local): image-build-ova: cd .
vsphere (shell-local): image-build-ova: loaded ubuntu-2004-kube-v1.24.2
vsphere (shell-local): image-build-ova: create ovf ubuntu-2004-kube-v1.24.2.ovf
==> vsphere (shell-local): Traceback (most recent call last):
==> vsphere (shell-local): File "../../hack/image-build-ova.py", line 270, in <module>
==> vsphere (shell-local): main()
==> vsphere (shell-local): File "../../hack/image-build-ova.py", line 182, in main
==> vsphere (shell-local): create_ovf(ovf, data, ovf_template)
==> vsphere (shell-local): File "../../hack/image-build-ova.py", line 232, in create_ovf
==> vsphere (shell-local): f.write(Template(ovf_template).substitute(data))
==> vsphere (shell-local): File "/usr/lib/python3.8/string.py", line 126, in substitute
==> vsphere (shell-local): return self.pattern.sub(convert, self.template)
==> vsphere (shell-local): File "/usr/lib/python3.8/string.py", line 119, in convert
==> vsphere (shell-local): return str(mapping[named])
==> vsphere (shell-local): KeyError: 'CUSTOM_ROLE'
==> vsphere: Running post-processor: custom-post-processor (type shell-local)
==> vsphere (shell-local): Running local shell script: /tmp/packer-shell3160150536
Build 'vsphere' errored after 1 hour 3 minutes: 1 error(s) occurred:
* Post-processor failed: Script exited with non-zero exit status: 1.Allowed exit codes are: [0]
==> Wait completed after 1 hour 3 minutes
==> Some builds didn't complete successfully and had errors:
--> vsphere: 1 error(s) occurred:
* Post-processor failed: Script exited with non-zero exit status: 1.Allowed exit codes are: [0]
==> Builds finished but no artifacts were created.
make: *** [Makefile:360: build-node-ova-vsphere-ubuntu-2004] Error 1
What did you expect to happen:
I expected the post-processor to exit cleanly.
Anything else you would like to add:
The issue seems to be in images/capi/hack/image-build-ova.py
. On line 232 we're trying to template ovf_template.xml
which references a variable named ${CUSTOM_ROLE}
with a dict which doesn't have this key:
image-builder/images/capi/hack/image-build-ova.py
Lines 119 to 139 in 0bb5cd6
Environment:
Project (Image Builder for Cluster API, kube-deploy/imagebuilder, konfigadm): image-builder
Additional info for Image Builder for Cluster API related issues:
- OS (e.g. from
/etc/os-release
, orcmd /c ver
):Ubuntu 20.04 LTS
- Packer Version:
1.8.0
- Packer Provider:
vsphere-iso
- Ansible Version: n/a
- Cluster-api version (if using): n/a
- Kubernetes version: (use
kubectl version
): n/a
/kind bug
/assign