Skip to content

Commit

Permalink
node-agent: Drop fileExists func in favor of r.FS.Exists (#10096)
Browse files Browse the repository at this point in the history
  • Loading branch information
ialidzhikov authored Jul 10, 2024
1 parent df84098 commit e4f5e58
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions pkg/nodeagent/controller/operatingsystemconfig/reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ func (r *Reconciler) removeDeletedUnits(ctx context.Context, log logr.Logger, no
for _, unit := range units {
unitFilePath := path.Join(etcSystemdSystem, unit.Name)

unitFileExists, err := r.fileExists(unitFilePath)
unitFileExists, err := r.FS.Exists(unitFilePath)
if err != nil {
return fmt.Errorf("unable to check whether unit file %q exists: %w", unitFilePath, err)
}
Expand Down Expand Up @@ -399,13 +399,3 @@ func (r *Reconciler) executeUnitCommands(ctx context.Context, log logr.Logger, n

return mustRestartGardenerNodeAgent, flow.Parallel(fns...)(ctx)
}

func (r *Reconciler) fileExists(path string) (bool, error) {
if _, err := r.FS.Stat(path); err != nil {
if errors.Is(err, afero.ErrFileNotFound) {
return false, nil
}
return false, err
}
return true, nil
}

0 comments on commit e4f5e58

Please sign in to comment.