Skip to content
This repository has been archived by the owner on Nov 8, 2022. It is now read-only.

Fixes #1614 - Protect cleanup code of plugin unload #1615

Merged
merged 1 commit into from
Apr 27, 2017

Conversation

rashmigottipati
Copy link
Contributor

Fixes #1614

Summary of changes:

  • Added checks before removing temp files where the plugin binaries reside.

Testing done:

  • Manual testing

@intelsdi-x/snap-maintainers

@@ -582,22 +590,32 @@ func (p *pluginManager) UnloadPlugin(pl core.Plugin) (*loadedPlugin, serror.Snap
"plugin-version": plugin.Version(),
"plugin-path": plugin.Details.Path,
}).Debugf("Removing plugin")
if err := os.RemoveAll(filepath.Dir(plugin.Details.Path)); err != nil {
if strings.Contains(plugin.Details.Path, p.tempDirPath) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

"plugin-path": plugin.Details.Path,
})
return nil, se
}).Info("Nothing to delete as temp path is empty")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's change this to a debug message.

Copy link
Collaborator

@jcooklin jcooklin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After changing the log message to debug this LTGM.

@rashmigottipati rashmigottipati merged commit 65090cf into intelsdi-x:master Apr 27, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants