nixos-container destroy: Make idempotent
This commit is contained in:
parent
82666653d2
commit
e6c00e60c3
@ -154,7 +154,10 @@ my $root = "/var/lib/containers/$containerName";
|
||||
my $profileDir = "/nix/var/nix/profiles/per-container/$containerName";
|
||||
my $gcRootsDir = "/nix/var/nix/gcroots/per-container/$containerName";
|
||||
my $confFile = "/etc/containers/$containerName.conf";
|
||||
die "$0: container ‘$containerName’ does not exist\n" if !-e $confFile;
|
||||
if (!-e $confFile) {
|
||||
exit 0 if $action eq "destroy";
|
||||
die "$0: container ‘$containerName’ does not exist\n" ;
|
||||
}
|
||||
|
||||
sub isContainerRunning {
|
||||
my $status = `systemctl show 'container\@$containerName'`;
|
||||
|
Loading…
Reference in New Issue
Block a user