netns: fix error msg when starting netns

Previously, the failing initial `netns delete` resulted in a
"Cannot remove namespace file ..." error visible in the journal
and status output.
This commit is contained in:
Erik Arvstedt 2020-10-29 21:20:40 +01:00
parent 67068afd6b
commit 25639cec42
No known key found for this signature in database
GPG Key ID: 33312B944DD97846
1 changed files with 1 additions and 1 deletions

View File

@ -151,6 +151,7 @@ in {
requiredBy = bindsTo;
before = bindsTo;
script = ''
${ip} netns delete ${netnsName} 2> /dev/null || true
${ip} netns add ${netnsName}
${ipNetns} link set lo up
${ip} link add ${veth} type veth peer name ${peer}
@ -179,7 +180,6 @@ in {
serviceConfig = {
Type = "oneshot";
RemainAfterExit = "yes";
ExecStartPre = "-${ip} netns delete ${netnsName}";
};
};
};