From 229bbe75b09664f496b8a0d919dad98ef6e79e73 Mon Sep 17 00:00:00 2001 From: Walter Wahlstedt Date: Fri, 14 Jan 2022 12:53:16 -0500 Subject: [PATCH] Create option to turn on verbose logging. Change-Id: I1ad71a603a92e44ee93e0663c7b2db216a1811ff --- divingbell/templates/bin/_apt.sh.tpl | 6 ------ divingbell/templates/bin/_shcommon.tpl | 5 ++++- divingbell/values.yaml | 1 + 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/divingbell/templates/bin/_apt.sh.tpl b/divingbell/templates/bin/_apt.sh.tpl index fc05945..e145658 100644 --- a/divingbell/templates/bin/_apt.sh.tpl +++ b/divingbell/templates/bin/_apt.sh.tpl @@ -35,13 +35,11 @@ fi write_test "${persist_path}" load_package_list_with_versions(){ - set +x for f in "$@"; do IFS="=" read -r name version <<< $f; IFS=":" read -r name arch <<< $name; CURRENT_PACKAGES["$name"]="$version"; done - set -x } ################################################ @@ -115,7 +113,6 @@ DEBIAN_FRONTEND=noninteractive apt-get update dpkg --configure -a --force-confold,confdef # Perform package installs -set +x {{- if .Values.conf.apt.strict }} {{- range $all_apt_packages }} {{- $pkg_name := .name }} @@ -131,7 +128,6 @@ fi REQUESTED_PACKAGES="$REQUESTED_PACKAGES {{$pkg_name}}" {{- end }} {{- end }} -set -x # Run this in case some package installation was interrupted DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y -o Dpkg::Options::=--force-confdef -o Dpkg::Options::=--force-confold {{- if .Values.conf.apt.allow_downgrade }} "--allow-downgrades" {{ end }}{{- if .repo }} -t {{ .repo }}{{ end }} $INSTALLED_THIS_TIME {{- end }} @@ -179,12 +175,10 @@ if [ -f ${persist_path}/packages ]; then {{- if .Values.conf.apt.strict }} load_package_list_with_versions $(dpkg -l | awk 'NR>5 {print $2"="$3}') {{- end }} - set +x for package in "${!CURRENT_PACKAGES[@]}" do CURRENT_PACKAGE_NAMES="$CURRENT_PACKAGE_NAMES $package" done - set -x echo $CURRENT_PACKAGE_NAMES | sed 's/ /\n/g' | sed '/^[[:space:]]*$/d' | sort > ${persist_path}/packages.current {{- if .Values.conf.apt.strict }} TO_DELETE=$(comm -23 ${persist_path}/packages.current ${persist_path}/packages.requested) diff --git a/divingbell/templates/bin/_shcommon.tpl b/divingbell/templates/bin/_shcommon.tpl index 72e5fe8..95636e4 100644 --- a/divingbell/templates/bin/_shcommon.tpl +++ b/divingbell/templates/bin/_shcommon.tpl @@ -93,7 +93,10 @@ die(){ } export -f die trap 'die' ERR -set -x +{{- if .Values.conf.extra_verbose }} + set -x +{{- end }} + write_test(){ local write_test_file diff --git a/divingbell/values.yaml b/divingbell/values.yaml index da65dbb..136431e 100644 --- a/divingbell/values.yaml +++ b/divingbell/values.yaml @@ -24,6 +24,7 @@ images: conf: chroot_mnt_path: '/mnt' log_colors: False + extra_verbose: False apt: upgrade: false allow_downgrade: false