summary |
shortlog |
log |
commit | commitdiff |
review |
tree
raw |
patch |
inline | side by side (from parent 1:
931ae70)
POSIX function style is already used in most of shell scripts.
By the way, this style fixes bashate E020 warnings.
Non POSIX function declarations in a format different from
^function name {$ are warned by bashate.
There are several equivalent ways to define functions in Bash.
This is for consistency.
Signed-off-by: Guillaume Lambert <guillaume.lambert@orange.com>
Change-Id: I5f02e7052101617314157ec408532dd024e80a72
#
################################################################################
#
#
################################################################################
#
+# NAME
+# lf-echo-stderr
#
# SYNOPSIS
# source ~/lf-env.sh
#
# SYNOPSIS
# source ~/lf-env.sh
#
################################################################################
#
################################################################################
-function lf-echo-stderr() { echo "$@" 1>&2; }
+lf-echo-stderr () {
+ echo "$@" 1>&2
+}
################################################################################
#
# NAME
################################################################################
#
# NAME
#
# SYNOPSIS
# # shellcheck disable=SC1090
#
# SYNOPSIS
# # shellcheck disable=SC1090
#
################################################################################
#
################################################################################
-function lf-boolean()
-{
if (( $# != 1 )); then
echo "ERROR: ${FUNCNAME[0]}() line: ${BASH_LINENO[0]} : Missing Required Argument"
return 1
if (( $# != 1 )); then
echo "ERROR: ${FUNCNAME[0]}() line: ${BASH_LINENO[0]} : Missing Required Argument"
return 1
#
################################################################################
#
################################################################################
-function lf-activate-venv()
-{
lf_venv=$(mktemp -d /tmp/venv-XXXX)
local python=python3
local options
lf_venv=$(mktemp -d /tmp/venv-XXXX)
local python=python3
local options
echo "${FUNCNAME[0]}(): INFO: Path not set, lf_venv set to: $lf_venv"
fi
echo "${FUNCNAME[0]}(): INFO: Path not set, lf_venv set to: $lf_venv"
fi
-} # End lf-activate-venv()
+} # End lf-activate-venv
################################################################################
#
################################################################################
#
#
################################################################################
#
################################################################################
-function lf-git-validate-jira-urls()
-{
+lf-git-validate-jira-urls () {
echo "Checking for JIRA URLs in commit message..."
# if JIRA_URL is not defined, nothing to do
if [[ -v JIRA_URL ]]; then
echo "Checking for JIRA URLs in commit message..."
# if JIRA_URL is not defined, nothing to do
if [[ -v JIRA_URL ]]; then
################################################################################
#
# NAME
################################################################################
#
# NAME
#
# SYNOPSIS
# # shellcheck disable=SC1090
#
# SYNOPSIS
# # shellcheck disable=SC1090
#
################################################################################
#
################################################################################
-function lf-jjb-check-ascii()
-{
if [[ ! -d "jjb" ]]; then
lf-echo-stderr "${FUNCNAME[0]}(): ERROR: missing jjb directory"
lf-echo-stderr "This function can only be run from top of global-jjb directory"
if [[ ! -d "jjb" ]]; then
lf-echo-stderr "${FUNCNAME[0]}(): ERROR: missing jjb directory"
lf-echo-stderr "This function can only be run from top of global-jjb directory"
# Shellcheck knows they are shell variables and will check for
# 'used-before-set'.
# Shellcheck knows they are shell variables and will check for
# 'used-before-set'.
-function lf-set-maven-options()
-{
+lf-set-maven-options () {
# Disable 'unused-variable' check
# shellcheck disable=SC2034
maven_options="--show-version --batch-mode -Djenkins \
# Disable 'unused-variable' check
# shellcheck disable=SC2034
maven_options="--show-version --batch-mode -Djenkins \
# self-contained, we ensure it exists here.
mkdir -p "$WORKSPACE/archives"
# self-contained, we ensure it exists here.
mkdir -p "$WORKSPACE/archives"
-function get_pattern_opts()
-{
opts=()
for arg in ${ARCHIVE_ARTIFACTS:-}; do
opts+=("-p" "$arg")
opts=()
for arg in ${ARCHIVE_ARTIFACTS:-}; do
opts+=("-p" "$arg")
os_cloud="${OS_CLOUD:-vex}"
stack_name="${OS_STACK_NAME}"
os_cloud="${OS_CLOUD:-vex}"
stack_name="${OS_STACK_NAME}"
-function copy_ssh_keys() {
if [ -z "$1" ]; then
>&2 echo "ERROR: Missing required arguments."
>&2 echo "Usage: copy_ssh_keys IP_ADDRESS"
if [ -z "$1" ]; then
>&2 echo "ERROR: Missing required arguments."
>&2 echo "Usage: copy_ssh_keys IP_ADDRESS"
-function get-year-list()
-{
# Grab the years for each cost record use sort | uniq to get the
# list of unique years found
local list
# Grab the years for each cost record use sort | uniq to get the
# list of unique years found
local list
set -eu -o pipefail -o noglob
# Copy/Generate 'sudo' log and copy to archive directory
set -eu -o pipefail -o noglob
# Copy/Generate 'sudo' log and copy to archive directory
case $os in
fedora|centos|redhat|ubuntu|debian)
if ! sudo cp "$sudo_log" /tmp; then
case $os in
fedora|centos|redhat|ubuntu|debian)
if ! sudo cp "$sudo_log" /tmp; then