@@ -39,6 +39,10 @@ func (m *PluginManager) retryFailedRemovals(ctx context.Context) (bool, error) {
3939 pluginInstallLoc := filepath .Join (baseState (), pluginInstallDir )
4040 pluginDirs , err := os .ReadDir (pluginInstallLoc )
4141 if err != nil {
42+ if errors .Is (err , os .ErrNotExist ) {
43+ galog .V (1 ).Debugf ("Plugin install directory %q does not exist, nothing to clean up" , pluginInstallLoc )
44+ return true , nil
45+ }
4246 return true , fmt .Errorf ("failed to read plugin install directory: %w" , err )
4347 }
4448
@@ -58,7 +62,7 @@ func (m *PluginManager) retryFailedRemovals(ctx context.Context) (bool, error) {
5862 nameIndex := strings .LastIndex (p .Name (), "_" )
5963 pluginName := p .Name ()[:nameIndex ]
6064 pluginRevision := p .Name ()[nameIndex + 1 :]
61- galog .Debugf ("Checking plugin %q, revision %q" , pluginName , pluginRevision )
65+ galog .V ( 1 ). Debugf ("Checking plugin %q, revision %q" , pluginName , pluginRevision )
6266 // We want to avoid cleaning up plugins that currently have a request in progress.
6367 // This is to prevent a race condition where the plugin is removed in the
6468 // middle of an installation request.
@@ -81,10 +85,10 @@ func (m *PluginManager) retryFailedRemovals(ctx context.Context) (bool, error) {
8185 }
8286 // Check if the link points to a plugin directory that is no longer cached
8387 // by the guest agent.
84- galog .Debugf ("Checking link %q" , link )
88+ galog .V ( 1 ). Debugf ("Checking link %q" , link )
8589 if _ , ok := failedRemovals [filepath .Base (dest )]; ok {
8690 linkPath := filepath .Join (pluginInstallLoc , link )
87- galog .Debugf ("Removing link %q" , linkPath )
91+ galog .V ( 1 ). Debugf ("Removing link %q" , linkPath )
8892 if err := os .Remove (linkPath ); err != nil {
8993 galog .Debugf ("Unable to remove link %q: %v" , linkPath , err )
9094 }
0 commit comments