Rename bearer_token to bearer

Signed-off-by: Vladimir Avdeev <v.avdeev@yadro.com>
This commit is contained in:
Vladimir Avdeev 2022-10-18 13:39:39 +03:00 committed by Vladimir Avdeev
parent 7d54641e54
commit 7fcbdb6c34
8 changed files with 53 additions and 53 deletions

View file

@ -208,7 +208,7 @@ def form_bearertoken_file(
json.dump(eacl_result, eacl_file, ensure_ascii=False, indent=4)
logger.info(f"Got these extended ACL records: {eacl_result}")
sign_bearer_token(wif, file_path)
sign_bearer(wif, file_path)
return file_path
@ -235,7 +235,7 @@ def eacl_rules(access: str, verbs: list, user: str) -> list[str]:
return rules
def sign_bearer_token(wallet_path: str, eacl_rules_file: str) -> None:
def sign_bearer(wallet_path: str, eacl_rules_file: str) -> None:
cmd = (
f"{NEOFS_CLI_EXEC} util sign bearer-token --from {eacl_rules_file} "
f"--to {eacl_rules_file} --wallet {wallet_path} --config {WALLET_CONFIG} --json"

View file

@ -27,7 +27,7 @@ def get_link_object(
cid: str,
oid: str,
shell: Shell,
bearer_token: str = "",
bearer: str = "",
wallet_config: str = WALLET_CONFIG,
):
"""
@ -37,7 +37,7 @@ def get_link_object(
cid (str): Container ID which stores the Large Object
oid (str): Large Object ID
shell: executor for cli command
bearer_token (optional, str): path to Bearer token file
bearer (optional, str): path to Bearer token file
wallet_config (optional, str): path to the neofs-cli config file
Returns:
(str): Link Object ID
@ -54,7 +54,7 @@ def get_link_object(
endpoint=node,
is_raw=True,
is_direct=True,
bearer_token=bearer_token,
bearer=bearer,
wallet_config=wallet_config,
)
if resp["link"]:

View file

@ -26,7 +26,7 @@ def get_object(
cid: str,
oid: str,
shell: Shell,
bearer_token: Optional[str] = None,
bearer: Optional[str] = None,
write_object: str = "",
endpoint: str = "",
xhdr: Optional[dict] = None,
@ -42,7 +42,7 @@ def get_object(
cid (str): ID of Container where we get the Object from
oid (str): Object ID
shell: executor for cli command
bearer_token (optional, str): path to Bearer Token file, appends to `--bearer` key
bearer (optional, str): path to Bearer Token file, appends to `--bearer` key
write_object (optional, str): path to downloaded file, appends to `--file` key
endpoint (optional, str): NeoFS endpoint to send request to, appends to `--rpc-endpoint` key
wallet_config(optional, str): path to the wallet config
@ -67,7 +67,7 @@ def get_object(
cid=cid,
oid=oid,
file=file_path,
bearer=bearer_token,
bearer=bearer,
no_progress=no_progress,
xhdr=xhdr,
session=session,
@ -83,7 +83,7 @@ def get_range_hash(
oid: str,
range_cut: str,
shell: Shell,
bearer_token: Optional[str] = None,
bearer: Optional[str] = None,
endpoint: Optional[str] = None,
wallet_config: Optional[str] = None,
xhdr: Optional[dict] = None,
@ -96,7 +96,7 @@ def get_range_hash(
cid (str): ID of Container where we get the Object from
oid (str): Object ID
shell: executor for cli command
bearer_token (optional, str): path to Bearer Token file, appends to `--bearer` key
bearer (optional, str): path to Bearer Token file, appends to `--bearer` key
range_cut (str): Range to take hash from in the form offset1:length1,...,
value to pass to the `--range` parameter
endpoint (optional, str): NeoFS endpoint to send request to, appends to `--rpc-endpoint` key
@ -113,7 +113,7 @@ def get_range_hash(
cid=cid,
oid=oid,
range=range_cut,
bearer=bearer_token,
bearer=bearer,
xhdr=xhdr,
)

View file

@ -33,7 +33,7 @@ def can_get_object(
wallet,
cid,
oid,
bearer_token=bearer,
bearer=bearer,
wallet_config=wallet_config,
xhdr=xhdr,
shell=shell,
@ -171,7 +171,7 @@ def can_get_range_hash_of_object(
wallet,
cid,
oid,
bearer_token=bearer,
bearer=bearer,
range_cut="0:10",
wallet_config=wallet_config,
xhdr=xhdr,

View file

@ -19,7 +19,7 @@ def put_storagegroup(
wallet: str,
cid: str,
objects: list,
bearer_token: str = "",
bearer: str = "",
wallet_config: str = WALLET_CONFIG,
lifetime: str = "10",
):
@ -31,7 +31,7 @@ def put_storagegroup(
wallet (str): path to wallet on whose behalf the SG is created
cid (str): ID of Container to put SG to
objects (list): list of Object IDs to include into the SG
bearer_token (optional, str): path to Bearer token file
bearer (optional, str): path to Bearer token file
wallet_config (optional, str): path to neofs-cli config file
Returns:
(str): Object ID of created Storage Group
@ -41,7 +41,7 @@ def put_storagegroup(
f"--wallet {wallet} --config {wallet_config} "
f"storagegroup put --cid {cid} --lifetime {lifetime} "
f'--members {",".join(objects)} '
f'{"--bearer " + bearer_token if bearer_token else ""}'
f'{"--bearer " + bearer if bearer else ""}'
)
output = _cmd_run(cmd)
oid = output.split("\n")[1].split(": ")[1]
@ -50,7 +50,7 @@ def put_storagegroup(
@allure.step("List Storagegroup")
def list_storagegroup(
wallet: str, cid: str, bearer_token: str = "", wallet_config: str = WALLET_CONFIG
wallet: str, cid: str, bearer: str = "", wallet_config: str = WALLET_CONFIG
):
"""
Wrapper for `neofs-cli storagegroup list`. This operation
@ -59,7 +59,7 @@ def list_storagegroup(
wallet (str): path to wallet on whose behalf the SGs are
listed in the container
cid (str): ID of Container to list
bearer_token (optional, str): path to Bearer token file
bearer (optional, str): path to Bearer token file
wallet_config (optional, str): path to neofs-cli config file
Returns:
(list): Object IDs of found Storage Groups
@ -67,7 +67,7 @@ def list_storagegroup(
cmd = (
f"{NEOFS_CLI_EXEC} --rpc-endpoint {NEOFS_ENDPOINT} "
f"--wallet {wallet} --config {wallet_config} storagegroup list "
f'--cid {cid} {"--bearer " + bearer_token if bearer_token else ""}'
f'--cid {cid} {"--bearer " + bearer if bearer else ""}'
)
output = _cmd_run(cmd)
# throwing off the first string of output
@ -80,7 +80,7 @@ def get_storagegroup(
wallet: str,
cid: str,
oid: str,
bearer_token: str = "",
bearer: str = "",
wallet_config: str = WALLET_CONFIG,
):
"""
@ -89,7 +89,7 @@ def get_storagegroup(
wallet (str): path to wallet on whose behalf the SG is got
cid (str): ID of Container where SG is stored
oid (str): ID of the Storage Group
bearer_token (optional, str): path to Bearer token file
bearer (optional, str): path to Bearer token file
wallet_config (optional, str): path to neofs-cli config file
Returns:
(dict): detailed information on the Storage Group
@ -99,7 +99,7 @@ def get_storagegroup(
f"{NEOFS_CLI_EXEC} --rpc-endpoint {NEOFS_ENDPOINT} "
f"--wallet {wallet} --config {wallet_config} "
f"storagegroup get --cid {cid} --id {oid} "
f'{"--bearer " + bearer_token if bearer_token else ""}'
f'{"--bearer " + bearer if bearer else ""}'
)
output = _cmd_run(cmd)
@ -126,7 +126,7 @@ def delete_storagegroup(
wallet: str,
cid: str,
oid: str,
bearer_token: str = "",
bearer: str = "",
wallet_config: str = WALLET_CONFIG,
):
"""
@ -135,7 +135,7 @@ def delete_storagegroup(
wallet (str): path to wallet on whose behalf the SG is deleted
cid (str): ID of Container where SG is stored
oid (str): ID of the Storage Group
bearer_token (optional, str): path to Bearer token file
bearer (optional, str): path to Bearer token file
wallet_config (optional, str): path to neofs-cli config file
Returns:
(str): Tombstone ID of the deleted Storage Group
@ -145,7 +145,7 @@ def delete_storagegroup(
f"{NEOFS_CLI_EXEC} --rpc-endpoint {NEOFS_ENDPOINT} "
f"--wallet {wallet} --config {wallet_config} "
f"storagegroup delete --cid {cid} --id {oid} "
f'{"--bearer " + bearer_token if bearer_token else ""}'
f'{"--bearer " + bearer if bearer else ""}'
)
output = _cmd_run(cmd)
tombstone_id = output.strip().split("\n")[1].split(": ")[1]
@ -161,7 +161,7 @@ def verify_list_storage_group(
wallet_config: str = WALLET_CONFIG,
):
storage_groups = list_storagegroup(
wallet, cid, bearer_token=bearer, wallet_config=wallet_config
wallet, cid, bearer=bearer, wallet_config=wallet_config
)
assert storagegroup in storage_groups
@ -181,21 +181,21 @@ def verify_get_storage_group(
if object_size == COMPLEX_OBJ_SIZE:
for obj in obj_list:
link_oid = get_link_object(
wallet, cid, obj, shell=shell, bearer_token=bearer, wallet_config=wallet_config
wallet, cid, obj, shell=shell, bearer=bearer, wallet_config=wallet_config
)
obj_head = head_object(
wallet,
cid,
link_oid,
is_raw=True,
bearer_token=bearer,
bearer=bearer,
wallet_config=wallet_config,
)
obj_parts = obj_head["header"]["split"]["children"]
obj_num = len(obj_list)
storagegroup_data = get_storagegroup(
wallet, cid, storagegroup, bearer_token=bearer, wallet_config=wallet_config
wallet, cid, storagegroup, bearer=bearer, wallet_config=wallet_config
)
if object_size == SIMPLE_OBJ_SIZE:
exp_size = SIMPLE_OBJ_SIZE * obj_num