Add support for symlinks instead of bindmounts for version control
We have been using bind mounts to select K8s versions, but they are not well supported by Puppet and suffer from fragility since you cannot remove a bind mount while an executable is still running from it. They also need to be re-created when creating an OSTree hotfix or when applying software patches. Symlinks suffer from no such issues, they just need to be created in a filesystem that is not managed by OSTree. Accordingly, make the current bindmount-related code conditional on the bindmount directory actually being present. That way the code will not complain when we switch to using symlinks. Story: 2011047 Task: 49917 TEST PLAN: PASS: Run the modified code snippet standalone on system where /usr/local/kubernetes/current/ exists, ensure it attempts to run the two mount commands. PASS: Run the modified code snippet standalone on system where /usr/local/kubernetes/current/ does not exist, ensure it does not attempt to run the two mount commands. Change-Id: I1dfea974ae9532cf316bb1fac701ae93f5507681
This commit is contained in:
parent
c5a7d1d336
commit
5435387623
|
@ -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():
|
||||
|
|
|
@ -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():
|
||||
|
|
Loading…
Reference in New Issue