Skip to content

Commit

Permalink
initialize: wire up DisableUpdaters option
Browse files Browse the repository at this point in the history
This should prevent all updaters from even being constructed in
claircore.

Fixes PROJQUAY-1759.

Signed-off-by: Hank Donnay <hdonnay@redhat.com>
  • Loading branch information
hdonnay committed Mar 19, 2021
1 parent a844fb2 commit 7c4787b
Showing 1 changed file with 22 additions and 12 deletions.
34 changes: 22 additions & 12 deletions initialize/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,18 @@ func (i *Init) Services() error {
for name, node := range i.conf.Updaters.Config {
updaterConfigs[name] = node.Decode
}
sets := i.conf.Updaters.Sets
if i.conf.Matcher.DisableUpdaters {
sets = []string{}
}
libV, err := libvuln.New(i.GlobalCTX, &libvuln.Opts{
MaxConnPool: int32(i.conf.Matcher.MaxConnPool),
ConnString: i.conf.Matcher.ConnString,
Migrations: i.conf.Matcher.Migrations,
UpdaterSets: i.conf.Updaters.Sets,
UpdateInterval: per,
UpdaterConfigs: updaterConfigs,
MaxConnPool: int32(i.conf.Matcher.MaxConnPool),
ConnString: i.conf.Matcher.ConnString,
Migrations: i.conf.Matcher.Migrations,
UpdaterSets: sets,
UpdateInterval: per,
UpdaterConfigs: updaterConfigs,
DisableBackgroundUpdates: i.conf.Matcher.DisableUpdaters,
})
if err != nil {
return fmt.Errorf("failed to initialize libvuln: %v", err)
Expand Down Expand Up @@ -168,14 +173,19 @@ func (i *Init) Services() error {
for name, node := range i.conf.Updaters.Config {
updaterConfigs[name] = node.Decode
}
sets := i.conf.Updaters.Sets
if i.conf.Matcher.DisableUpdaters {
sets = []string{}
}
// configure a local matcher but a remote indexer
libV, err := libvuln.New(i.GlobalCTX, &libvuln.Opts{
MaxConnPool: int32(i.conf.Matcher.MaxConnPool),
ConnString: i.conf.Matcher.ConnString,
Migrations: i.conf.Matcher.Migrations,
UpdaterSets: i.conf.Updaters.Sets,
UpdateInterval: per,
UpdaterConfigs: updaterConfigs,
MaxConnPool: int32(i.conf.Matcher.MaxConnPool),
ConnString: i.conf.Matcher.ConnString,
Migrations: i.conf.Matcher.Migrations,
UpdaterSets: sets,
UpdateInterval: per,
UpdaterConfigs: updaterConfigs,
DisableBackgroundUpdates: i.conf.Matcher.DisableUpdaters,
})
if err != nil {
return fmt.Errorf("failed to initialize libvuln: %v", err)
Expand Down

0 comments on commit 7c4787b

Please sign in to comment.