diff options
author | pnv1 <pnv1@yandex-team.ru> | 2022-02-21 23:25:13 +0300 |
---|---|---|
committer | pnv1 <pnv1@yandex-team.ru> | 2022-02-21 23:25:13 +0300 |
commit | 700cb9d71f7c7a16721d302c2b9960ab189d104d (patch) | |
tree | 59215320d6b998897efb5de531aae61115322ebb | |
parent | 733e8ce19209d6d6c748d9ea454d4ad0c154b22e (diff) | |
download | ydb-700cb9d71f7c7a16721d302c2b9960ab189d104d.tar.gz |
Add --no-password option to YDB CLI, KIKIMR-12991
ref:6b79c474477a3da35518b55d85ea12398f9c44ff
4 files changed, 6 insertions, 3 deletions
diff --git a/ydb/public/lib/ydb_cli/commands/ydb_root_common.cpp b/ydb/public/lib/ydb_cli/commands/ydb_root_common.cpp index 2cccf42a41f..49710325cdd 100644 --- a/ydb/public/lib/ydb_cli/commands/ydb_root_common.cpp +++ b/ydb/public/lib/ydb_cli/commands/ydb_root_common.cpp @@ -197,6 +197,8 @@ void TClientCommandRootCommon::Config(TConfig& config) { << " 3. \"YDB_PASSWORD\" environment variable" << Endl << " 4. Active configuration profile"; opts.AddLongOption("password-file", passwordHelp).RequiredArgument("PATH").StoreResult(&PasswordFile); + + opts.AddLongOption("no-password", "Do not ask for user password (if empty)").Optional().StoreTrue(&DoNotAskForPassword); } if (config.UseIamAuth) { @@ -540,7 +542,7 @@ void TClientCommandRootCommon::ParseCredentials(TConfig& config) { if (config.UseStaticCredentials) { if (config.StaticCredentials.User) { - if (!config.StaticCredentials.Password) { + if (!config.StaticCredentials.Password && !DoNotAskForPassword) { Cout << "Enter password for user " << config.StaticCredentials.User << ": "; config.StaticCredentials.Password = InputPassword(); } diff --git a/ydb/public/lib/ydb_cli/commands/ydb_root_common.h b/ydb/public/lib/ydb_cli/commands/ydb_root_common.h index a9433e3d7fc..3ffa024ed33 100644 --- a/ydb/public/lib/ydb_cli/commands/ydb_root_common.h +++ b/ydb/public/lib/ydb_cli/commands/ydb_root_common.h @@ -52,6 +52,7 @@ private: TString UserName; TString PasswordFile; + bool DoNotAskForPassword = false; bool UseMetadataCredentials = false; TString YCToken; diff --git a/ydb/tests/functional/ydb_cli/canondata/test_ydb_scripting.TestScriptingServiceHelp.test_help/result.output b/ydb/tests/functional/ydb_cli/canondata/test_ydb_scripting.TestScriptingServiceHelp.test_help/result.output index d48b46bb85e..59efc0ae2f6 100644 --- a/ydb/tests/functional/ydb_cli/canondata/test_ydb_scripting.TestScriptingServiceHelp.test_help/result.output +++ b/ydb/tests/functional/ydb_cli/canondata/test_ydb_scripting.TestScriptingServiceHelp.test_help/result.output @@ -3,7 +3,7 @@ Usage: ydb [global options...] scripting yql [options...] Description: Execute YQL script Global options: - {-e|--endpoint}, {-d|--database}, {-v|--verbose}, --ca-file, --token-file, --user, --password-file, --profile + {-e|--endpoint}, {-d|--database}, {-v|--verbose}, --ca-file, --token-file, --user, --password-file, --no-password, --profile To get full description of these options run 'ydb --help'. Options: diff --git a/ydb/tests/functional/ydb_cli/canondata/test_ydb_scripting.TestScriptingServiceHelp.test_help_ex/result.output b/ydb/tests/functional/ydb_cli/canondata/test_ydb_scripting.TestScriptingServiceHelp.test_help_ex/result.output index 4cc80dc6eac..4e6dec2ae9f 100644 --- a/ydb/tests/functional/ydb_cli/canondata/test_ydb_scripting.TestScriptingServiceHelp.test_help_ex/result.output +++ b/ydb/tests/functional/ydb_cli/canondata/test_ydb_scripting.TestScriptingServiceHelp.test_help_ex/result.output @@ -3,7 +3,7 @@ Usage: ydb [global options...] scripting yql [options...] Description: Execute YQL script Global options: - {-e|--endpoint}, {-d|--database}, {-v|--verbose}, --ca-file, --token-file, --user, --password-file, --profile + {-e|--endpoint}, {-d|--database}, {-v|--verbose}, --ca-file, --token-file, --user, --password-file, --no-password, --profile To get full description of these options run 'ydb --help'. Options: |