1
0
mirror of https://github.com/projectatomic/atomic.git synced 2026-02-05 18:45:01 +01:00

syscontainers: remove tmpfiles conf file on error

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

Closes: #665
Approved by: rhatdan
This commit is contained in:
Giuseppe Scrivano
2016-09-26 11:08:53 +02:00
committed by Atomic Bot
parent b807043930
commit fc0aea92ea
2 changed files with 11 additions and 5 deletions

View File

@@ -262,6 +262,11 @@ class SystemContainers(object):
shutil.rmtree(unitfileout)
except OSError:
pass
try:
if not upgrade:
shutil.rmtree(tmpfilesout)
except OSError:
pass
raise e
def _do_checkout_system_container(self, repo, name, img, upgrade, values, destination, unitfileout, tmpfilesout, extract_only, remote):

View File

@@ -87,6 +87,7 @@ teardown () {
systemctl stop $NAME-failed &> /dev/null || true
systemctl disable $NAME-failed &> /dev/null || true
rm -rf /etc/systemd/system/${NAME}-failed.service || true
rm /etc/tmpfiles.d/${NAME}.conf || true
}
trap teardown EXIT
@@ -132,26 +133,26 @@ assert_matches "running" ps.out
# A duplicate will fail due to using the same port
${ATOMIC} install --name=${NAME}-failed --set=RECEIVER=${SECRET} --system oci:atomic-test-system
systemctl start ${NAME}-failed
${ATOMIC} containers list --all | grep "test-system" > ps.out
${ATOMIC} containers list --all --no-trunc | grep "test-system" > ps.out
assert_matches "failed" ps.out
systemctl stop ${NAME}
systemctl stop ${NAME}-failed
${ATOMIC} uninstall ${NAME}-failed
${ATOMIC} containers list --all | grep "test-system" > ps.out
${ATOMIC} containers list --all --no-trunc | grep "test-system" > ps.out
assert_matches "inactive" ps.out
# Test that containers can be started/stopped with run/stop
${ATOMIC} run ${NAME}
${ATOMIC} containers list --all | grep "test-system" > ps.out
${ATOMIC} containers list --all --no-trunc | grep "test-system" > ps.out
assert_matches "running" ps.out
${ATOMIC} stop ${NAME}
${ATOMIC} containers list --all | grep "test-system" > ps.out
${ATOMIC} containers list --all --no-trunc | grep "test-system" > ps.out
assert_matches "inactive" ps.out
${ATOMIC} containers list --quiet > ps.out
${ATOMIC} containers list --no-trunc --quiet > ps.out
assert_not_matches "test-system" ps.out
test -e /etc/systemd/system/${NAME}.service