|
21 | 21 | from typing import Any |
22 | 22 |
|
23 | 23 | from cliff import columns as cliff_columns |
| 24 | +from openstack import utils as sdk_utils |
24 | 25 | from osc_lib import exceptions |
25 | 26 | from osc_lib import utils |
26 | 27 |
|
@@ -110,7 +111,9 @@ def get_parser(self, prog_name: str) -> argparse.ArgumentParser: |
110 | 111 | def take_action( |
111 | 112 | self, parsed_args: argparse.Namespace |
112 | 113 | ) -> tuple[Sequence[str], Iterable[Any]]: |
113 | | - volume_client = self.app.client_manager.sdk_connection.volume |
| 114 | + volume_client = sdk_utils.ensure_service_version( |
| 115 | + self.app.client_manager.sdk_connection.volume, '2' |
| 116 | + ) |
114 | 117 |
|
115 | 118 | volume_id = volume_client.find_volume( |
116 | 119 | parsed_args.volume, |
@@ -163,7 +166,9 @@ def get_parser(self, prog_name: str) -> argparse.ArgumentParser: |
163 | 166 | return parser |
164 | 167 |
|
165 | 168 | def take_action(self, parsed_args: argparse.Namespace) -> None: |
166 | | - volume_client = self.app.client_manager.sdk_connection.volume |
| 169 | + volume_client = sdk_utils.ensure_service_version( |
| 170 | + self.app.client_manager.sdk_connection.volume, '2' |
| 171 | + ) |
167 | 172 | result = 0 |
168 | 173 |
|
169 | 174 | for backup in parsed_args.backups: |
@@ -247,7 +252,9 @@ def get_parser(self, prog_name: str) -> argparse.ArgumentParser: |
247 | 252 | def take_action( |
248 | 253 | self, parsed_args: argparse.Namespace |
249 | 254 | ) -> tuple[Sequence[str], Iterable[tuple[Any, ...]]]: |
250 | | - volume_client = self.app.client_manager.sdk_connection.volume |
| 255 | + volume_client = sdk_utils.ensure_service_version( |
| 256 | + self.app.client_manager.sdk_connection.volume, '2' |
| 257 | + ) |
251 | 258 |
|
252 | 259 | columns: tuple[str, ...] = ( |
253 | 260 | 'id', |
@@ -362,7 +369,9 @@ def get_parser(self, prog_name: str) -> argparse.ArgumentParser: |
362 | 369 | def take_action( |
363 | 370 | self, parsed_args: argparse.Namespace |
364 | 371 | ) -> tuple[Sequence[str], Iterable[Any]]: |
365 | | - volume_client = self.app.client_manager.sdk_connection.volume |
| 372 | + volume_client = sdk_utils.ensure_service_version( |
| 373 | + self.app.client_manager.sdk_connection.volume, '2' |
| 374 | + ) |
366 | 375 |
|
367 | 376 | backup = volume_client.find_backup( |
368 | 377 | parsed_args.backup, |
@@ -428,7 +437,9 @@ def get_parser(self, prog_name: str) -> argparse.ArgumentParser: |
428 | 437 | return parser |
429 | 438 |
|
430 | 439 | def take_action(self, parsed_args: argparse.Namespace) -> None: |
431 | | - volume_client = self.app.client_manager.sdk_connection.volume |
| 440 | + volume_client = sdk_utils.ensure_service_version( |
| 441 | + self.app.client_manager.sdk_connection.volume, '2' |
| 442 | + ) |
432 | 443 |
|
433 | 444 | backup = volume_client.find_backup( |
434 | 445 | parsed_args.backup, |
@@ -465,7 +476,9 @@ def get_parser(self, prog_name: str) -> argparse.ArgumentParser: |
465 | 476 | def take_action( |
466 | 477 | self, parsed_args: argparse.Namespace |
467 | 478 | ) -> tuple[Sequence[str], Iterable[Any]]: |
468 | | - volume_client = self.app.client_manager.sdk_connection.volume |
| 479 | + volume_client = sdk_utils.ensure_service_version( |
| 480 | + self.app.client_manager.sdk_connection.volume, '2' |
| 481 | + ) |
469 | 482 | backup = volume_client.find_backup( |
470 | 483 | parsed_args.backup, ignore_missing=False |
471 | 484 | ) |
|
0 commit comments