@@ -887,6 +887,12 @@ def __init__(self):
887887 ),
888888 default_value = list ,
889889 ),
890+ ArgValidatorNum (
891+ "dns_priority" ,
892+ val_min = - 2147483648 ,
893+ val_max = 2147483647 ,
894+ default_value = 0 ,
895+ ),
890896 ArgValidatorList (
891897 "routing_rule" ,
892898 nested = ArgValidatorIPRoutingRule ("routing_rule[?]" ),
@@ -911,6 +917,7 @@ def __init__(self):
911917 "dns" : [],
912918 "dns_search" : [],
913919 "dns_options" : [],
920+ "dns_priority" : 0 ,
914921 },
915922 )
916923
@@ -2470,19 +2477,23 @@ def _ipv6_is_not_configured(connection):
24702477 "IPv6 needs to be enabled to support IPv6 nameservers." ,
24712478 )
24722479 # when IPv4 and IPv6 are disabled, setting ip.dns_options or
2473- # ip.dns_search is not allowed
2474- if connection ["ip" ]["dns_search" ] or connection ["ip" ]["dns_options" ]:
2480+ # ip.dns_search or ip.dns_priority is not allowed
2481+ if (
2482+ connection ["ip" ]["dns_search" ]
2483+ or connection ["ip" ]["dns_options" ]
2484+ or connection ["ip" ]["dns_priority" ]
2485+ ):
24752486 if not _ipv4_enabled (connection ) and connection ["ip" ]["ipv6_disabled" ]:
24762487 raise ValidationError .from_connection (
24772488 idx ,
2478- "Setting 'dns_search' or 'dns_options' is not allowed when "
2479- "both IPv4 and IPv6 are disabled." ,
2489+ "Setting 'dns_search', 'dns_options' and 'dns_priority' are not "
2490+ "allowed when both IPv4 and IPv6 are disabled." ,
24802491 )
24812492 elif not _ipv4_enabled (connection ) and _ipv6_is_not_configured (connection ):
24822493 raise ValidationError .from_connection (
24832494 idx ,
2484- "Setting 'dns_search' or 'dns_options' is not allowed when "
2485- "IPv4 is disabled and IPv6 is not configured." ,
2495+ "Setting 'dns_search', 'dns_options' and 'dns_priority' are not "
2496+ "allowed when IPv4 is disabled and IPv6 is not configured." ,
24862497 )
24872498 # DNS options 'inet6', 'ip6-bytestring', 'ip6-dotint', 'no-ip6-dotint' are only
24882499 # supported for IPv6 configuration, so raise errors when IPv6 is disabled
0 commit comments