aboutsummaryrefslogtreecommitdiffstats
path: root/nfvbenchvm/dib/elements/nfvbenchvm/post-install.d/03-copy-rc-local
diff options
context:
space:
mode:
authorGwenael Lambrouin <gwenael.lambrouin@orange.com>2021-12-13 13:48:14 +0100
committerGwenael Lambrouin <gwenael.lambrouin@orange.com>2022-02-28 18:40:54 +0100
commitce062d315394b813ce79849c6595d198351c2cec (patch)
tree135e3fcb9623fa5d344f07f15f4c5682796a7ff5 /nfvbenchvm/dib/elements/nfvbenchvm/post-install.d/03-copy-rc-local
parent1a9c875d35daf4e742cd980e824c862ad793a658 (diff)
nfvbenchvm: abort build on error
Make sure a VM image build fails if any step fails. Else we can end up with a bad image not containing all that we want, and we discover this later at run time. For instance, without the current patch, we can get a generator VM image without nfvbench installed because "pip install" failed, but this is not detected by the build process because the last step in post-install.d/52-nfvbench-script is an "echo" command that returns a success code. We fix this by making all the Bash scripts fail if any command whose return code is not tested fails (set -euo pipefail). Change-Id: Ic5ec9eb85a8d6e7e4d1dcbac8ebcac5931e4808e Signed-off-by: Gwenael Lambrouin <gwenael.lambrouin@orange.com>
Diffstat (limited to 'nfvbenchvm/dib/elements/nfvbenchvm/post-install.d/03-copy-rc-local')
-rwxr-xr-xnfvbenchvm/dib/elements/nfvbenchvm/post-install.d/03-copy-rc-local5
1 files changed, 4 insertions, 1 deletions
diff --git a/nfvbenchvm/dib/elements/nfvbenchvm/post-install.d/03-copy-rc-local b/nfvbenchvm/dib/elements/nfvbenchvm/post-install.d/03-copy-rc-local
index 3311530..24facec 100755
--- a/nfvbenchvm/dib/elements/nfvbenchvm/post-install.d/03-copy-rc-local
+++ b/nfvbenchvm/dib/elements/nfvbenchvm/post-install.d/03-copy-rc-local
@@ -1,8 +1,11 @@
#!/bin/bash
+# Stop on error
+set -euo pipefail
+
# set accurate rc.local file corresponding to current image built
if [ $DIB_DEV_IMAGE = "loopvm" ]; then
mv /etc/rc.d/rc.local.loopvm /etc/rc.d/rc.local
else
mv /etc/rc.d/rc.local.generator /etc/rc.d/rc.local
-fi \ No newline at end of file
+fi