def stage_product(product_name: str, my_settings: settings.Settings):
cmd = "{om_with_auth} curl --path /api/v0/available_products".format(
om_with_auth=get_om_with_auth(my_settings)
)
p = Popen(cmd, stdout=PIPE, stderr=PIPE, shell=True)
out, err = p.communicate()
if p.returncode != 0:
print("Failed to query api")
return out, err, p.returncode
products = json.loads(out.decode())
cf_version = [x['product_version'] for x in products if x['name'] == product_name][0]
# ok to call multiple times, no-op when already staged
cmd = "{om_with_auth} stage-product -p {product_name} -v {version}".format(
om_with_auth=get_om_with_auth(my_settings),
product_name=product_name,
version=cf_version
)
return util.exponential_backoff_cmd(cmd)
评论列表
文章目录