From 7db775133457c4e435d799a2684bbb14e57b6bc1 Mon Sep 17 00:00:00 2001 From: Anton Nikiforov Date: Wed, 23 Aug 2023 15:00:03 +0300 Subject: [PATCH] [#95] Allow to use wallet from config file for frostfs-cli Signed-off-by: Anton Nikiforov --- scenarios/preset/helpers/frostfs_cli.py | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/scenarios/preset/helpers/frostfs_cli.py b/scenarios/preset/helpers/frostfs_cli.py index 71331a3..5a7632d 100644 --- a/scenarios/preset/helpers/frostfs_cli.py +++ b/scenarios/preset/helpers/frostfs_cli.py @@ -2,7 +2,11 @@ import re from helpers.cmd import execute_cmd, log def create_container(endpoint, policy, wallet_file, wallet_config): - cmd_line = f"frostfs-cli --rpc-endpoint {endpoint} container create --wallet {wallet_file} --config {wallet_config} " \ + if wallet_file: + wallet_file = "--wallet " + wallet_file + if wallet_config: + wallet_config = "--config " + wallet_config + cmd_line = f"frostfs-cli --rpc-endpoint {endpoint} container create {wallet_file} {wallet_config} " \ f" --policy '{policy}' --basic-acl public-read-write --await" output, success = execute_cmd(cmd_line) @@ -31,7 +35,11 @@ def create_container(endpoint, policy, wallet_file, wallet_config): def upload_object(container, payload_filepath, endpoint, wallet_file, wallet_config): object_name = "" - cmd_line = f"frostfs-cli --rpc-endpoint {endpoint} object put --file {payload_filepath} --wallet {wallet_file} --config {wallet_config} " \ + if wallet_file: + wallet_file = "--wallet " + wallet_file + if wallet_config: + wallet_config = "--config " + wallet_config + cmd_line = f"frostfs-cli --rpc-endpoint {endpoint} object put --file {payload_filepath} {wallet_file} {wallet_config} " \ f"--cid {container} --no-progress" output, success = execute_cmd(cmd_line) @@ -56,7 +64,11 @@ def upload_object(container, payload_filepath, endpoint, wallet_file, wallet_con def get_object(cid, oid, endpoint, out_filepath, wallet_file, wallet_config): - cmd_line = f"frostfs-cli object get -r {endpoint} --cid {cid} --oid {oid} --wallet {wallet_file} --config {wallet_config} " \ + if wallet_file: + wallet_file = "--wallet " + wallet_file + if wallet_config: + wallet_config = "--config " + wallet_config + cmd_line = f"frostfs-cli object get -r {endpoint} --cid {cid} --oid {oid} {wallet_file} {wallet_config} " \ f"--file {out_filepath}" output, success = execute_cmd(cmd_line) @@ -71,7 +83,11 @@ def get_object(cid, oid, endpoint, out_filepath, wallet_file, wallet_config): def search_object_by_id(cid, oid, endpoint, wallet_file, wallet_config, ttl=2): - cmd_line = f"frostfs-cli object search --ttl {ttl} -r {endpoint} --cid {cid} --oid {oid} --wallet {wallet_file} --config {wallet_config} " + if wallet_file: + wallet_file = "--wallet " + wallet_file + if wallet_config: + wallet_config = "--config " + wallet_config + cmd_line = f"frostfs-cli object search --ttl {ttl} -r {endpoint} --cid {cid} --oid {oid} {wallet_file} {wallet_config} " output, success = execute_cmd(cmd_line)