Skip to content

Commit

Permalink
Use latest shellbase, release v0.9.20230313
Browse files Browse the repository at this point in the history
  • Loading branch information
rdavid committed Mar 13, 2023
1 parent af97d54 commit d85623f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 22 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ The artifact is a single executable POSIX-compliant shell script file
file from the released version. RHEL demands administrative rights to write to
`/usr/local/bin`, `sudo` before `tar` is used:
```sh
REL=0.9.20230308
REL=0.9.20230313
SRC=https://github.com/rdavid/gento/archive/refs/tags/v$REL.tar.gz
curl --location --silent $SRC |
sudo tar \
Expand All @@ -31,7 +31,7 @@ with all dependencies run POSIX-compliant shell script file
[`install`](https://github.com/rdavid/gento/blob/master/app/install) as a
process owned by the superuser:
```sh
REL=0.9.20230308
REL=0.9.20230313
SRC=https://github.com/rdavid/gento/archive/refs/tags/v$REL.tar.gz
sudo su -c eval -c "$(
curl --location --silent $SRC |
Expand Down
26 changes: 11 additions & 15 deletions app/gento
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
# shellcheck disable=SC1091,SC2034 # File not following, appears unused.
readonly \
BASE_APP_USAGE=Usage:\ gento\ settings-cnf-name.yml. \
BASE_APP_VERSION=0.9.20230309 \
BASE_MIN_VERSION=0.9.20230308
BASE_APP_VERSION=0.9.20230313 \
BASE_MIN_VERSION=0.9.20230312
. base.sh

# First extracts a version from a sidecar settings file, on failure extracts
Expand All @@ -24,7 +24,7 @@ cnfct_version() {
return 0
}
logw Unable to read CNFCT version from "$CFG"
is_readable $def >/dev/null || die $def is not readable.
isreadable $def >/dev/null || die $def is not readable.
ver="$(yq .test_network_function_version $def 2>&1)" ||
die Unable to read test_network_function_version from "$def": "$ver".
[ "$ver" = null ] || {
Expand Down Expand Up @@ -107,7 +107,7 @@ helm_charts() {
# The function returns string as output, the following two functions produce
# information strings, do not add those to the output.
file_exists "$cfg" >/dev/null || return 0
is_readable "$cfg" >/dev/null || die
isreadable "$cfg" >/dev/null || die
printf -- " \
--extra-vars \"kubeconfig_path\"=\"%s\" \
--extra-vars \"do_chart_verifier\"=\"true\" \
Expand Down Expand Up @@ -307,9 +307,9 @@ main() {
-- \
--extra-vars \{\"dci_components_by_query\":["$coms"]\}$charts \
--extra-vars \{\"dci_tags\":["$tags"]\} \
2>&1 1>&3 3>&- | to_loge
2>&1 1>&3 3>&- | tologe
} \
3>&1 1>&2 | to_log
3>&1 1>&2 | tolog
}

# Gets node hardware version by node name. xargs trims white spaces and
Expand Down Expand Up @@ -416,7 +416,7 @@ resource() {
dir="$(realdir "$CFG")" || die
inside "$CNF" test && rc="$dir"/dcirc-test.sh || rc="$dir"/dcirc.sh
file_exists "$rc" || return 0
is_readable "$rc" || die
isreadable "$rc" || die

# shellcheck disable=SC1090 # File not following.
. "$rc"
Expand All @@ -425,9 +425,9 @@ resource() {

# Checks various aspects of an environment.
validate_env() {
be_user dci-openshift-app-agent
beuser dci-openshift-app-agent
parse_input "$@"
is_readable "$CFG" || die "$CFG" is not readable.
isreadable "$CFG" || die "$CFG" is not readable.

# DCI works with absolute paths, makes sure parent directories are readable.
realpath "$CFG" >/dev/null 2>&1 || die
Expand All @@ -450,15 +450,11 @@ validate_env() {
KUBECONFIG \
XDG_RUNTIME_DIR
file_exists "$KUBECONFIG" || die "$KUBECONFIG": No such file.
is_writable "$KUBECONFIG" || die "$KUBECONFIG" is not writable.
iswritable "$KUBECONFIG" || die "$KUBECONFIG" is not writable.
[ -O "$KUBECONFIG" ] ||
die "$KUBECONFIG" should be owned by dci-openshift-app-agent.
file_exists "$XDG_RUNTIME_DIR" || die "$XDG_RUNTIME_DIR": No such file.
is_writable "$XDG_RUNTIME_DIR" || die "$XDG_RUNTIME_DIR" is not writable.

# Continues only with certain shellbase version.
ver_ge "$BASE_VERSION" $BASE_MIN_VERSION ||
die Shellbase is "$BASE_VERSION", needs $BASE_MIN_VERSION or above.
iswritable "$XDG_RUNTIME_DIR" || die "$XDG_RUNTIME_DIR" is not writable.

# Makes sure DCI server is available.
url_exists "$DCI_CS_URL" || {
Expand Down
10 changes: 5 additions & 5 deletions app/install
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
# shellcheck disable=SC3043 # Uses local variables.
# shellcheck disable=SC1091,SC2034 # File not following, appears unused.
readonly \
BASE_APP_VERSION=0.9.20230308 \
BASE_APP_VERSION=0.9.20230313 \
DST=/usr/local/bin \
GOR=0.9.20230308 \
GOR=0.9.20230313 \
PKG="\
curl \
dci-ansible \
Expand All @@ -17,7 +17,7 @@ dci-openshift-app-agent \
jq \
python3-dciclient \
tar" \
SHR=0.9.20230308 \
SHR=0.9.20230312 \
USR=dci-openshift-app-agent \
YQR=4.31.2
readonly \
Expand Down Expand Up @@ -125,8 +125,8 @@ validate() {
exit 13
}
shellbase
be_root
is_writable $DST || die $DST is not writable.
beroot
iswritable $DST || die $DST is not writable.
url_exists $GO $OC $SH $YQ || die
user_exists $USR || die $USR: Not such user.

Expand Down

0 comments on commit d85623f

Please sign in to comment.