Merge "import-stx: Avoid divide by zero"

This commit is contained in:
Zuul 2022-01-31 19:46:09 +00:00 committed by Gerrit Code Review
commit 38afa75cc7
3 changed files with 22 additions and 1 deletions

4
.gitignore vendored
View File

@ -12,3 +12,7 @@ doc/build/
# Release Notes documentation
releasenotes/build
# stx init/config/controller files
stx.conf
minikube_history.log

View File

@ -41,7 +41,23 @@ if [ ! -f "stx.conf" ]; then
fi
number_of_users () {
users | tr ' ' '\n' | sort --uniq | wc -l
local count
count=$(users | tr ' ' '\n' | sort --uniq | wc -l)
# Add in non-login users that might trigger a parallel build
# based on a timer, or other trigger.
if getent passwd | grep -q jenkins; then
count=$((count+1))
fi
# Always return at least one. i.e. someone is
# running this script.
if [ $count -le 0 ]; then
count=1
fi
echo $count
}
number_of_cpus () {

1
stx/lib/stx/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
__pycache__