Add support for setting defroute
Change-Id: I483d8f4189a569d58bc95591c7c86a88c9c5b5f3 Story: 2004884 Task: 29165
This commit is contained in:
@@ -128,6 +128,7 @@ net_routes = _make_attr_filter('routes')
|
|||||||
net_rules = _make_attr_filter('rules')
|
net_rules = _make_attr_filter('rules')
|
||||||
net_physical_network = _make_attr_filter('physical_network')
|
net_physical_network = _make_attr_filter('physical_network')
|
||||||
net_bootproto = _make_attr_filter('bootproto')
|
net_bootproto = _make_attr_filter('bootproto')
|
||||||
|
net_defroute = _make_attr_filter('defroute')
|
||||||
|
|
||||||
|
|
||||||
@jinja2.contextfilter
|
@jinja2.contextfilter
|
||||||
@@ -202,6 +203,7 @@ def net_interface_obj(context, name, inventory_hostname=None):
|
|||||||
routes = [_route_obj(route) for route in routes]
|
routes = [_route_obj(route) for route in routes]
|
||||||
rules = net_rules(context, name, inventory_hostname)
|
rules = net_rules(context, name, inventory_hostname)
|
||||||
bootproto = net_bootproto(context, name, inventory_hostname)
|
bootproto = net_bootproto(context, name, inventory_hostname)
|
||||||
|
defroute = net_defroute(context, name, inventory_hostname)
|
||||||
interface = {
|
interface = {
|
||||||
'device': device,
|
'device': device,
|
||||||
'address': ip,
|
'address': ip,
|
||||||
@@ -212,6 +214,7 @@ def net_interface_obj(context, name, inventory_hostname=None):
|
|||||||
'route': routes,
|
'route': routes,
|
||||||
'rules': rules,
|
'rules': rules,
|
||||||
'bootproto': bootproto or 'static',
|
'bootproto': bootproto or 'static',
|
||||||
|
'defroute': defroute,
|
||||||
'onboot': 'yes',
|
'onboot': 'yes',
|
||||||
}
|
}
|
||||||
interface = {k: v for k, v in interface.items() if v is not None}
|
interface = {k: v for k, v in interface.items() if v is not None}
|
||||||
@@ -244,6 +247,7 @@ def net_bridge_obj(context, name, inventory_hostname=None):
|
|||||||
routes = [_route_obj(route) for route in routes]
|
routes = [_route_obj(route) for route in routes]
|
||||||
rules = net_rules(context, name, inventory_hostname)
|
rules = net_rules(context, name, inventory_hostname)
|
||||||
bootproto = net_bootproto(context, name, inventory_hostname)
|
bootproto = net_bootproto(context, name, inventory_hostname)
|
||||||
|
defroute = net_defroute(context, name, inventory_hostname)
|
||||||
interface = {
|
interface = {
|
||||||
'device': device,
|
'device': device,
|
||||||
'address': ip,
|
'address': ip,
|
||||||
@@ -255,6 +259,7 @@ def net_bridge_obj(context, name, inventory_hostname=None):
|
|||||||
'route': routes,
|
'route': routes,
|
||||||
'rules': rules,
|
'rules': rules,
|
||||||
'bootproto': bootproto or 'static',
|
'bootproto': bootproto or 'static',
|
||||||
|
'defroute': defroute,
|
||||||
'onboot': 'yes',
|
'onboot': 'yes',
|
||||||
}
|
}
|
||||||
interface = {k: v for k, v in interface.items() if v is not None}
|
interface = {k: v for k, v in interface.items() if v is not None}
|
||||||
@@ -293,6 +298,7 @@ def net_bond_obj(context, name, inventory_hostname=None):
|
|||||||
routes = [_route_obj(route) for route in routes]
|
routes = [_route_obj(route) for route in routes]
|
||||||
rules = net_rules(context, name, inventory_hostname)
|
rules = net_rules(context, name, inventory_hostname)
|
||||||
bootproto = net_bootproto(context, name, inventory_hostname)
|
bootproto = net_bootproto(context, name, inventory_hostname)
|
||||||
|
defroute = net_defroute(context, name, inventory_hostname)
|
||||||
interface = {
|
interface = {
|
||||||
'device': device,
|
'device': device,
|
||||||
'address': ip,
|
'address': ip,
|
||||||
@@ -310,6 +316,7 @@ def net_bond_obj(context, name, inventory_hostname=None):
|
|||||||
'route': routes,
|
'route': routes,
|
||||||
'rules': rules,
|
'rules': rules,
|
||||||
'bootproto': bootproto or 'static',
|
'bootproto': bootproto or 'static',
|
||||||
|
'defroute': defroute,
|
||||||
'onboot': 'yes',
|
'onboot': 'yes',
|
||||||
}
|
}
|
||||||
interface = {k: v for k, v in interface.items() if v is not None}
|
interface = {k: v for k, v in interface.items() if v is not None}
|
||||||
@@ -464,6 +471,7 @@ class FilterModule(object):
|
|||||||
'net_rules': net_rules,
|
'net_rules': net_rules,
|
||||||
'net_physical_network': net_physical_network,
|
'net_physical_network': net_physical_network,
|
||||||
'net_bootproto': net_bootproto,
|
'net_bootproto': net_bootproto,
|
||||||
|
'net_defroute': net_defroute,
|
||||||
'net_interface_obj': net_interface_obj,
|
'net_interface_obj': net_interface_obj,
|
||||||
'net_bridge_obj': net_bridge_obj,
|
'net_bridge_obj': net_bridge_obj,
|
||||||
'net_bond_obj': net_bond_obj,
|
'net_bond_obj': net_bond_obj,
|
||||||
|
@@ -240,6 +240,12 @@ The following attributes are supported:
|
|||||||
Boot protocol for the interface. Valid values are ``static`` and ``dhcp``.
|
Boot protocol for the interface. Valid values are ``static`` and ``dhcp``.
|
||||||
The default is ``static``. When set to ``dhcp``, an external DHCP server
|
The default is ``static``. When set to ``dhcp``, an external DHCP server
|
||||||
must be provided.
|
must be provided.
|
||||||
|
``defroute``
|
||||||
|
Whether to set the interface as the default route. This attribute can be
|
||||||
|
used to disable configuration of the default gateway by a specific
|
||||||
|
interface. This is particularly useful to ignore a gateway address provided
|
||||||
|
via DHCP. Should be set to a boolean value. The default is unset. This
|
||||||
|
attribute is only supported on distributions of the Red Hat family.
|
||||||
``bridge_ports``
|
``bridge_ports``
|
||||||
For bridge interfaces, a list of names of network interfaces to add to the
|
For bridge interfaces, a list of names of network interfaces to add to the
|
||||||
bridge.
|
bridge.
|
||||||
|
8
releasenotes/notes/defroute-9bbcff8b2f8abc94.yaml
Normal file
8
releasenotes/notes/defroute-9bbcff8b2f8abc94.yaml
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
---
|
||||||
|
features:
|
||||||
|
- |
|
||||||
|
Adds support for the ``defroute`` network attribute. This attribute can be
|
||||||
|
used to disable configuration of the default gateway by a specific
|
||||||
|
interface. This is particularly useful to ignore a gateway address provided
|
||||||
|
via DHCP. Note that this attribute is only supported on distributions of
|
||||||
|
the Red Hat family.
|
@@ -5,7 +5,7 @@
|
|||||||
# There are no versioned releases of this role.
|
# There are no versioned releases of this role.
|
||||||
version: 6b5f1d55bc3f27fa2855d8dd59b5c224d160d806
|
version: 6b5f1d55bc3f27fa2855d8dd59b5c224d160d806
|
||||||
- src: MichaelRigart.interfaces
|
- src: MichaelRigart.interfaces
|
||||||
version: v1.1.0
|
version: v1.2.0
|
||||||
- src: mrlesmithjr.manage-lvm
|
- src: mrlesmithjr.manage-lvm
|
||||||
version: v0.1.4
|
version: v0.1.4
|
||||||
- src: resmo.ntp
|
- src: resmo.ntp
|
||||||
|
Reference in New Issue
Block a user