mirror of
https://github.com/anchore/grype
synced 2024-11-10 06:34:13 +00:00
Merge pull request #26 from anchore/issue-24
cmd: automatically detect distro based on img input
This commit is contained in:
commit
905118a10c
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