aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Iurt
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Iurt')
-rw-r--r--lib/Iurt/Chroot.pm8
1 files changed, 3 insertions, 5 deletions
diff --git a/lib/Iurt/Chroot.pm b/lib/Iurt/Chroot.pm
index 480fae4..1427aa3 100644
--- a/lib/Iurt/Chroot.pm
+++ b/lib/Iurt/Chroot.pm
@@ -33,6 +33,8 @@ sub clean_chroot {
plog('DEBUG', "clean chroot");
if (-d $chroot) {
+ # This also kills any process in the associated namespace
+ sudo($config, '--netns_delete', $chroot);
_clean_mounts($run, $config, $chroot);
# Do not run rm if there is something still mounted there
@@ -230,7 +232,7 @@ sub clean_all_chroot_tmp {
}
foreach (readdir($dir)) {
/$prefix/ or next;
- delete_chroot($run, $config, "$chroot_dir/$_");
+ clean_chroot($run, $config, "$chroot_dir/$_");
}
closedir $dir;
}
@@ -238,10 +240,6 @@ sub clean_all_chroot_tmp {
sub delete_chroot {
my ($run, $config, $chroot) = @_;
- # This also kills any process in the associated namespace
- sudo($config, '--netns_delete', $chroot);
- _clean_mounts($run, $config, $chroot);
-
plog(1, "cleaning $chroot");
# Needs to be added to iurt_root_command
# system("$sudo /sbin/fuser -k $chroot &> /dev/null");