Skip to content

Commit 76e7d82

Browse files
authored
Fix ydb cli adjust path usage (#14404)
1 parent c166bec commit 76e7d82

File tree

6 files changed

+33
-14
lines changed

6 files changed

+33
-14
lines changed

ydb/public/lib/ydb_cli/commands/ydb_service_export.cpp

+7
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,10 @@ void TCommandExportToYt::Parse(TConfig& config) {
157157
if (Items.empty()) {
158158
throw TMisuseException() << "At least one item should be provided";
159159
}
160+
}
160161

162+
void TCommandExportToYt::ExtractParams(TConfig& config) {
163+
TClientCommand::ExtractParams(config);
161164
for (auto& item : Items) {
162165
NConsoleClient::AdjustPath(item.Source, config);
163166

@@ -317,6 +320,10 @@ void TCommandExportToS3::Parse(TConfig& config) {
317320
if (Items.empty()) {
318321
throw TMisuseException() << "At least one item should be provided";
319322
}
323+
}
324+
325+
void TCommandExportToS3::ExtractParams(TConfig& config) {
326+
TClientCommand::ExtractParams(config);
320327

321328
for (auto& item : Items) {
322329
NConsoleClient::AdjustPath(item.Source, config);

ydb/public/lib/ydb_cli/commands/ydb_service_export.h

+2
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ class TCommandExportToYt : public TYdbOperationCommand,
2727
TCommandExportToYt();
2828
virtual void Config(TConfig& config) override;
2929
virtual void Parse(TConfig& config) override;
30+
virtual void ExtractParams(TConfig& config) override;
3031
virtual int Run(TConfig& config) override;
3132

3233
private:
@@ -53,6 +54,7 @@ class TCommandExportToS3 : public TYdbOperationCommand,
5354
TCommandExportToS3();
5455
virtual void Config(TConfig& config) override;
5556
virtual void Parse(TConfig& config) override;
57+
virtual void ExtractParams(TConfig& config) override;
5658
virtual int Run(TConfig& config) override;
5759

5860
private:

ydb/public/lib/ydb_cli/commands/ydb_service_import.cpp

+9-1
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,10 @@ void TCommandImportFromS3::Parse(TConfig& config) {
126126
throw TMisuseException() << "At least one item should be provided";
127127
}
128128

129+
}
130+
131+
void TCommandImportFromS3::ExtractParams(TConfig& config) {
132+
TClientCommand::ExtractParams(config);
129133
for (auto& item : Items) {
130134
NConsoleClient::AdjustPath(item.Destination, config);
131135
}
@@ -246,7 +250,6 @@ void TCommandImportFileBase::Config(TConfig& config) {
246250

247251
void TCommandImportFileBase::Parse(TConfig& config) {
248252
TYdbCommand::Parse(config);
249-
AdjustPath(config);
250253

251254
if (auto bytesPerRequest = NYdb::SizeFromString(BytesPerRequest)) {
252255
if (bytesPerRequest > TImportFileSettings::MaxBytesPerRequest) {
@@ -275,6 +278,11 @@ void TCommandImportFileBase::Parse(TConfig& config) {
275278
}
276279
}
277280

281+
void TCommandImportFileBase::ExtractParams(TConfig& config) {
282+
TClientCommand::ExtractParams(config);
283+
AdjustPath(config);
284+
}
285+
278286
/// Import CSV
279287

280288
void TCommandImportFromCsv::Config(TConfig& config) {

ydb/public/lib/ydb_cli/commands/ydb_service_import.h

+2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ class TCommandImportFromS3 : public TYdbOperationCommand,
2222
TCommandImportFromS3();
2323
void Config(TConfig& config) override;
2424
void Parse(TConfig& config) override;
25+
void ExtractParams(TConfig& config) override;
2526
int Run(TConfig& config) override;
2627

2728
private:
@@ -56,6 +57,7 @@ class TCommandImportFileBase : public TYdbCommand,
5657
Args[0] = "<input files...>";
5758
}
5859
void Config(TConfig& config) override;
60+
void ExtractParams(TConfig& config) override;
5961
void Parse(TConfig& config) override;
6062

6163
protected:

ydb/public/lib/ydb_cli/commands/ydb_tools.cpp

+10-10
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,6 @@ void TCommandDump::Config(TConfig& config) {
8484
.DefaultValue(defaults.Ordered_).StoreTrue(&Ordered);
8585
}
8686

87-
void TCommandDump::Parse(TConfig& config) {
88-
TClientCommand::Parse(config);
89-
}
90-
9187
void TCommandDump::ExtractParams(TConfig& config) {
9288
TClientCommand::ExtractParams(config);
9389
AdjustPath(config);
@@ -199,8 +195,8 @@ void TCommandRestore::Config(TConfig& config) {
199195
config.Opts->MutuallyExclusive("import-data", "bulk-upsert");
200196
}
201197

202-
void TCommandRestore::Parse(TConfig& config) {
203-
TClientCommand::Parse(config);
198+
void TCommandRestore::ExtractParams(TConfig& config) {
199+
TClientCommand::ExtractParams(config);
204200
AdjustPath(config);
205201
}
206202

@@ -283,6 +279,10 @@ void TCommandCopy::Parse(TConfig& config) {
283279
if (Items.empty()) {
284280
throw TMisuseException() << "At least one item should be provided";
285281
}
282+
}
283+
284+
void TCommandCopy::ExtractParams(TConfig& config) {
285+
TClientCommand::ExtractParams(config);
286286

287287
for (auto& item : Items) {
288288
NConsoleClient::AdjustPath(item.Source, config);
@@ -373,6 +373,10 @@ void TCommandRename::Parse(TConfig& config) {
373373
if (Items.empty()) {
374374
throw TMisuseException() << "At least one item should be provided";
375375
}
376+
}
377+
378+
void TCommandRename::ExtractParams(TConfig& config) {
379+
TClientCommand::ExtractParams(config);
376380

377381
for (auto& item : Items) {
378382
NConsoleClient::AdjustPath(item.Source, config);
@@ -411,10 +415,6 @@ void TCommandPgConvert::Config(TConfig& config) {
411415
config.Opts->AddLongOption("ignore-unsupported", "Comment unsupported statements in result dump file if specified.").StoreTrue(&IgnoreUnsupported);
412416
}
413417

414-
void TCommandPgConvert::Parse(TConfig& config) {
415-
TToolsCommand::Parse(config);
416-
}
417-
418418
int TCommandPgConvert::Run(TConfig& config) {
419419
Y_UNUSED(config);
420420
TPgDumpParser parser(Cout, IgnoreUnsupported);

ydb/public/lib/ydb_cli/commands/ydb_tools.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ class TCommandDump : public TToolsCommand, public TCommandWithPath {
3232
public:
3333
TCommandDump();
3434
virtual void Config(TConfig& config) override;
35-
virtual void Parse(TConfig& config) override;
3635
virtual void ExtractParams(TConfig& config) override;
3736
virtual int Run(TConfig& config) override;
3837

@@ -51,7 +50,7 @@ class TCommandRestore : public TToolsCommand, public TCommandWithPath {
5150
public:
5251
TCommandRestore();
5352
virtual void Config(TConfig& config) override;
54-
virtual void Parse(TConfig& config) override;
53+
virtual void ExtractParams(TConfig& config) override;
5554
virtual int Run(TConfig& config) override;
5655

5756
private:
@@ -77,6 +76,7 @@ class TCommandCopy : public TTableCommand {
7776
TCommandCopy();
7877
virtual void Config(TConfig& config) override;
7978
virtual void Parse(TConfig& config) override;
79+
virtual void ExtractParams(TConfig& config) override;
8080
virtual int Run(TConfig& config) override;
8181

8282
private:
@@ -95,6 +95,7 @@ class TCommandRename : public TTableCommand, public TCommandWithExamples {
9595
TCommandRename();
9696
virtual void Config(TConfig& config) override;
9797
virtual void Parse(TConfig& config) override;
98+
virtual void ExtractParams(TConfig& config) override;
9899
virtual int Run(TConfig& config) override;
99100

100101
private:
@@ -113,7 +114,6 @@ class TCommandPgConvert : public TToolsCommand {
113114
public:
114115
TCommandPgConvert();
115116
virtual void Config(TConfig& config) override;
116-
virtual void Parse(TConfig& config) override;
117117
virtual int Run(TConfig& config) override;
118118

119119
private:

0 commit comments

Comments
 (0)