1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.jclouds.compute;
20
21 import static org.jclouds.compute.util.ComputeServiceUtils.createExecutionErrorMessage;
22 import static org.jclouds.compute.util.ComputeServiceUtils.createNodeErrorMessage;
23
24 import java.util.Map;
25
26 import org.jclouds.javax.annotation.Nullable;
27
28 import org.jclouds.compute.domain.ExecResponse;
29 import org.jclouds.compute.domain.NodeMetadata;
30 import org.jclouds.compute.options.RunScriptOptions;
31 import org.jclouds.scriptbuilder.domain.Statement;
32
33
34
35
36
37 public class RunScriptOnNodesException extends Exception {
38
39
40 private static final long serialVersionUID = -2272965726680821281L;
41 private final Statement runScript;
42 private final RunScriptOptions options;
43 private final Map<NodeMetadata, ExecResponse> successfulNodes;
44 private final Map<? extends NodeMetadata, ? extends Throwable> failedNodes;
45 private final Map<?, Exception> executionExceptions;
46
47 public RunScriptOnNodesException(Statement runScript, @Nullable RunScriptOptions options,
48 Map<NodeMetadata, ExecResponse> successfulNodes, Map<?, Exception> executionExceptions,
49 Map<? extends NodeMetadata, ? extends Throwable> failedNodes) {
50 super(String.format("error runScript on filtered nodes options(%s)%n%s%n%s", options,
51 createExecutionErrorMessage(executionExceptions), createNodeErrorMessage(failedNodes)));
52 this.runScript = runScript;
53 this.options = options;
54 this.successfulNodes = successfulNodes;
55 this.failedNodes = failedNodes;
56 this.executionExceptions = executionExceptions;
57 }
58
59
60
61
62 public Map<NodeMetadata, ExecResponse> getSuccessfulNodes() {
63 return successfulNodes;
64 }
65
66
67
68
69
70 public Map<?, ? extends Throwable> getExecutionErrors() {
71 return executionExceptions;
72 }
73
74
75
76
77
78 public Map<? extends NodeMetadata, ? extends Throwable> getNodeErrors() {
79 return failedNodes;
80 }
81
82 public Statement getRunScript() {
83 return runScript;
84 }
85
86 public RunScriptOptions getOptions() {
87 return options;
88 }
89
90 }