diff --git a/changelogs/fragments/router_network.yaml b/changelogs/fragments/router_network.yaml new file mode 100644 index 00000000..95f460a9 --- /dev/null +++ b/changelogs/fragments/router_network.yaml @@ -0,0 +1,3 @@ +--- +bugfixes: + - modules/router.py in function _build_router_interface_config network search will be performed in defined project first. diff --git a/plugins/modules/router.py b/plugins/modules/router.py index a928a0f7..c3748767 100644 --- a/plugins/modules/router.py +++ b/plugins/modules/router.py @@ -497,8 +497,15 @@ class RouterModule(OpenStackModule): if 'net' not in iface: self.fail( "Network name missing from interface definition") + # First try to find a network in the specified project. net = self.conn.network.find_network(iface['net'], - ignore_missing=False) + ignore_missing=False, + **filters) + # Fall back to a global search for the network. + if not net: + net = self.conn.network.find_network( + iface['net'], + ignore_missing=False) if 'portip' not in iface: # portip not set, add any ip from subnet