do not catch error in HEAD as we need it fails on empty response

Signed-off-by: anastasia prasolova <anastasia@nspcc.ru>
This commit is contained in:
anastasia prasolova 2022-06-01 01:17:40 +03:00 committed by Anastasia Prasolova
parent e489b43d63
commit d696a8ee68
2 changed files with 20 additions and 17 deletions

View file

@ -247,13 +247,7 @@ def head_object(wallet: str, cid: str, oid: str, bearer_token: str="",
f'{"--raw" if is_raw else ""} ' f'{"--raw" if is_raw else ""} '
f'{"--ttl 1" if is_direct else ""}' f'{"--ttl 1" if is_direct else ""}'
) )
output = None
try:
output = _cmd_run(cmd) output = _cmd_run(cmd)
except Exception as exc:
logger.info(f"Head request failed with output: {output}")
return None
if not json_output: if not json_output:
return output return output

View file

@ -10,6 +10,7 @@ import complex_object_actions
import neofs_verbs import neofs_verbs
from robot.api.deco import keyword from robot.api.deco import keyword
from robot.api import logger
ROBOT_AUTO_KEYWORDS = False ROBOT_AUTO_KEYWORDS = False
@ -51,11 +52,15 @@ def get_simple_object_copies(wallet: str, cid: str, oid: str):
""" """
copies = 0 copies = 0
for node in NEOFS_NETMAP: for node in NEOFS_NETMAP:
try:
response = neofs_verbs.head_object(wallet, cid, oid, response = neofs_verbs.head_object(wallet, cid, oid,
endpoint=node, endpoint=node,
is_direct=True) is_direct=True)
if response: if response:
copies += 1 copies += 1
except Exception as exc:
logger.info(f"No {oid} object copy found on {node}, continue")
continue
return copies return copies
@ -94,11 +99,15 @@ def get_nodes_with_object(wallet: str, cid: str, oid: str):
""" """
nodes_list = [] nodes_list = []
for node in NEOFS_NETMAP: for node in NEOFS_NETMAP:
try:
res = neofs_verbs.head_object(wallet, cid, oid, res = neofs_verbs.head_object(wallet, cid, oid,
endpoint=node, endpoint=node,
is_direct=True) is_direct=True)
if res is not None: if res is not None:
nodes_list.append(node) nodes_list.append(node)
except Exception as exc:
logger.info(f"No {oid} object copy found on {node}, continue")
continue
return nodes_list return nodes_list