Fix: if condition to check file ext 22/73222/3 v0.90.10
authorAnil Belur <abelur@linuxfoundation.org>
Wed, 2 Oct 2024 13:19:28 +0000 (23:19 +1000)
committerAnil Belur <abelur@linuxfoundation.org>
Wed, 2 Oct 2024 21:35:15 +0000 (07:35 +1000)
Fix condition to check the file extension with packer build script.
The packer init steps gets skipped when the condition fails
with some filenames ex: mininet-ovs-2.8.pkr.hcl.

Issue: RELENG-5574
Change-Id: I91b3b6270c62ee3a2c8f28c25be22b408657d840
Signed-off-by: Anil Belur <abelur@linuxfoundation.org>
releasenotes/notes/fix-if-condition-791277d5b3aae6fe.yaml [new file with mode: 0644]
shell/packer-build.sh

diff --git a/releasenotes/notes/fix-if-condition-791277d5b3aae6fe.yaml b/releasenotes/notes/fix-if-condition-791277d5b3aae6fe.yaml
new file mode 100644 (file)
index 0000000..0e6a738
--- /dev/null
@@ -0,0 +1,5 @@
+---
+fixes:
+  - |
+    Fix condition that check the file extension with packer build script.
+    The condition is skipped when long names ex: mininet-ovs-2.8.pkr.hcl
index 7dd2434..3f58021 100644 (file)
@@ -53,7 +53,7 @@ export PACKER_LOG="yes"
 export PACKER_LOG_PATH="$PACKER_BUILD_LOG"
 
 # download plugins only for HCL format
-if [[ "${template_file#*.}" == "pkr.hcl" ]]; then
+if [[ "${template_file#*.}" =~ .*pkr.hcl ]]; then
     echo "packer init ${template_file} ..."
     packer.io init "${template_file}"
 fi