diff --git a/apps/cnquery/cmd/scan.go b/apps/cnquery/cmd/scan.go index e8334ccf5a..945f0958f3 100644 --- a/apps/cnquery/cmd/scan.go +++ b/apps/cnquery/cmd/scan.go @@ -31,8 +31,18 @@ func init() { scanCmd.Flags().String("platform-id", "", "Select a specific target asset by providing its platform ID.") scanCmd.Flags().String("inventory-file", "", "Set the path to the inventory file.") + + scanCmd.Flags().Bool("inventory-format-ansible", false, "Set the inventory format to Ansible.") + // "inventory-ansible" is deprecated, use "inventory-format-ansible" instead scanCmd.Flags().Bool("inventory-ansible", false, "Set the inventory format to Ansible.") + scanCmd.Flags().MarkDeprecated("inventory-ansible", "use --inventory-format-ansible") + scanCmd.Flags().MarkHidden("inventory-ansible") + + scanCmd.Flags().Bool("inventory-format-domainlist", false, "Set the inventory format to domain list.") + // "inventory-domainlist" is deprecated, use "inventory-format-domainlist" instead scanCmd.Flags().Bool("inventory-domainlist", false, "Set the inventory format to domain list.") + scanCmd.Flags().MarkDeprecated("inventory-domainlist", "use --inventory-format-domainlist") + scanCmd.Flags().MarkHidden("inventory-domainlist") // bundles, packs & incognito mode scanCmd.Flags().Bool("incognito", false, "Run in incognito mode. Do not report scan results to Mondoo Platform.") diff --git a/cli/inventoryloader/inventory.go b/cli/inventoryloader/inventory.go index a4f35b3561..e70b585aab 100644 --- a/cli/inventoryloader/inventory.go +++ b/cli/inventoryloader/inventory.go @@ -81,7 +81,7 @@ func Parse() (*inventory.Inventory, error) { } // force detection - if viper.GetBool("inventory-ansible") { + if viper.GetBool("inventory-format-ansible") || viper.GetBool("inventory-ansible") { log.Debug().Msg("parse ansible inventory") inventory, err := parseAnsibleInventory(data) if err != nil { @@ -90,7 +90,7 @@ func Parse() (*inventory.Inventory, error) { return inventory, nil } - if viper.GetBool("inventory-domainlist") { + if viper.GetBool("inventory-format-domainlist") || viper.GetBool("inventory-domainlist") { log.Debug().Msg("parse domainlist inventory") inventory, err := parseDomainListInventory(data) if err != nil { @@ -119,6 +119,7 @@ func Parse() (*inventory.Inventory, error) { } func parseAnsibleInventory(data []byte) (*inventory.Inventory, error) { + log.Info().Msg("use ansible inventory") inventory, err := ansibleinventory.Parse(data) if err != nil { return nil, err @@ -127,6 +128,7 @@ func parseAnsibleInventory(data []byte) (*inventory.Inventory, error) { } func parseDomainListInventory(data []byte) (*inventory.Inventory, error) { + log.Info().Msg("use domainlist inventory") inventory, err := domainlist.Parse(bytes.NewReader(data)) if err != nil { return nil, err