diff --git a/software/software/ostree_utils.py b/software/software/ostree_utils.py index c5e713e1..5e36e6ad 100644 --- a/software/software/ostree_utils.py +++ b/software/software/ostree_utils.py @@ -287,14 +287,17 @@ def mount_new_deployment(deployment_dir): LOG.warning(info_msg) raise OSTreeCommandFail(msg) finally: - try: - sh.mount("/usr/local/kubernetes/current/stage1") - sh.mount("/usr/local/kubernetes/current/stage2") - except sh.ErrorReturnCode: - 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) + # Handle the switch from bind mounts to symlinks for K8s versions. + # Can be removed once the switch is complete. + if os.path.isdir('/usr/local/kubernetes/current'): + try: + sh.mount("/usr/local/kubernetes/current/stage1") + sh.mount("/usr/local/kubernetes/current/stage2") + except sh.ErrorReturnCode: + 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(): diff --git a/sw-patch/cgcs-patch/cgcs_patch/ostree_utils.py b/sw-patch/cgcs-patch/cgcs_patch/ostree_utils.py index 8a373b84..c406c7f7 100644 --- a/sw-patch/cgcs-patch/cgcs_patch/ostree_utils.py +++ b/sw-patch/cgcs-patch/cgcs_patch/ostree_utils.py @@ -313,14 +313,17 @@ def mount_new_deployment(deployment_dir): LOG.warning(info_msg) raise OSTreeCommandFail(msg) finally: - try: - sh.mount("/usr/local/kubernetes/current/stage1") - sh.mount("/usr/local/kubernetes/current/stage2") - except sh.ErrorReturnCode: - 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) + # Handle the switch from bind mounts to symlinks for K8s versions. + # Can be removed once the switch is complete. + if os.path.isdir('/usr/local/kubernetes/current'): + try: + sh.mount("/usr/local/kubernetes/current/stage1") + sh.mount("/usr/local/kubernetes/current/stage2") + except sh.ErrorReturnCode: + 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():