Merge pull request #26 from anchore/issue-24

cmd: automatically detect distro based on img input
This commit is contained in:
Alfredo Deza 2020-06-19 07:50:36 -04:00 committed by GitHub
commit 905118a10c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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)