forked from TrueCloudLab/xk6-frostfs
[#95] Allow to use wallet from config file for frostfs-cli
Signed-off-by: Anton Nikiforov <an.nikiforov@yadro.com>
This commit is contained in:
parent
bf884936a7
commit
7db7751334
1 changed files with 20 additions and 4 deletions
|
@ -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)
|
||||
|
||||
|
|
Loading…
Reference in a new issue