Clean the local cache of downloaded packages if it already exists
@@ -117,8 +117,12 @@ public class FunctionActioner implements AutoCloseable {
pkgDir,
new File(FunctionDetailsUtils.getDownloadFileName(functionMetaData.getFunctionDetails())).getName());
- if (!pkgFile.exists()) {
- // download only when the package file doesn't exist
+ if (pkgFile.exists()) {
+ log.warn("Function package exists already {} deleting it",
+ pkgFile);
+ pkgFile.delete();
+ }
+
File tempPkgFile;
while (true) {
tempPkgFile = new File(
@@ -152,7 +156,6 @@ public class FunctionActioner implements AutoCloseable {
} finally {
tempPkgFile.delete();
}
- }
InstanceConfig instanceConfig = new InstanceConfig();
instanceConfig.setFunctionDetails(functionMetaData.getFunctionDetails());
