[#321] update morph ape

This commit is contained in:
Ekaterina Chernitsyna 2024-11-18 12:43:00 +03:00
parent 3219dd6389
commit 2cbe1c1f1f
3 changed files with 37 additions and 42 deletions

View file

@ -69,9 +69,7 @@ class FrostfsAdmMorph(CliCommand):
**{param: param_value for param, param_value in locals().items() if param not in ["self"]}, **{param: param_value for param, param_value in locals().items() if param not in ["self"]},
) )
def set_config( def set_config(self, set_key_value: str, rpc_endpoint: Optional[str] = None, alphabet_wallets: Optional[str] = None) -> CommandResult:
self, set_key_value: str, rpc_endpoint: Optional[str] = None, alphabet_wallets: Optional[str] = None
) -> CommandResult:
"""Add/update global config value in the FrostFS network. """Add/update global config value in the FrostFS network.
Args: Args:
@ -124,9 +122,7 @@ class FrostfsAdmMorph(CliCommand):
**{param: param_value for param, param_value in locals().items() if param not in ["self"]}, **{param: param_value for param, param_value in locals().items() if param not in ["self"]},
) )
def force_new_epoch( def force_new_epoch(self, rpc_endpoint: Optional[str] = None, alphabet_wallets: Optional[str] = None) -> CommandResult:
self, rpc_endpoint: Optional[str] = None, alphabet_wallets: Optional[str] = None
) -> CommandResult:
"""Create new FrostFS epoch event in the side chain. """Create new FrostFS epoch event in the side chain.
Args: Args:
@ -344,20 +340,16 @@ class FrostfsAdmMorph(CliCommand):
return self._execute( return self._execute(
f"morph remove-nodes {' '.join(node_netmap_keys)}", f"morph remove-nodes {' '.join(node_netmap_keys)}",
**{ **{param: param_value for param, param_value in locals().items() if param not in ["self", "node_netmap_keys"]},
param: param_value
for param, param_value in locals().items()
if param not in ["self", "node_netmap_keys"]
},
) )
def add_rule( def add_rule(
self, self,
endpoint: str,
chain_id: str, chain_id: str,
target_name: str, target_name: str,
target_type: str, target_type: str,
rule: Optional[list[str]] = None, rule: Optional[list[str]] = None,
chain_name: Optional[str] = None,
path: Optional[str] = None, path: Optional[str] = None,
chain_id_hex: Optional[bool] = None, chain_id_hex: Optional[bool] = None,
wallet: Optional[str] = None, wallet: Optional[str] = None,
@ -367,10 +359,8 @@ class FrostfsAdmMorph(CliCommand):
"""Drop objects from the node's local storage """Drop objects from the node's local storage
Args: Args:
address: Address of wallet account
chain-id: Assign ID to the parsed chain chain-id: Assign ID to the parsed chain
chain-id-hex: Flag to parse chain ID as hex chain-id-hex: Flag to parse chain ID as hex
endpoint: Remote node control address (as 'multiaddr' or '<host>:<port>')
path: Path to encoded chain in JSON or binary format path: Path to encoded chain in JSON or binary format
rule: Rule statement rule: Rule statement
target-name: Resource name in APE resource name format target-name: Resource name in APE resource name format
@ -382,17 +372,17 @@ class FrostfsAdmMorph(CliCommand):
Command`s result. Command`s result.
""" """
return self._execute( return self._execute(
"control add-rule", "morph ape add-rule-chain",
**{param: value for param, value in locals().items() if param not in ["self"]}, **{param: value for param, value in locals().items() if param not in ["self"]},
) )
def get_rule( def get_rule(
self, self,
endpoint: str,
chain_id: str, chain_id: str,
target_name: str, target_name: str,
target_type: str, target_type: str,
chain_id_hex: Optional[bool] = None, chain_id_hex: Optional[bool] = None,
chain_name: Optional[str] = None,
wallet: Optional[str] = None, wallet: Optional[str] = None,
address: Optional[str] = None, address: Optional[str] = None,
timeout: Optional[str] = None, timeout: Optional[str] = None,
@ -400,10 +390,8 @@ class FrostfsAdmMorph(CliCommand):
"""Drop objects from the node's local storage """Drop objects from the node's local storage
Args: Args:
address string Address of wallet account
chain-id string Chain id chain-id string Chain id
chain-id-hex Flag to parse chain ID as hex chain-id-hex Flag to parse chain ID as hex
endpoint string Remote node control address (as 'multiaddr' or '<host>:<port>')
target-name string Resource name in APE resource name format target-name string Resource name in APE resource name format
target-type string Resource type(container/namespace) target-type string Resource type(container/namespace)
timeout duration Timeout for an operation (default 15s) timeout duration Timeout for an operation (default 15s)
@ -413,7 +401,7 @@ class FrostfsAdmMorph(CliCommand):
Command`s result. Command`s result.
""" """
return self._execute( return self._execute(
"control get-rule", "morph ape get-rule-chain",
**{param: value for param, value in locals().items() if param not in ["self"]}, **{param: value for param, value in locals().items() if param not in ["self"]},
) )
@ -429,8 +417,6 @@ class FrostfsAdmMorph(CliCommand):
"""Drop objects from the node's local storage """Drop objects from the node's local storage
Args: Args:
address: Address of wallet account
endpoint: Remote node control address (as 'multiaddr' or '<host>:<port>')
target-name: Resource name in APE resource name format target-name: Resource name in APE resource name format
target-type: Resource type(container/namespace) target-type: Resource type(container/namespace)
timeout: Timeout for an operation (default 15s) timeout: Timeout for an operation (default 15s)
@ -443,15 +429,15 @@ class FrostfsAdmMorph(CliCommand):
"morph ape list-rule-chains", "morph ape list-rule-chains",
**{param: value for param, value in locals().items() if param not in ["self"]}, **{param: value for param, value in locals().items() if param not in ["self"]},
) )
def remove_rule( def remove_rule(
self, self,
endpoint: str,
chain_id: str, chain_id: str,
target_name: str, target_name: str,
target_type: str, target_type: str,
all: Optional[bool] = None, all: Optional[bool] = None,
chain_id_hex: Optional[bool] = None, chain_id_hex: Optional[bool] = None,
chain_name: Optional[str] = None,
wallet: Optional[str] = None, wallet: Optional[str] = None,
address: Optional[str] = None, address: Optional[str] = None,
timeout: Optional[str] = None, timeout: Optional[str] = None,
@ -459,11 +445,9 @@ class FrostfsAdmMorph(CliCommand):
"""Drop objects from the node's local storage """Drop objects from the node's local storage
Args: Args:
address: Address of wallet account
all: Remove all chains all: Remove all chains
chain-id: Assign ID to the parsed chain chain-id: Assign ID to the parsed chain
chain-id-hex: Flag to parse chain ID as hex chain-id-hex: Flag to parse chain ID as hex
endpoint: Remote node control address (as 'multiaddr' or '<host>:<port>')
target-name: Resource name in APE resource name format target-name: Resource name in APE resource name format
target-type: Resource type(container/namespace) target-type: Resource type(container/namespace)
timeout: Timeout for an operation (default 15s) timeout: Timeout for an operation (default 15s)
@ -473,6 +457,6 @@ class FrostfsAdmMorph(CliCommand):
Command`s result. Command`s result.
""" """
return self._execute( return self._execute(
"control remove-rule", "morph ape rm-rule-chain",
**{param: value for param, value in locals().items() if param not in ["self"]}, **{param: value for param, value in locals().items() if param not in ["self"]},
) )

View file

@ -26,6 +26,20 @@ class ObjectOperations(HumanReadableEnum):
return [op for op in ObjectOperations if op != ObjectOperations.WILDCARD_ALL] return [op for op in ObjectOperations if op != ObjectOperations.WILDCARD_ALL]
class Operations(HumanReadableEnum):
GET_CONTAINER = "GetContainer"
PUT_CONTAINER = "PutContainer"
DELETE_CONTAINER = "DeleteContainer"
LIST_CONTAINER = "ListContainers"
GET_OBJECT = "GetObject"
DELETE_OBJECT = "DeleteObject"
HASH_OBJECT = "HashObject"
RANGE_OBJECT = "RangeObject"
SEARCH_OBJECT = "SearchObject"
HEAD_OBJECT = "HeadObject"
PUT_OBJECT = "PutObject"
class Verb(HumanReadableEnum): class Verb(HumanReadableEnum):
ALLOW = "allow" ALLOW = "allow"
DENY = "deny" DENY = "deny"

View file

@ -181,20 +181,17 @@ class ContainerOperations(interfaces.ContainerInterface):
force: bool = False, force: bool = False,
trace: bool = False, trace: bool = False,
): ):
try: return self.cli.container.delete(
return self.cli.container.delete( rpc_endpoint=endpoint,
rpc_endpoint=endpoint, cid=cid,
cid=cid, address=address,
address=address, await_mode=await_mode,
await_mode=await_mode, session=session,
session=session, ttl=ttl,
ttl=ttl, xhdr=xhdr,
xhdr=xhdr, force=force,
force=force, trace=trace,
trace=trace, ).stdout
).stdout
except RuntimeError as e:
print(f"Error request:\n{e}")
@reporter.step("Get container") @reporter.step("Get container")
def get( def get(