Skip to contentSkip to conversation

sg-run-job: Make nested-layer-descend insist on $ok

PATCH In review Ian Jackson 2 participants 2 messages Nov 23, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sg-run-job: Make nested-layer-descend insist on $ok

per-host-ts does nothing if !$ok, so per-host-prep's individual steps become no-ops if the host prep fails, which prevents blundering on. But per-host-prep does not throw.

The other call site explicitly avoids calling the recipe script if !$ok. nested-layer-descend is for calling from within a recipe, so we need to throw an exception to abort the script, if !$ok.

---
 sg-run-job |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
sg-run-job +2 -1
index a2527ca..d9b2e38 100755
@@ -260,10 +260,11 @@ proc per-host-ts {iffail ident script args} {
 proc nested-layer-descend {nested_hosts} {
     # We save need_xen_hosts on a stack in nested_layers_hosts
     # It gets popped again during the cleanup part of run-job
-    global nested_layers_hosts need_xen_hosts
+    global nested_layers_hosts need_xen_hosts ok
     lappend nested_layers_hosts $need_xen_hosts
     set need_xen_hosts $nested_hosts
     per-host-prep
+    if {!$ok} { error "host prep ($nested_hosts) (or something else) failed" }
 }
 
 #---------- test recipes ----------
Signature · 1 line
1.7.10.4
Acked-by on v1 1/1
#1 lore raw
Quoted 10 lines · Ian Jackson

per-host-ts does nothing if !$ok, so per-host-prep's individual steps become no-ops if the host prep fails, which prevents blundering on. But per-host-prep does not throw.

The other call site explicitly avoids calling the recipe script if !$ok.  nested-layer-descend is for calling from within a recipe, so we need to throw an exception to abort the script, if !$ok.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel