better handle skipped inventories
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2026-01-20 17:18:43 +11:00
parent 7ea02be91a
commit c8bb30c788
4 changed files with 32 additions and 14 deletions

View File

@@ -38,7 +38,7 @@ const fallbackEncryptionKey = "5L1l3B5KvwOCzUHMAlCgsgUTRAYMfSpa"
func main() {
settingsPath := flag.String("settings", "/etc/dtms/vctp.yml", "Path to settings YAML")
runInventoryOnce := flag.Bool("run-inventory", false, "Run a single inventory snapshot across all configured vCenters and exit")
runInventory := flag.Bool("run-inventory", false, "Run a single inventory snapshot across all configured vCenters and exit")
flag.Parse()
bootstrapLogger := log.New(log.LevelInfo, log.OutputText)
@@ -59,6 +59,8 @@ func main() {
)
s.Logger = logger
logger.Info("vCTP starting", "build_time", buildTime, "sha1_version", sha1ver, "go_version", runtime.Version(), "settings_file", *settingsPath)
// Configure database
dbDriver := strings.TrimSpace(s.Values.Settings.DatabaseDriver)
if dbDriver == "" {
@@ -181,7 +183,7 @@ func main() {
}
// One-shot mode: run a single inventory snapshot across all configured vCenters and exit.
if *runInventoryOnce {
if *runInventory {
logger.Info("Running one-shot inventory snapshot across all vCenters")
ct.RunVcenterSnapshotHourly(ctx, logger)
logger.Info("One-shot inventory snapshot complete; exiting")