cloud-init-dev team mailing list archive
-
cloud-init-dev team
-
Mailing list archive
-
Message #05120
[Merge] ~smoser/cloud-init:fix/run-container-no-artifacts into cloud-init:master
Scott Moser has proposed merging ~smoser/cloud-init:fix/run-container-no-artifacts into cloud-init:master.
Commit message:
tools: Fix run-container when neither source or binary package requested.
If run-container was called without --package or --binary-package, then
it would still try to copy out artifacts and would fail doing so as
there were no artifacts to collect.
Requested reviews:
cloud-init commiters (cloud-init-dev)
For more details, see:
https://code.launchpad.net/~smoser/cloud-init/+git/cloud-init/+merge/348677
see commit message
--
Your team cloud-init commiters is requested to review the proposed merge of ~smoser/cloud-init:fix/run-container-no-artifacts into cloud-init:master.
diff --git a/tools/run-container b/tools/run-container
index 499e85b..6dedb75 100755
--- a/tools/run-container
+++ b/tools/run-container
@@ -418,7 +418,7 @@ main() {
{ bad_Usage; return; }
local cur="" next=""
- local package="" source_package="" unittest="" name=""
+ local package=false srcpackage=false unittest="" name=""
local dirty=false pyexe="auto" artifact_d="."
while [ $# -ne 0 ]; do
@@ -430,8 +430,8 @@ main() {
-k|--keep) KEEP=true;;
-n|--name) name="$next"; shift;;
--pyexe) pyexe=$next; shift;;
- -p|--package) package=1;;
- -s|--source-package) source_package=1;;
+ -p|--package) package=true;;
+ -s|--source-package) srcpackage=true;;
-u|--unittest) unittest=1;;
-v|--verbose) VERBOSITY=$((VERBOSITY+1));;
--) shift; break;;
@@ -529,8 +529,8 @@ main() {
build_srcpkg="./packages/brpm $distflag --srpm"
pkg_ext=".rpm";;
esac
- if [ -n "$source_package" ]; then
- [ -n "$build_pkg" ] || {
+ if [ "$srcpackage" = "true" ]; then
+ [ -n "$build_srcpkg" ] || {
error "Unknown package command for $OS_NAME"
return 1
}
@@ -542,19 +542,21 @@ main() {
}
fi
- if [ -n "$package" ]; then
- [ -n "$build_srcpkg" ] || {
+ if [ "$package" = "true" ]; then
+ [ -n "$build_pkg" ] || {
error "Unknown build source command for $OS_NAME"
return 1
}
debug 1 "building binary package with $build_pkg."
+ # shellcheck disable=SC2086
inside_as_cd "$name" "$user" "$cdir" $pyexe $build_pkg || {
errorrc "failed: $build_pkg";
errors[${#errors[@]}]="binary package"
}
fi
- if [ -n "$artifact_d" ]; then
+ if [ -n "$artifact_d" ] &&
+ [ "$package" = "true" -o "$srcpackage" = "true" ]; then
local art=""
artifact_d="${artifact_d%/}/"
[ -d "${artifact_d}" ] || mkdir -p "$artifact_d" || {
Follow ups