Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog/58210.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Render post/pre up/down and hwaddr options for debian-ip. See #58210 and #57820.
5 changes: 3 additions & 2 deletions salt/templates/debian_ip/debian_eth.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@
} -%}
{% set concat_opts = ['dns_nameservers'] -%}
{% set valid_opts = [
'autoconf', 'privext', 'dhcp', 'hwaddress', 'vlan_raw_device', 'address', 'addresses', 'netmask',
'autoconf', 'privext', 'dhcp', 'hwaddress', 'hwaddr', 'vlan_raw_device', 'address', 'addresses', 'netmask',
'metric', 'gateway', 'pointopoint', 'scope', 'hostname', 'media', 'leasehours', 'leasetime',
'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', 'accept_ra'
'wpa_roam', 'wpa_ssid', 'accept_ra', 'up_cmds', 'down_cmds', 'pre_up_cmds', 'post_up_cmds',
'pre_down_cmds', 'post_down_cmds'
] -%}
{% if data.enabled %}auto {{ name }}
{% endif %}{% if data.hotplug %}allow-hotplug {{ name }}
Expand Down
55 changes: 55 additions & 0 deletions tests/pytests/unit/modules/test_debian_ip.py
Original file line number Diff line number Diff line change
Expand Up @@ -845,6 +845,61 @@ def test_interfaces():
' gateway 2001:db8:dead:beef::1\n',
' accept_ra 2\n',
'\n']},

# Command hooks
{'iface_name': 'eth_optmap_test', 'iface_type': 'eth', 'enabled': True,
'build_interface': {
'proto': 'manual',
'up_cmds': ['echo "interface up"'],
'down_cmds': ['echo "interface down"'],
'pre_up_cmds': ['echo "pre-up"'],
'post_up_cmds': ['echo "post-up"'],
'pre_down_cmds': ['echo "pre-down"'],
'post_down_cmds': ['echo "post-down"'],
},
'get_interface': odict([('eth_optmap_test', odict([('enabled', True), ('data', odict([
('inet', odict([
('addrfam', 'inet'),
('proto', 'manual'),
('filename', None),
('up_cmds', ['echo "interface up"']),
('down_cmds', ['echo "interface down"']),
('pre_up_cmds', ['echo "pre-up"']),
('post_up_cmds', ['echo "post-up"']),
('pre_down_cmds', ['echo "pre-down"']),
('post_down_cmds', ['echo "post-down"']),
])),
]))]))]),
'return': [
'auto eth_optmap_test\n',
'iface eth_optmap_test inet manual\n',
' up echo "interface up"\n',
' down echo "interface down"\n',
' pre-up echo "pre-up"\n',
' post-up echo "post-up"\n',
' pre-down echo "pre-down"\n',
' post-down echo "post-down"\n',
'\n']},

# hwaddr should map to hwaddress
{'iface_name': 'eth_hwaddr_test', 'iface_type': 'eth', 'enabled': True,
'build_interface': {
'proto': 'manual',
'hwaddr': '00:11:22:33:44:55',
},
'get_interface': odict([('eth_hwaddr_test', odict([('enabled', True), ('data', odict([
('inet', odict([
('addrfam', 'inet'),
('proto', 'manual'),
('filename', None),
('hwaddress', '00:11:22:33:44:55'),
])),
]))]))]),
'return': [
'auto eth_hwaddr_test\n',
'iface eth_hwaddr_test inet manual\n',
' hwaddress 00:11:22:33:44:55\n',
'\n']},
]
# fmt: on

Expand Down