MCPcopy Create free account
hub / github.com/devnullvoid/pvetui / parseQEMUAgentEnabled

Function parseQEMUAgentEnabled

pkg/api/vm_config.go:366–394  ·  view source on GitHub ↗
(raw interface{})

Source from the content-addressed store, hash-verified

364}
365
366func parseQEMUAgentEnabled(raw interface{}) bool {
367 switch v := raw.(type) {
368 case bool:
369 return v
370 case int:
371 return v != 0
372 case float64:
373 return v != 0
374 case string:
375 normalized := strings.TrimSpace(strings.ToLower(v))
376 if normalized == "1" || normalized == stringYes || normalized == StringTrue {
377 return true
378 }
379 if normalized == "0" || normalized == "no" || normalized == "false" {
380 return false
381 }
382
383 parts := strings.Split(normalized, ",")
384 for _, part := range parts {
385 kv := strings.SplitN(strings.TrimSpace(part), "=", 2)
386 if len(kv) != 2 || kv[0] != "enabled" {
387 continue
388 }
389 return kv[1] == "1" || kv[1] == stringYes || kv[1] == StringTrue
390 }
391 }
392
393 return false
394}

Callers 2

parseVMConfigFunction · 0.85

Calls

no outgoing calls

Tested by 1