Skip to content

Commit 496af91

Browse files
authored
fix(qemu): skip empty QEMU_NET_CIDR instead of erroring (#2568)
os.LookupEnv returns ok=true for an empty string. When QEMU_NET_CIDR is set to "" (e.g., via a build system that always sets the env var with a default empty value), the validator rejects it as "empty CIDR" and the build fails. Skip silently when the value is empty. Signed-off-by: jmeridth <jmeridth@gmail.com>
1 parent 65ed1ab commit 496af91

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

pkg/container/qemu_runner.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -806,7 +806,7 @@ func createMicroVM(ctx context.Context, cfg *Config) error {
806806
// The value must be a valid IPv4 CIDR. SLIRP automatically assigns the
807807
// gateway, DNS, and DHCP range based on the supplied network.
808808
// Example: QEMU_NET_CIDR="192.168.76.0/24"
809-
if netCIDR, ok := os.LookupEnv("QEMU_NET_CIDR"); ok {
809+
if netCIDR, ok := os.LookupEnv("QEMU_NET_CIDR"); ok && netCIDR != "" {
810810
cidr, err := parseAndValidateNetCIDR(netCIDR)
811811
if err != nil {
812812
return fmt.Errorf("invalid QEMU_NET_CIDR value %q: %w", netCIDR, err)

0 commit comments

Comments
 (0)