-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sync up cli references Signed-off-by: ldelossa <ldelossa@redhat.com>
- Loading branch information
Showing
3 changed files
with
104 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package config | ||
|
||
import ( | ||
"github.com/quay/claircore/libvuln/driver" | ||
"gopkg.in/yaml.v3" | ||
) | ||
|
||
// Updaters configures updater behavior. | ||
type Updaters struct { | ||
// A slice of strings representing which | ||
// updaters will be used. | ||
// | ||
// If nil all default UpdaterSets will be used | ||
// | ||
// The following sets are supported by default: | ||
// "alpine" | ||
// "aws" | ||
// "debian" | ||
// "oracle" | ||
// "photon" | ||
// "pyupio" | ||
// "rhel" | ||
// "suse" | ||
// "ubuntu" | ||
Sets []string `yaml:"sets,omitempty" json:"sets,omitempty"` | ||
// Config holds configuration blocks for UpdaterFactories and Updaters, | ||
// keyed by name. | ||
// | ||
// These are defined by the updater implementation and can't be documented | ||
// here. Improving the documentation for these is an open issue. | ||
Config map[string]yaml.Node `yaml:"config" json:"config"` | ||
// Filter is a regexp that disallows updaters that do not match from | ||
// running. | ||
// TODO(louis): this is only used in clairctl, should we keep this? | ||
// it may offer an escape hatch for a particular updater name | ||
// from running, vs disabling the updater set completely. | ||
Filter string `yaml:"filter" json:"filter"` | ||
} | ||
|
||
func (u *Updaters) FilterSets(m map[string]driver.UpdaterSetFactory) { | ||
if u.Sets != nil { | ||
Outer: | ||
for k := range m { | ||
for _, n := range u.Sets { | ||
if k == n { | ||
continue Outer | ||
} | ||
} | ||
delete(m, k) | ||
} | ||
} | ||
return | ||
} |