Browse Source

Fixed processing of incorrect database

brgayazov 2 years ago
parent
commit
79bf94c9cb
1 changed files with 6 additions and 5 deletions
  1. 6 5
      ydb/public/lib/ydb_cli/commands/ydb_root_common.cpp

+ 6 - 5
ydb/public/lib/ydb_cli/commands/ydb_root_common.cpp

@@ -296,17 +296,18 @@ void TClientCommandRootCommon::ParseDatabase(TConfig& config) {
 
 void TClientCommandRootCommon::Validate(TConfig& config) {
     TClientCommandRootBase::Validate(config);
+    if (!config.NeedToConnect) {
+        return;
+    }
 
-    if (Address.empty() && config.NeedToConnect) {
+    if (Address.empty()) {
         throw TMisuseException()
             << "Missing required option 'endpoint'.";
     }
 
     if (Database.empty()) {
-        if (config.NeedToConnect) {
-            throw TMisuseException()
-                << "Missing required option 'database'.";
-        }
+        throw TMisuseException()
+            << "Missing required option 'database'.";
     } else if (!Database.StartsWith('/')) {
         throw TMisuseException() << "Path to a database \"" << Database
             << "\" is incorrect. It must be absolute and thus must begin with '/'.";