Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle instances without attached ports. #772

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

freyes
Copy link
Member

@freyes freyes commented May 24, 2022

This change covers the case where an instance has no ports (addresses)
attached making the function network_name_from_instance() raise a
StopIteration since the "addresses" dict is empty.

Traceback (most recent call last):
File "[...]/zaza/openstack/charm_tests/manila/tests.py", line 142, in tearDownClass
fips_reservations += neutron_tests.floating_ips_from_instance(vm)
File "[...[/zaza/openstack/charm_tests/neutron/tests.py", line 1028, in floating_ips_from_instance
return ips_from_instance(instance, 'floating')
File "[...]/zaza/openstack/charm_tests/neutron/tests.py", line 1073, in ips_from_instance
network_name_from_instance(instance)]
File "[...]/zaza/openstack/charm_tests/neutron/tests.py", line 1052, in network_name_from_instance
return next(iter(instance.addresses))
StopIteration

Fixes #771

@freyes
Copy link
Member Author

freyes commented May 24, 2022

https://review.opendev.org/c/openstack/charm-manila/+/843217 - ci job exercising the change.

This change covers the case where an instance has no ports (addresses)
attached making the function network_name_from_instance() raise a
StopIteration since the "addresses" dict is empty.

Traceback (most recent call last):
  File "[...]/zaza/openstack/charm_tests/manila/tests.py", line 142, in tearDownClass
    fips_reservations += neutron_tests.floating_ips_from_instance(vm)
  File "[...[/zaza/openstack/charm_tests/neutron/tests.py", line 1028, in floating_ips_from_instance
    return ips_from_instance(instance, 'floating')
  File "[...]/zaza/openstack/charm_tests/neutron/tests.py", line 1073, in ips_from_instance
    network_name_from_instance(instance)]
  File "[...]/zaza/openstack/charm_tests/neutron/tests.py", line 1052, in network_name_from_instance
    return next(iter(instance.addresses))
StopIteration

Fixes openstack-charmers#771
@freyes freyes force-pushed the fix-stop-iteration branch from 00ed6d3 to ac77f24 Compare May 24, 2022 21:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ERROR: tearDownClass (zaza.openstack.charm_tests.manila_ganesha.tests.ManilaGaneshaTests)
1 participant