From c4e5565799fa761494cce96f75e5baca10da290f Mon Sep 17 00:00:00 2001 From: Ryan Beisner Date: Fri, 8 Feb 2019 15:10:21 -0600 Subject: [PATCH] Update pre-install hooks to fail on error The pre-install operations may fail, yet that failure is not elevated to the user. This masks the failure and makes early package install issues difficult to troubleshoot. If the basic pre-install script fails, the charm should not proceed to later hooks as the requirements may not be met. Hashbangs for bash should specify -e (errexit) on all of the pre-install bash scripts. Change-Id: Ie7b99dfa4cbe00a03acf1b2cc2eeecc7f84fbe17 Closes-bug: #1815243 Partial-bug: #1815231 --- hooks/install | 2 +- hooks/install_deps | 2 +- hooks/upgrade-charm | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/hooks/install b/hooks/install index 015c1435..e9027a88 100755 --- a/hooks/install +++ b/hooks/install @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/bash -e # Wrapper to deal with newer Ubuntu versions that don't have py2 installed # by default. diff --git a/hooks/install_deps b/hooks/install_deps index 506d9d64..4d06619a 100755 --- a/hooks/install_deps +++ b/hooks/install_deps @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/bash -e # Install required dependencies for charm runtime declare -a DEPS=('apt' 'netaddr' 'netifaces' 'yaml' 'jinja2' 'dnspython') diff --git a/hooks/upgrade-charm b/hooks/upgrade-charm index c1771bf0..14948004 100755 --- a/hooks/upgrade-charm +++ b/hooks/upgrade-charm @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/bash -e # Re-install dependencies to deal with py2->py3 switch for charm ./hooks/install_deps