Skip to content

Commit 1ce0262

Browse files
committed
deprecate, warn about hyphenated forms of riak-admin
1 parent 6ab6b0b commit 1ce0262

File tree

7 files changed

+57
-8
lines changed

7 files changed

+57
-8
lines changed

rel/files/riak

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,19 +66,23 @@ case "$1" in
6666
;;
6767
admin)
6868
shift
69-
maybe_su `which riak-admin` $*
69+
# when we are called as `riak admin`, pass a flag to
70+
# riak-admin script to suppress the deprecation warning (which
71+
# would be printed if that script were called directly, i.e.,
72+
# `riak-admin`)
73+
maybe_su `which riak-admin` --suppress-deprecation-warning $*
7074
;;
7175
chkconfig)
7276
shift
73-
maybe_su `which riak-chkconfig` $*
77+
maybe_su `which riak-chkconfig` --suppress-deprecation-warning $*
7478
;;
7579
repl)
7680
shift
77-
maybe_su `which riak-repl` $*
81+
maybe_su `which riak-repl` --suppress-deprecation-warning $*
7882
;;
7983
debug)
8084
shift
81-
maybe_su `which riak-debug` $*
85+
maybe_su `which riak-debug` --suppress-deprecation-warning $*
8286
;;
8387
*)
8488
ESCAPED_ARGS=`echo "$@" | sed -e 's/\([\\\(\\\){}"\x27]\)/\\\\\1/g'`

rel/files/riak-admin

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,21 @@
22
# -*- tab-width:4;indent-tabs-mode:nil -*-
33
# ex: ts=4 sw=4 et
44

5+
# suppress_hyphen_deprec_warning is defined in top-level vars.config
6+
# but not in pkg/*/vars.config
7+
SUPPRESS_HYPH_DEPREC_WARN={{suppress_hyphen_deprec_warning}}
8+
9+
# the --suppress-deprecation-warning flag is injected in riak launcher
10+
# script, meaning that if riak-admin is invoked from riak (as `riak
11+
# admin`), we should not print the warning.
12+
if [ x$1 = x"--suppress-deprecation-warning" ]; then
13+
shift
14+
elif [ x${SUPPRESS_HYPH_DEPREC_WARN} != x"yes" ]; then
15+
echo "The hyphenated form of this command is deprecated. \
16+
Please fix your scripts to call \`riak admin\` instead.
17+
"
18+
fi
19+
520
# Identify the script name
621
SCRIPT="riak-admin"
722

rel/files/riak-chkconfig

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@
22
# -*- tab-width:4;indent-tabs-mode:nil -*-
33
# ex: ts=4 sw=4 et
44

5+
SUPPRESS_HYPH_DEPREC_WARN={{suppress_hyphen_deprec_warning}}
6+
if [ x$1 = x"--suppress-deprecation-warning" ]; then
7+
shift
8+
elif [ x${SUPPRESS_HYPH_DEPREC_WARN} != x"yes" ]; then
9+
echo "The hyphenated form of this command is deprecated. \
10+
Please fix your scripts to call \`riak chkconfig\` instead.
11+
"
12+
fi
13+
514
PLATFORM_BASE_DIR={{platform_base_dir}}
615
PLATFORM_BASE_DIR=${PLATFORM_BASE_DIR:-$(cd $(dirname "$0")/.. && pwd -P)}
716
RPC_HOP="${PLATFORM_BASE_DIR}/bin/riak rpc"

rel/files/riak-debug

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,15 @@
2222
##
2323
## -------------------------------------------------------------------
2424

25+
SUPPRESS_HYPH_DEPREC_WARN={{suppress_hyphen_deprec_warning}}
26+
if [ x$1 = x"--suppress-deprecation-warning" ]; then
27+
shift
28+
elif [ x${SUPPRESS_HYPH_DEPREC_WARN} != x"yes" ]; then
29+
echo "The hyphenated form of this command is deprecated. \
30+
Please fix your scripts to call \`riak debug\` instead.
31+
"
32+
fi
33+
2534
# If you start to think "We should execute some Erlang in here", then go work
2635
# on Riaknostic, which is called with `riak admin diag` below.
2736

rel/files/riak-repl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22
# -*- tab-width:4;indent-tabs-mode:nil -*-
33
# ex: ts=4 sw=4 et
44

5+
SUPPRESS_HYPH_DEPREC_WARN={{suppress_hyphen_deprec_warning}}
6+
if [ x$1 = x"--suppress-deprecation-warning" ]; then
7+
shift
8+
elif [ x${SUPPRESS_HYPH_DEPREC_WARN} != x"yes" ]; then
9+
echo "The hyphenated form of this command is deprecated. \
10+
Please fix your scripts to call \`riak repl\` instead"
11+
fi
12+
513
# Identify the script name
614
SCRIPT=`basename $0`
715

rel/pkg/alpine/riak-nosu

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,19 +39,19 @@ case "$1" in
3939
;;
4040
admin)
4141
shift
42-
riak-admin $*
42+
riak-admin --suppress-deprecation-warning $*
4343
;;
4444
chkconfig)
4545
shift
46-
riak-chkconfig $*
46+
riak-chkconfig --suppress-deprecation-warning $*
4747
;;
4848
repl)
4949
shift
50-
riak-repl $*
50+
riak-repl --suppress-deprecation-warning $*
5151
;;
5252
debug)
5353
shift
54-
riak-debug $*
54+
riak-debug --suppress-deprecation-warning $*
5555
;;
5656
*)
5757
ESCAPED_ARGS=`echo "$@" | sed -e 's/\([\\\(\\\){}"\x27]\)/\\\\\1/g'`

rel/vars.config

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@
4747
%%{pipe_dir, "$PLATFORM_BASE_DIR/tmp/riak"}.
4848
%%{pid_dir, "$PLATFORM_BASE_DIR/var/run/riak"}.
4949

50+
%% suppress hyphenated form deprecation warning for releases made with
51+
%% `make rel` (as opposed to releases made for packaging)
52+
{suppress_hyphen_deprec_warning, "yes"}.
53+
5054
%%
5155
%% cuttlefish
5256
%%

0 commit comments

Comments
 (0)