Merge "Add support for symlinks instead of bindmounts for version control"

This commit is contained in:
Zuul 2024-04-26 14:05:31 +00:00 committed by Gerrit Code Review
commit 1d6add41a2
2 changed files with 22 additions and 16 deletions

View File

@ -287,14 +287,17 @@ def mount_new_deployment(deployment_dir):
LOG.warning(info_msg) LOG.warning(info_msg)
raise OSTreeCommandFail(msg) raise OSTreeCommandFail(msg)
finally: finally:
try: # Handle the switch from bind mounts to symlinks for K8s versions.
sh.mount("/usr/local/kubernetes/current/stage1") # Can be removed once the switch is complete.
sh.mount("/usr/local/kubernetes/current/stage2") if os.path.isdir('/usr/local/kubernetes/current'):
except sh.ErrorReturnCode: try:
msg = "Failed to mount kubernetes. Please manually run these commands:\n" \ sh.mount("/usr/local/kubernetes/current/stage1")
"sudo mount /usr/local/kubernetes/current/stage1\n" \ sh.mount("/usr/local/kubernetes/current/stage2")
"sudo mount /usr/local/kubernetes/current/stage2\n" except sh.ErrorReturnCode:
LOG.info(msg) msg = "Failed to mount kubernetes. Please manually run these commands:\n" \
"sudo mount /usr/local/kubernetes/current/stage1\n" \
"sudo mount /usr/local/kubernetes/current/stage2\n"
LOG.info(msg)
def delete_older_deployments(): def delete_older_deployments():

View File

@ -313,14 +313,17 @@ def mount_new_deployment(deployment_dir):
LOG.warning(info_msg) LOG.warning(info_msg)
raise OSTreeCommandFail(msg) raise OSTreeCommandFail(msg)
finally: finally:
try: # Handle the switch from bind mounts to symlinks for K8s versions.
sh.mount("/usr/local/kubernetes/current/stage1") # Can be removed once the switch is complete.
sh.mount("/usr/local/kubernetes/current/stage2") if os.path.isdir('/usr/local/kubernetes/current'):
except sh.ErrorReturnCode: try:
msg = "Failed to mount kubernetes. Please manually run these commands:\n" \ sh.mount("/usr/local/kubernetes/current/stage1")
"sudo mount /usr/local/kubernetes/current/stage1\n" \ sh.mount("/usr/local/kubernetes/current/stage2")
"sudo mount /usr/local/kubernetes/current/stage2\n" except sh.ErrorReturnCode:
LOG.info(msg) msg = "Failed to mount kubernetes. Please manually run these commands:\n" \
"sudo mount /usr/local/kubernetes/current/stage1\n" \
"sudo mount /usr/local/kubernetes/current/stage2\n"
LOG.info(msg)
def delete_older_deployments(): def delete_older_deployments():