mirror of
https://github.com/valitydev/salt.git
synced 2024-11-06 08:35:21 +00:00
Merge pull request #54067 from Natrinicle/add-accept-ra-option
Adding accept_ra 2 option to modules.debian_ip
This commit is contained in:
commit
37ceccb6bd
@ -475,7 +475,7 @@ IPV6_ATTR_MAP = {
|
||||
'dhcp': __within([0, 1], dtype=int),
|
||||
# inet6 static & manual & dhcp
|
||||
'media': __anything,
|
||||
'accept_ra': __within([0, 1], dtype=int),
|
||||
'accept_ra': __within([0, 1, 2], dtype=int),
|
||||
'autoconf': __within([0, 1], dtype=int),
|
||||
'preferred-lifetime': __int,
|
||||
'dad-attempts': __int, # 0 to disable
|
||||
|
@ -8,6 +8,7 @@
|
||||
'pre_down_cmds': 'pre-down',
|
||||
'post_down_cmds': 'post-down',
|
||||
'master': 'bond-master',
|
||||
'accept_ra': 'accept_ra',
|
||||
} -%}
|
||||
{% set concat_opts = ['dns_nameservers'] -%}
|
||||
{% set valid_opts = [
|
||||
@ -16,14 +17,14 @@
|
||||
'vendor', 'client', 'bootfile', 'server', 'mode', 'endpoint', 'dstaddr', 'local', 'ttl', 'mtu',
|
||||
'provider', 'unit', 'options', 'master', 'dns_nameservers', 'wireless_mode', 'wpa_ap_scan',
|
||||
'wpa_conf', 'wpa_driver', 'wpa_group', 'wpa_key_mgmt', 'wpa_pairwise', 'wpa_proto', 'wpa_psk',
|
||||
'wpa_roam', 'wpa_ssid',
|
||||
'wpa_roam', 'wpa_ssid', 'accept_ra'
|
||||
] -%}
|
||||
{% if data.enabled %}auto {{ name }}
|
||||
{% endif %}{% if data.hotplug %}allow-hotplug {{ name }}
|
||||
{% endif %}{% for inet in ['inet', 'inet6'] -%}
|
||||
{% if data.data[inet] and data.data[inet].addrfam == inet %}{% set interface = data.data[inet] -%}
|
||||
{% if interface.proto and interface.addrfam %}iface {{name}} {{interface.addrfam}} {{interface.proto}}
|
||||
{% for opt in valid_opts %}{% set debopt = optmap.get(opt, opt).replace('_', '-') -%}
|
||||
{% for opt in valid_opts %}{% set debopt = optmap.get(opt, opt.replace('_', '-')) -%}
|
||||
{% set val = interface.get(opt, False) %}{% if val -%}
|
||||
{% if opt in concat_opts and val is iterable %} {{ debopt }} {{ val|join(' ') }}
|
||||
{% elif val is string or val is number %} {{ debopt }} {{ val }}
|
||||
|
@ -784,6 +784,37 @@ test_interfaces = [
|
||||
' address 2001:db8:dead:c0::3/64\n',
|
||||
' gateway 2001:db8:dead:c0::1\n',
|
||||
'\n']},
|
||||
|
||||
# IPv6-only; static with autoconf and accept_ra forced
|
||||
{'iface_name': 'eth20', 'iface_type': 'eth', 'enabled': True,
|
||||
'build_interface': {
|
||||
'ipv6proto': 'static',
|
||||
'ipv6ipaddr': '2001:db8:dead:beef::3/64',
|
||||
'ipv6gateway': '2001:db8:dead:beef::1',
|
||||
'enable_ipv6': True,
|
||||
'autoconf': 1,
|
||||
'accept_ra': 2,
|
||||
'noifupdown': True,
|
||||
},
|
||||
'get_interface': odict([('eth20', odict([('enabled', True), ('data', odict([
|
||||
('inet6', odict([
|
||||
('addrfam', 'inet6'),
|
||||
('proto', 'static'),
|
||||
('filename', None),
|
||||
('autoconf', 1),
|
||||
('address', '2001:db8:dead:beef::3/64'),
|
||||
('gateway', '2001:db8:dead:beef::1'),
|
||||
('accept_ra', 2),
|
||||
])),
|
||||
]))]))]),
|
||||
'return': [
|
||||
'auto eth20\n',
|
||||
'iface eth20 inet6 static\n',
|
||||
' autoconf 1\n',
|
||||
' address 2001:db8:dead:beef::3/64\n',
|
||||
' gateway 2001:db8:dead:beef::1\n',
|
||||
' accept_ra 2\n',
|
||||
'\n']},
|
||||
]
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user