def download_file(stackname, path, destination='.', allow_missing="False", use_bootstrap_user="False"):
"""
Downloads `path` from `stackname` putting it into the `destination` folder, or the `destination` file if it exists and it is a file.
If `allow_missing` is "True", a non-existant `path` will be skipped without errors.
If `use_bootstrap_user` is "True", the owner_ssh user will be used for connecting instead of the standard deploy user.
Boolean arguments are expressed as strings as this is the idiomatic way of passing them from the command line.
"""
allow_missing, use_bootstrap_user = map(strtobool, [allow_missing, use_bootstrap_user])
with stack_conn(stackname, username=BOOTSTRAP_USER if use_bootstrap_user else DEPLOY_USER):
if allow_missing and not files.exists(path):
return # skip download
get(path, destination, use_sudo=True)
评论列表
文章目录