Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[release-17.0] Remove viper warnings from local examples (#13234) #13268

Merged
merged 3 commits into from
Jun 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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