Skip to content

Commit

Permalink
Merge pull request #849 from douglasjacobsen/deployment-pull-error-fix
Browse files Browse the repository at this point in the history
Improve error messages when pulling invalid / incomplete deployments
  • Loading branch information
rfbgo authored Jan 29, 2025
2 parents 2b2fc05 + 07200a3 commit 0d2c915
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions lib/ramble/ramble/cmd/deployment.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
from ramble.main import RambleCommand
import ramble.util.path

from ramble.util.logger import logger


description = "(experimental) manage workspace deployments"
section = "workspaces"
Expand Down Expand Up @@ -127,7 +129,14 @@ def pull_file(src, dest):
)
local_index_path = os.path.join(ws.root, push_cls.index_filename)

pull_file(remote_index_path, local_index_path)
try:
pull_file(remote_index_path, local_index_path)
except ramble.fetch_strategy.FetchError:
logger.die(
"Error extracting deployment index file.\n"
" Make sure your deployment was pushed with "
"`ramble deployment push` before pulling it."
)

with open(local_index_path) as f:
index_data = sjson.load(f)
Expand All @@ -138,7 +147,13 @@ def pull_file(src, dest):
if os.path.exists(dest):
fs.force_remove(dest)

pull_file(src, dest)
try:
pull_file(src, dest)
except ramble.fetch_strategy.FetchError:
logger.die(
f"Error fetching file {file} from deployment. "
"Deployment may be corrupt or incomplete."
)

obj_repo_path = os.path.join(
ws.root, ramble.pipeline.PushDeploymentPipeline.object_repo_name
Expand Down

0 comments on commit 0d2c915

Please sign in to comment.