mirror of
https://github.com/anchore/grype
synced 2024-11-10 06:34:13 +00:00
cmd: automatically detect distro based on img input
Signed-off-by: Alfredo Deza <adeza@anchore.com>
This commit is contained in:
parent
e531f28e46
commit
7f00f5c945
1 changed files with 7 additions and 4 deletions
11
cmd/root.go
11
cmd/root.go
|
@ -76,14 +76,17 @@ func runDefaultCmd(_ *cobra.Command, args []string) int {
|
|||
return 1
|
||||
}
|
||||
|
||||
// TODO: remove me (replace with imgbom os.Identify call)
|
||||
|
||||
osObj, _ := _distro.NewDistro(_distro.Debian, "8")
|
||||
osObj := _distro.Identify(img)
|
||||
if osObj == nil {
|
||||
// prevent moving forward with unknown distros for now, revisit later
|
||||
log.Error("unable to detect distro type for accurate vulnerability matching")
|
||||
return 1
|
||||
}
|
||||
|
||||
store := db.GetStore()
|
||||
provider := vulnerability.NewProviderFromStore(store)
|
||||
|
||||
results := vulnscan.FindAllVulnerabilities(provider, osObj, catalog)
|
||||
results := vulnscan.FindAllVulnerabilities(provider, *osObj, catalog)
|
||||
outputOption := viper.GetString("output")
|
||||
|
||||
presenterType := presenter.ParseOption(outputOption)
|
||||
|
|
Loading…
Reference in a new issue