Skip to content

Commit

Permalink
[release-17.0] Remove viper warnings from local examples (#13234) (#1…
Browse files Browse the repository at this point in the history
…3268)

* --config-file-not-found-handling wasn't being read, fixed. Added this flag to all binaries in local examples

Signed-off-by: Rohit Nayak <rohit@planetscale.com>

* Prefer vtctldclient instead of vtctlclient in teardown

Signed-off-by: Rohit Nayak <rohit@planetscale.com>

* Address review comments

Signed-off-by: Rohit Nayak <rohit@planetscale.com>

---------

Signed-off-by: Rohit Nayak <rohit@planetscale.com>
Co-authored-by: Rohit Nayak <rohit@planetscale.com>
  • Loading branch information
vitess-bot[bot] and rohit-nayak-ps authored Jun 12, 2023
1 parent 5ecbd45 commit 22995b4
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
7 changes: 6 additions & 1 deletion examples/common/env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ for binary in mysqld etcd etcdctl curl vtctlclient vttablet vtgate vtctld mysqlc
command -v "$binary" > /dev/null || fail "${binary} is not installed in PATH. See https://vitess.io/docs/get-started/local/ for install instructions."
done;

# vtctlclient has a separate alias setup below
for binary in vttablet vtgate vtctld mysqlctl vtorc vtctl; do
alias $binary="$binary --config-file-not-found-handling=ignore"
done;

if [ "${TOPO}" = "zk2" ]; then
# Each ZooKeeper server needs a list of all servers in the quorum.
# Since we're running them all locally, we need to give them unique ports.
Expand Down Expand Up @@ -79,7 +84,7 @@ mkdir -p "${VTDATAROOT}/tmp"
# such as ~/.my.cnf

alias mysql="command mysql --no-defaults -h 127.0.0.1 -P 15306"
alias vtctlclient="command vtctlclient --server localhost:15999 --log_dir ${VTDATAROOT}/tmp --alsologtostderr"
alias vtctlclient="command vtctlclient --server localhost:15999 --log_dir ${VTDATAROOT}/tmp --alsologtostderr --config-file-not-found-handling=ignore"
alias vtctldclient="command vtctldclient --server localhost:15999"

# Make sure aliases are expanded in non-interactive shell
Expand Down
2 changes: 1 addition & 1 deletion examples/local/401_teardown.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ source ../common/env.sh
../common/scripts/vtgate-down.sh

for tablet in 100 200 300 400; do
if vtctlclient --action_timeout 1s --server localhost:15999 GetTablet zone1-$tablet >/dev/null 2>&1; then
if vtctldclient --action_timeout 1s --server localhost:15999 GetTablet zone1-$tablet >/dev/null 2>&1; then
# The zero tablet is up. Try to shutdown 0-2 tablet + mysqlctl
for i in 0 1 2; do
uid=$((tablet + i))
Expand Down
7 changes: 4 additions & 3 deletions go/viperutil/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,9 @@ var (
configFileNotFoundHandling = Configure(
"config.notfound.handling",
Options[ConfigFileNotFoundHandling]{
Default: WarnOnConfigFileNotFound,
GetFunc: getHandlingValue,
Default: WarnOnConfigFileNotFound,
GetFunc: getHandlingValue,
FlagName: "config-file-not-found-handling",
},
)
configPersistenceMinInterval = Configure(
Expand Down Expand Up @@ -110,7 +111,7 @@ func RegisterFlags(fs *pflag.FlagSet) {
var h = configFileNotFoundHandling.Default()
fs.Var(&h, "config-file-not-found-handling", fmt.Sprintf("Behavior when a config file is not found. (Options: %s)", strings.Join(handlingNames, ", ")))

BindFlags(fs, configPaths, configType, configName, configFile)
BindFlags(fs, configPaths, configType, configName, configFile, configFileNotFoundHandling, configPersistenceMinInterval)
}

// LoadConfig attempts to find, and then load, a config file for viper-backed
Expand Down

0 comments on commit 22995b4

Please sign in to comment.