fix: Add cloud_network default and conditional networks 49/74049/1 master v0.18.1
authorAnil Belur <abelur@linuxfoundation.org>
Wed, 7 Jan 2026 12:52:05 +0000 (22:52 +1000)
committerAnil Belur <abelur@linuxfoundation.org>
Wed, 7 Jan 2026 12:52:05 +0000 (22:52 +1000)
commit39d2aaeb0e3cdb06ecfe828e17b00d2ed1da5cc3
tree45dff31d0e73e5449f2f7ba38eca70dd8b57907a
parent44247bece93e170d5393002c756a64b12a718b33
fix: Add cloud_network default and conditional networks

Fix packer validation error when cloud_network variable is not set.

Issue:
- builder.pkr.hcl: cloud_network variable had no default value
- Both templates: networks parameter required array, failed with null

Changes:
1. Added 'default = null' to cloud_network variable in builder.pkr.hcl
2. Made networks parameter conditional in both templates:
   - If cloud_network is null: networks = null (uses OpenStack default)
   - If cloud_network is set: networks = [cloud_network]

Error Fixed:
  Error: Unset variable "cloud_network"
  A used variable must be set or have a default value

Validation:
  packer validate -syntax-only templates/builder.pkr.hcl
  packer validate -syntax-only templates/docker.pkr.hcl
  Both pass successfully

Impact:
- Allows validation without cloud_network set
- Maintains backward compatibility when cloud_network is provided
- No functional change to actual builds (cloud_network provided at runtime)

Related: opendaylight/releng-builder validation failure

Change-Id: I0da5fa2b8decb71444e4066d3a82f79435aa8130
Signed-off-by: Anil Belur <askb23@gmail.com>
Signed-off-by: Anil Belur <abelur@linuxfoundation.org>
templates/builder.pkr.hcl
templates/docker.pkr.hcl