Skip to content
This repository has been archived by the owner on Oct 10, 2020. It is now read-only.

Commit

Permalink
iQIcBAABAgAGBQJXl4HaAAoJECY9bfLhY+HqwDUQALySpEGSeB3eCpt8wkyTYAfK
Browse files Browse the repository at this point in the history
 eHdqnMTRA0tvlZoGFiM0orGIGa1TKS4nWwuTfks6W4z9Ldh0qEowhHmbCzsS5M0c
 N9ToecgT7tlPJ8q3XO+0AyMjGZ65Wc61FKuboHH/IRiOSmlgqkwkAORtps7y+1p6
 NkZ6Oml+lYXhmMIUmiHOool22zi9zv4DJutyj3gSIptbcvBMyOXOsIjRMcvU9Jrb
 bWgZtgfA1wJtAkABqTJAbA3NsZ5FbT2goGk4TI/lz4yqEI0urADGW/x3McGAA6td
 SIXePJvQEm1rLp0luYx5Ap6m78Sf7reUsFPbWt7iTsF8P80U1oyMQrW+iNeh3JDm
 WU3PJXSALyPKO+3Gjnh+swtJURU2pdGfqbmFmyqohjSshYBtRJ3mI81PjiE1Or+A
 F6q+LkTDTa/Am4UFaebJYBviNtkuLPSy1M8n7G9q9lebGX0KDcHfheAlKGBM+PrH
 hBqyL70Pk7YU968MKN47Z+TKwuai+hcu+rkA+JPF178iIy8Z4z5cTPVZ1KvCF/q4
 smrL/zWaFsGTehEL8Xv5uVOBNPz8ziCR+n7c0TNPYU2VlabyNheNFBH57R8GqCQq
 ZU099W5RuDINGNcQFyA6jHnTbeDBXI4p9TGNO+yuFg8BivdZIP1aLi9aB+htJ71F
 nfL6weQb0O7E6PVG1orz
 =5ADz
 -----END PGP SIGNATURE-----

syscontainers: do not leave broken symlink on uninstall

Use `os.path.lexists' to verify its presence.  Delete the symlink before
the deployments, so that the container doesn't look installed while its
being deleted.

Closes: #495

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>

Closes: #497
Approved by: jlebon
  • Loading branch information
giuseppe authored and rh-atomic-bot committed Jul 26, 2016
1 parent d5efda3 commit 401ef56
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 2 additions & 3 deletions Atomic/syscontainers.py
Original file line number Diff line number Diff line change
Expand Up @@ -401,12 +401,11 @@ def uninstall_system_container(self, name):
except subprocess.CalledProcessError:
pass

if os.path.lexists("%s/%s" % (self._get_system_checkout_path(), name)):
os.unlink("%s/%s" % (self._get_system_checkout_path(), name))
for deploy in ["0", "1"]:
if os.path.exists("%s/%s.%s" % (self._get_system_checkout_path(), name, deploy)):
shutil.rmtree("%s/%s.%s" % (self._get_system_checkout_path(), name, deploy))
if os.path.exists("%s/%s" % (self._get_system_checkout_path(), name)):
os.unlink("%s/%s" % (self._get_system_checkout_path(), name))

if os.path.exists(os.path.join(SYSTEMD_UNIT_FILES_DEST, "%s.service" % name)):
os.unlink(os.path.join(SYSTEMD_UNIT_FILES_DEST, "%s.service" % name))

Expand Down
3 changes: 3 additions & 0 deletions tests/integration/test_system_containers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ ${ATOMIC} umount ${WORK_DIR}/mount

${ATOMIC} uninstall ${NAME}
test \! -e /etc/systemd/system/${NAME}.service
test \! -e ${ATOMIC_OSTREE_CHECKOUT_PATH}/${NAME}
test \! -e ${ATOMIC_OSTREE_CHECKOUT_PATH}/${NAME}.0
test \! -e ${ATOMIC_OSTREE_CHECKOUT_PATH}/${NAME}.1

# check that there are not any "ociimage/" prefixed branch left after images prune
ostree --repo=${ATOMIC_OSTREE_REPO} refs --delete "ociimage/atomic-test-system-latest"
Expand Down

0 comments on commit 401ef56

Please sign in to comment.