[#182] Refactoring old functions for FrostfsCli

Refactoring old functions for FrostfsCli

Signed-off-by: Mikhail Kadilov m.kadilov@yadro.com
This commit is contained in:
Mikhail Kadilov 2024-02-19 13:01:29 +03:00 committed by Andrey Berezin
parent 273f0d13a5
commit 3fc3eaadf3
5 changed files with 121 additions and 63 deletions

View file

@ -39,14 +39,12 @@ class FrostfsCliControl(CliCommand):
address: Optional[str] = None,
timeout: Optional[str] = None,
) -> CommandResult:
"""Set status of the storage node in FrostFS network map
"""Health check for FrostFS storage nodes
Args:
wallet: Path to the wallet or binary key
address: Address of wallet account
endpoint: Remote node control address (as 'multiaddr' or '<host>:<port>')
force: Force turning to local maintenance
status: New netmap status keyword ('online', 'offline', 'maintenance')
timeout: Timeout for an operation (default 15s)
Returns:
@ -56,3 +54,28 @@ class FrostfsCliControl(CliCommand):
"control healthcheck",
**{param: value for param, value in locals().items() if param not in ["self"]},
)
def drop_objects(
self,
endpoint: str,
objects: str,
wallet: Optional[str] = None,
address: Optional[str] = None,
timeout: Optional[str] = None,
) -> CommandResult:
"""Drop objects from the node's local storage
Args:
wallet: Path to the wallet or binary key
address: Address of wallet account
endpoint: Remote node control address (as 'multiaddr' or '<host>:<port>')
objects: List of object addresses to be removed in string format
timeout: Timeout for an operation (default 15s)
Returns:
Command`s result.
"""
return self._execute(
"control drop-objects",
**{param: value for param, value in locals().items() if param not in ["self"]},
)

View file

@ -357,7 +357,7 @@ class FrostfsCliObject(CliCommand):
wallet: Optional[str] = None,
address: Optional[str] = None,
bearer: Optional[str] = None,
generate_key: Optional = None,
generate_key: Optional[bool] = None,
oid: Optional[str] = None,
trace: bool = False,
root: bool = False,

View file

@ -39,10 +39,10 @@ class FrostfsCliShards(CliCommand):
def set_mode(
self,
endpoint: str,
wallet: str,
wallet_password: str,
mode: str,
id: Optional[list[str]],
wallet: Optional[str] = None,
wallet_password: Optional[str] = None,
address: Optional[str] = None,
all: bool = False,
clear_errors: bool = False,
@ -65,6 +65,11 @@ class FrostfsCliShards(CliCommand):
Returns:
Command's result.
"""
if not wallet_password:
return self._execute(
"control shards set-mode",
**{param: value for param, value in locals().items() if param not in ["self"]},
)
return self._execute_with_password(
"control shards set-mode",
wallet_password,
@ -137,3 +142,4 @@ class FrostfsCliShards(CliCommand):
wallet_password,
**{param: value for param, value in locals().items() if param not in ["self", "wallet_password"]},
)