Skip to content

Commit

Permalink
put cleanupTempFiles in a finally block for all plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
ltamaster committed Mar 19, 2024
1 parent 3fc42c9 commit 28f42dc
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,10 @@ public void executeStep(PluginStepContext context, Map<String, Object> configura
throw new StepException(e.getMessage(), e, e.getFailureReason());
} catch (Exception e) {
throw new StepException(e.getMessage(), e, AnsibleException.AnsibleFailureReason.AnsibleError);
}finally {
contextBuilder.cleanupTempFiles();
}

contextBuilder.cleanupTempFiles();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,10 +178,10 @@ public NodeExecutorResult executeCommand(ExecutionContext context, String[] comm
runner.run();
} catch (Exception e) {
return NodeExecutorResultImpl.createFailure(AnsibleException.AnsibleFailureReason.AnsibleError, e.getMessage(), node);
}finally {
contextBuilder.cleanupTempFiles();
}

contextBuilder.cleanupTempFiles();

return NodeExecutorResultImpl.createSuccess(node);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,10 @@ public void executeNodeStep(
failureData.put("message",e.getMessage());
failureData.put("ansible-config", configuration);
throw new NodeStepException(e.getMessage(),e, AnsibleException.AnsibleFailureReason.AnsibleError, failureData, e.getMessage());
}finally {
contextBuilder.cleanupTempFiles();
}

contextBuilder.cleanupTempFiles();

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,9 @@ public void executeStep(PluginStepContext context, Map<String, Object> configura


throw new StepException(e.getMessage(), e, AnsibleException.AnsibleFailureReason.AnsibleError, failureData);
}finally {
contextBuilder.cleanupTempFiles();
}

contextBuilder.cleanupTempFiles();
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,9 @@ public void executeNodeStep(
throw new NodeStepException(e.getMessage(), e.getFailureReason(),e.getMessage());
} catch (Exception e) {
throw new NodeStepException(e.getMessage(),AnsibleException.AnsibleFailureReason.AnsibleError,e.getMessage());
}finally {
contextBuilder.cleanupTempFiles();
}

contextBuilder.cleanupTempFiles();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,9 @@ public void executeStep(PluginStepContext context, Map<String, Object> configura
failureData.put("ansible-config", contextBuilder.getConfigFile());

throw new StepException(e.getMessage(), e, AnsibleException.AnsibleFailureReason.AnsibleError, failureData);
}finally {
contextBuilder.cleanupTempFiles();
}

contextBuilder.cleanupTempFiles();
}

@Override
Expand Down

0 comments on commit 28f42dc

Please sign in to comment.