Skip to content

Commit fa27b29

Browse files
committed
Correcion en enlace simbólico de env manejado por shared_files cuando está declarado en config
1 parent 0cfc655 commit fa27b29

2 files changed

Lines changed: 15 additions & 10 deletions

File tree

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ __pycache__/
55
*.pyc
66
venv/
77
.env
8-
env
8+
env
9+
CLAUDE.md

fabricator/recipes.py

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,11 @@ def shared_files(
138138
if not shared_files and not shared_dirs:
139139
return
140140

141-
# Define the shared base path and the current release path
142-
shared_dir = os.path.join(config['deploy_path'], 'shared')
141+
# Define the shared base path (persistent) and the current release path.
142+
# original_path is the base deploy dir; deploy_path has been repointed to
143+
# the new release folder by the time this function is called.
144+
base_path = config.get('original_path', config['deploy_path'])
145+
shared_dir = os.path.join(base_path, 'shared')
143146
release_dir = config['deploy_path']
144147

145148
# Ensure the shared directory exists
@@ -191,8 +194,8 @@ def shared_files(
191194
remote_user = c.run("whoami", hide=True)
192195
if remote_user:
193196
remote_user = remote_user.stdout.strip()
194-
c.sudo(f"mkdir -p {shared_dir}", warn=True)
195-
c.sudo(f"chown {remote_user}:{remote_user} {shared_dir}")
197+
c.sudo(f"mkdir -p {shared_subdir}", warn=True)
198+
c.sudo(f"chown {remote_user}:{remote_user} {shared_subdir}")
196199

197200
# Create or update the symlink in the release directory
198201
c.run(f"ln -sfn {shared_subdir} {release_subdir}", warn=True)
@@ -672,11 +675,12 @@ def deploy_to_release_folder(
672675
# Move __clone_tmp__ into the final release folder
673676
c.sudo(f"mv {tmp_path} {release_path}", warn=True)
674677

675-
# Link the env file (used for secrets) into the new release
676-
env_source = os.path.join(deploy_path, "env")
677-
env_target = os.path.join(release_path, "env")
678-
c.sudo(f"ln -sf {env_source} {env_target}", warn=True)
679-
logger.info(f"env linked: {env_target} -> {env_source}")
678+
# Link the env file only if not managed by shared_files
679+
if "env" not in config.get("shared_files", []):
680+
env_source = os.path.join(deploy_path, "env")
681+
env_target = os.path.join(release_path, "env")
682+
c.sudo(f"ln -sf {env_source} {env_target}", warn=True)
683+
logger.info(f"env linked: {env_target} -> {env_source}")
680684

681685
# Log release creation details
682686
logger.info(f"Release created at: {release_path}")

0 commit comments

Comments
 (0)