forked from TrueCloudLab/frostfs-testcases
Add "try" and "exception" block in Create Container keyword
Signed-off-by: EliChin <elizaveta@nspcc.ru>
This commit is contained in:
parent
57fc4874e8
commit
5f1fc77cb2
1 changed files with 12 additions and 7 deletions
|
@ -292,14 +292,19 @@ def create_container(private_key: str, basic_acl:str, rule:str, user_headers: st
|
||||||
f'container create --policy "{rule}" {basic_acl} {user_headers} --await'
|
f'container create --policy "{rule}" {basic_acl} {user_headers} --await'
|
||||||
)
|
)
|
||||||
logger.info("Cmd: %s" % createContainerCmd)
|
logger.info("Cmd: %s" % createContainerCmd)
|
||||||
|
try:
|
||||||
complProc = subprocess.run(createContainerCmd, check=True, universal_newlines=True,
|
complProc = subprocess.run(createContainerCmd, check=True, universal_newlines=True,
|
||||||
stdout=subprocess.PIPE, stderr=subprocess.PIPE, timeout=300, shell=True)
|
stdout=subprocess.PIPE, stderr=subprocess.PIPE, timeout=300, shell=True)
|
||||||
output = complProc.stdout
|
output = complProc.stdout
|
||||||
logger.info("Output: %s" % output)
|
logger.info("Output: %s" % output)
|
||||||
cid = _parse_cid(output)
|
cid = _parse_cid(output)
|
||||||
logger.info("Created container %s with rule '%s'" % (cid, rule))
|
logger.info("Created container %s with rule '%s'" % (cid, rule))
|
||||||
|
|
||||||
return cid
|
return cid
|
||||||
|
|
||||||
|
except subprocess.CalledProcessError as e:
|
||||||
|
raise Exception("command '{}' return with error (code {}): {}".format(e.cmd, e.returncode, e.output))
|
||||||
|
|
||||||
|
|
||||||
@keyword('Container List')
|
@keyword('Container List')
|
||||||
def container_list(private_key: str):
|
def container_list(private_key: str):
|
||||||
|
|
Loading…
Reference in a new issue