mirror of
https://github.com/apple/container.git
synced 2026-09-28 01:46:25 -04:00
Reject conflicting DNS flags (#1559)
Rejects conflicting DNS configuration when `--no-dns` is supplied together with explicit DNS flags. Fixes #1536.
This commit is contained in:
@@ -344,6 +344,21 @@ public struct Flags {
|
||||
|
||||
@Option(name: [.customLong("volume"), .short], help: "Bind mount a volume into the container")
|
||||
public var volumes: [String] = []
|
||||
|
||||
public func validate() throws {
|
||||
if dnsDisabled {
|
||||
let hasDNSConfig =
|
||||
!dns.nameservers.isEmpty
|
||||
|| dns.domain != nil
|
||||
|| !dns.options.isEmpty
|
||||
|| !dns.searchDomains.isEmpty
|
||||
if hasDNSConfig {
|
||||
throw ValidationError(
|
||||
"`--no-dns` cannot be used with DNS configuration flags (`--dns`, `--dns-domain`, `--dns-option`, `--dns-search`)"
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public struct Progress: ParsableArguments {
|
||||
|
||||
Reference in New Issue
Block a user