Skip to content
This repository has been archived by the owner on Feb 3, 2025. It is now read-only.

Commit

Permalink
Merge pull request #6 from nhs-riak/nhse-d32-basho.i1149-args
Browse files Browse the repository at this point in the history
Change argument passing
  • Loading branch information
martinsumner authored May 22, 2024
2 parents e01d7a5 + 21ec29c commit e1a43d1
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 28 deletions.
4 changes: 4 additions & 0 deletions RELEASE-NOTES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Riak KV 3.2.2-nhse Release Notes

This release updates 3.2.1 to resolve an issue with handling of spaces in Riak commands (e.g. within JSON-based definitions of bucket properties, or `riak eval` statements).

# Riak KV 3.2.1-nhse Release Notes

This brings the Riak 3.2 branch in-line with the latest Riak KV 3.0 NHS release [3.0.18-nhse](https://github.com/nhs-riak/riak/releases/tag/riak-3.0.18-nhse), and also includes a number of uplifts to the Tictac AAE replication ecosystem.
Expand Down
2 changes: 1 addition & 1 deletion rebar.config
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
]}
]}.

{relx, [{release, {riak, "3.2.1-nhse"},
{relx, [{release, {riak, "3.2.2-nhse"},
[kernel,
stdlib,
public_key,
Expand Down
48 changes: 21 additions & 27 deletions rel/files/riak
Original file line number Diff line number Diff line change
Expand Up @@ -17,26 +17,8 @@ if [ ! -r "$VMARGS_PATH" ]; then
fi
export VMARGS_PATH

# centos7-based distros have a su that contacts pam and prints the "Last logged in" message
if [ "`cat /etc/redhat-release 2>&1`" = "CentOS Stream release 7" ] ||
[ "`cat /etc/system-release 2>&1`" = "Amazon Linux release 2 (Karoo)" ]; then
COPTION="--session-command"
else
COPTION="-c"
fi

function maybe_su {
if [[ $EUID -ne 0 ]]; then
$*
else
# if we are executing an admin command that spins up a
# (hidden) node to then execute custom erlang code via -eval,
# we need to cd to a dir containing the erlang cookie
# (previously implicitly done by su -, which option we have
# removed in order to allow any env vars to be available for
# the ultimate invocation of riak/riak-cs/stanchion)
cd "{{platform_base_dir}}"
# freebsd su is fairly limited, so:
function su_bsd {
# bsd su is fairly limited, so:
mkdir -p "$RUNNER_GEN_DIR"
chown riak:riak "$RUNNER_GEN_DIR"
f=`mktemp "$RUNNER_GEN_DIR"/su_piggy-XXXXXXX`
Expand All @@ -46,20 +28,32 @@ $*
EOF
chmod +x "$f"
chown riak:riak "$f"
su riak $COPTION "$f"
su riak -c "$f"
rm -f "$f"
fi
}

function maybe_su {
if [[ $EUID -ne 0 ]]; then
"$@"
else
# if we are executing an admin command that spins up a
# (hidden) node to then execute custom erlang code via -eval,
# we need to cd to a dir containing the erlang cookie
cd "{{platform_base_dir}}"
if `grep BSD /etc/os-release` ; then
su_bsd "$@"
else
sudo -H -E -u riak -- "$@"
fi
fi
}

case "$1" in
stop)
maybe_su $RELX_RIAK $* \
maybe_su $RELX_RIAK "$@" \
&& rm -f $PID_DIR/riak.pid ## relx-generated script doesn't remove it
;;
*)

# what is this for?
#ESCAPED_ARGS=`echo "$@" | sed -e 's/\([\\\(\\\){}"\x27]\)/\\\\\1/g'`
maybe_su $RELX_RIAK $*
maybe_su $RELX_RIAK "$@"
;;
esac

0 comments on commit e1a43d1

Please sign in to comment.