Skip to content

Commit

Permalink
Ensure that driver exclusion information is populated before updates …
Browse files Browse the repository at this point in the history
…are installed. Move the setting of driver exclusion outside the enforce function as it doesn't involve any actual enforcement.

PiperOrigin-RevId: 617961773
  • Loading branch information
Cabbie Team authored and copybara-github committed Mar 21, 2024
1 parent 6adecfa commit a962f1f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
10 changes: 9 additions & 1 deletion cabbie.go
Original file line number Diff line number Diff line change
Expand Up @@ -308,10 +308,18 @@ func enforce() error {
deck.ErrorA(failures).With(eventID(cablib.EvtErrHide)).Go()
}
}
excludedDrivers.set(updates.ExcludedDrivers)
return failures
}

func initDriverExclusion() error {
updates, err := enforcement.Get()
if err != nil {
return fmt.Errorf("error retrieving required updates: %v", err)
}
excludedDrivers.set(updates.ExcludedDrivers)
return nil
}

func runMainLoop() error {
if err := notification.CleanNotifications(cablib.SvcName); err != nil {
deck.ErrorfA("Error clearing old notifications:\n%v", err).With(eventID(cablib.EvtErrNotifications)).Go()
Expand Down
3 changes: 3 additions & 0 deletions install.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,9 @@ func (i *installCmd) installUpdates() error {
installingMinOneUpdate := false

kbs := NewKBSet(i.kbs)
if err := initDriverExclusion(); err != nil {
deck.ErrorfA("Error initializing driver exclusions:\n%v", err).With(eventID(cablib.EvtErrDriverExclusion)).Go()
}
excludes := excludedDrivers.get()
outerLoop:
for _, u := range uc.Updates {
Expand Down

0 comments on commit a962f1f

Please sign in to comment.