Allow to use wallet from config file for frostfs-cli #95

Merged
fyrchik merged 1 commit from acid-ant/xk6-frostfs:bugfix/wallet-from-config-in-preset into master 2023-08-23 16:11:16 +00:00

View file

@ -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)