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:
parent
67068afd6b
commit
25639cec42
@ -151,6 +151,7 @@ in {
|
|||||||
requiredBy = bindsTo;
|
requiredBy = bindsTo;
|
||||||
before = bindsTo;
|
before = bindsTo;
|
||||||
script = ''
|
script = ''
|
||||||
|
${ip} netns delete ${netnsName} 2> /dev/null || true
|
||||||
${ip} netns add ${netnsName}
|
${ip} netns add ${netnsName}
|
||||||
${ipNetns} link set lo up
|
${ipNetns} link set lo up
|
||||||
${ip} link add ${veth} type veth peer name ${peer}
|
${ip} link add ${veth} type veth peer name ${peer}
|
||||||
@ -179,7 +180,6 @@ in {
|
|||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
Type = "oneshot";
|
Type = "oneshot";
|
||||||
RemainAfterExit = "yes";
|
RemainAfterExit = "yes";
|
||||||
ExecStartPre = "-${ip} netns delete ${netnsName}";
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user