mirror of
https://github.com/podman-container-tools/podman.git
synced 2026-08-05 08:25:40 +00:00
pkg/namespaces: fix NetworkMode IsNS and IsUserDefined
NetworkMode.IsNS matched any value starting with "ns" (e.g. a network named "nsproxy"), unlike UsernsMode.IsNS which requires the "ns:" prefix; require it. IsUserDefined also did not exclude pod, so a pod network was reported as user-defined; exclude it. Signed-off-by: ROKUMATE <rohitkumawat0110@gmail.com>
This commit is contained in:
parent
f6afcfaf26
commit
a535016f97
1 changed files with 2 additions and 2 deletions
|
|
@ -208,7 +208,7 @@ func (n NetworkMode) IsPasta() bool {
|
|||
|
||||
// IsNS indicates a network namespace passed in by path (ns:<path>)
|
||||
func (n NetworkMode) IsNS() bool {
|
||||
return strings.HasPrefix(string(n), nsType)
|
||||
return strings.HasPrefix(string(n), nsType+":")
|
||||
}
|
||||
|
||||
// NS gets the path associated with a ns:<path> network ns
|
||||
|
|
@ -224,5 +224,5 @@ func (n NetworkMode) IsPod() bool {
|
|||
|
||||
// IsUserDefined indicates user-created network
|
||||
func (n NetworkMode) IsUserDefined() bool {
|
||||
return !n.IsDefault() && !n.IsBridge() && !n.IsHost() && !n.IsNone() && !n.IsContainer() && !n.IsPasta() && !n.IsNS()
|
||||
return !n.IsDefault() && !n.IsBridge() && !n.IsHost() && !n.IsNone() && !n.IsContainer() && !n.IsPasta() && !n.IsNS() && !n.IsPod()
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue