Damans227 commented on code in PR #13592:
URL: https://github.com/apache/cloudstack/pull/13592#discussion_r3614785298
##########
plugins/integrations/kubernetes-service/src/main/java/com/cloud/kubernetes/cluster/actionworkers/KubernetesClusterActionWorker.java:
##########
@@ -761,6 +761,25 @@ protected void copyScriptFile(String nodeAddress, final
int sshPort, File file,
}
}
+ /**
+ * Deletes the local temporary copies of the scripts created by {@link
#retrieveScriptFiles()}
+ * once they have been copied to the cluster node(s). Without this, every
deploy/autoscale/PV-cleanup
+ * action leaks a *.sh file in the management server's tmp directory.
+ */
+ protected void cleanupScriptFiles() {
+ deleteScriptFileQuietly(deploySecretsScriptFile);
+ deleteScriptFileQuietly(deployProviderScriptFile);
+ deleteScriptFileQuietly(deployCsiDriverScriptFile);
+ deleteScriptFileQuietly(deletePvScriptFile);
+ deleteScriptFileQuietly(autoscaleScriptFile);
+ }
+
+ protected void deleteScriptFileQuietly(File file) {
Review Comment:
Should the field be set to null after deleting? Right now it still points to
a file that no longer exists. If it's used again before `retrieveScriptFiles()`
runs, it could silently try to work with a deleted file.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]