Revert "Properly fail/trap in eval_run_d"
This reverts commit 0d1d6bec7c.
This patch breaks tripleo-ci (the instack.qcow2 images is failing
to build) and was merged without passing CI.
Closes-Bug: #1582115
Change-Id: Ic4725ad0689c937fb4c8c792e1eaff5f4ea9ada9
			
			
This commit is contained in:
		@@ -113,15 +113,12 @@ function check_element () {
 | 
				
			|||||||
# $1 is the hook to run
 | 
					# $1 is the hook to run
 | 
				
			||||||
# $2 is the regex to look for
 | 
					# $2 is the regex to look for
 | 
				
			||||||
function eval_run_d () {
 | 
					function eval_run_d () {
 | 
				
			||||||
    local run_output=$(mktemp)
 | 
					  local TEMP=`run_d $1`
 | 
				
			||||||
    trap "rm -f $run_output; check_break after-error ${break_cmd:-bash}" ERR
 | 
					  echo "$TEMP"
 | 
				
			||||||
    run_d $1 $run_output
 | 
					  if [ `echo "$TEMP" | grep -s "$2"` ]; then
 | 
				
			||||||
    if grep -q "$2" $run_output; then
 | 
					      TEMP=`echo "$TEMP" | grep "$2"`
 | 
				
			||||||
        local temp=$(grep "$2" $run_output)
 | 
					      eval "$TEMP"
 | 
				
			||||||
        eval "$temp"
 | 
					 | 
				
			||||||
  fi
 | 
					  fi
 | 
				
			||||||
    rm $run_output
 | 
					 | 
				
			||||||
    trap - ERR
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Usage: map_nbd $image
 | 
					# Usage: map_nbd $image
 | 
				
			||||||
@@ -197,17 +194,10 @@ function cleanup_image_dir () {
 | 
				
			|||||||
# Run a directory of hooks outside the target (that is, no chrooting).
 | 
					# Run a directory of hooks outside the target (that is, no chrooting).
 | 
				
			||||||
function run_d() {
 | 
					function run_d() {
 | 
				
			||||||
    check_element
 | 
					    check_element
 | 
				
			||||||
    check_break before-$1 ${break_cmd:-bash}
 | 
					    check_break before-$1 bash
 | 
				
			||||||
    if [ -d ${TMP_HOOKS_PATH}/$1.d ] ; then
 | 
					    if [ -d ${TMP_HOOKS_PATH}/$1.d ] ; then
 | 
				
			||||||
        if [ -n "$2" ]; then
 | 
					 | 
				
			||||||
            dib-run-parts ${TMP_HOOKS_PATH}/$1.d | tee $2
 | 
					 | 
				
			||||||
            if [[ $PIPESTATUS[0] != 0 ]]; then
 | 
					 | 
				
			||||||
                return 1
 | 
					 | 
				
			||||||
            fi
 | 
					 | 
				
			||||||
        else
 | 
					 | 
				
			||||||
      dib-run-parts ${TMP_HOOKS_PATH}/$1.d
 | 
					      dib-run-parts ${TMP_HOOKS_PATH}/$1.d
 | 
				
			||||||
    fi
 | 
					    fi
 | 
				
			||||||
    fi
 | 
					 | 
				
			||||||
    check_break after-$1 bash
 | 
					    check_break after-$1 bash
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user