neoave / mrack

Multicloud use-case based multihost async provisioner for CIs and testing during development
Apache License 2.0
12 stars 14 forks source link

fix(OpenStack): Do not raise exception when using unavailable network #151

Closed Tiboris closed 2 years ago

Tiboris commented 2 years ago

In some cases when network has an outage or is temporarily removed etc. mrack would raise an exception when getting the "id" from network which is set to 'None' which is obvious AttributeError: 'NoneType' object has no attribute 'get'

Signed-off-by: Tibor Dudlák tdudlak@redhat.com

Tiboris commented 2 years ago

Re-pushed

2021-11-23 16:44:21,104 mrack.providers.provider INFO OpenStack: Preparing provider resources
2021-11-23 16:44:21,104 mrack.providers.provider INFO OpenStack: Validating hosts definitions
2021-11-23 16:44:21,104 mrack.providers.openstack WARNING OpenStack: Failed to load network with name: 'potato'
2021-11-23 16:44:21,104 mrack.providers.openstack DEBUG Network: network4
2021-11-23 16:44:21,104 mrack.providers.openstack DEBUG   total: 1009
2021-11-23 16:44:21,104 mrack.providers.openstack DEBUG   used: 893
2021-11-23 16:44:21,104 mrack.providers.openstack DEBUG   available: 116
2021-11-23 16:44:21,105 mrack.providers.openstack DEBUG Network: network5
2021-11-23 16:44:21,105 mrack.providers.openstack DEBUG   total: 1009
2021-11-23 16:44:21,105 mrack.providers.openstack DEBUG   used: 852
2021-11-23 16:44:21,105 mrack.providers.openstack DEBUG   available: 157
2021-11-23 16:44:21,105 mrack.providers.openstack DEBUG Network: network6
2021-11-23 16:44:21,105 mrack.providers.openstack DEBUG   total: 1010
2021-11-23 16:44:21,105 mrack.providers.openstack DEBUG   used: 733
2021-11-23 16:44:21,105 mrack.providers.openstack DEBUG   available: 277
2021-11-23 16:44:21,105 mrack.providers.openstack DEBUG Network: network7
2021-11-23 16:44:21,105 mrack.providers.openstack DEBUG   total: 1010
2021-11-23 16:44:21,105 mrack.providers.openstack DEBUG   used: 751
2021-11-23 16:44:21,105 mrack.providers.openstack DEBUG   available: 259
2021-11-23 16:44:21,105 mrack.providers.openstack DEBUG Network: network8
2021-11-23 16:44:21,105 mrack.providers.openstack DEBUG   total: 1010
2021-11-23 16:44:21,105 mrack.providers.openstack DEBUG   used: 743
2021-11-23 16:44:21,105 mrack.providers.openstack DEBUG   available: 267
2021-11-23 16:44:21,105 mrack.providers.openstack DEBUG Network: network9
2021-11-23 16:44:21,105 mrack.providers.openstack DEBUG   total: 1010
2021-11-23 16:44:21,105 mrack.providers.openstack DEBUG   used: 807
2021-11-23 16:44:21,105 mrack.providers.openstack DEBUG   available: 203
2021-11-23 16:44:21,105 mrack.providers.openstack DEBUG OpenStack: Listing usable networks: [('network4', 116), ('network5', 157), ('network9', 203), ('network7', 259), ('network8', 267), ('network6', 277)]
2021-11-23 16:44:21,105 mrack.providers.openstack DEBUG OpenStack: Picking randomly from network pools which satisfy requirement (size_of_pool/size_of_biggest > 0.5): [('network5', 157), ('network9', 203), ('network7', 259), ('network8', 267), ('network6', 277)]
2021-11-23 16:44:21,105 mrack.providers.openstack DEBUG OpenStack: Network picked: network5 with 157 addresses