mirror of
https://opendev.org/openstack/ansible-collections-openstack.git
synced 2026-03-27 22:13:03 +00:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
07374a1f0d | ||
|
|
8a395a04cf | ||
|
|
441a61fd8c | ||
|
|
c05b1fdbaf | ||
|
|
9cd92208d6 | ||
|
|
aed60716ee |
@@ -276,7 +276,7 @@
|
||||
nodeset: ubuntu-bionic
|
||||
description: |
|
||||
Run openstack collections linter tests using the 2.11 branch of ansible
|
||||
voting: true
|
||||
voting: false
|
||||
required-projects:
|
||||
- name: github.com/ansible/ansible
|
||||
override-checkout: stable-2.11
|
||||
@@ -370,7 +370,7 @@
|
||||
dependencies: &deps_unit_lint
|
||||
- tox-pep8
|
||||
- openstack-tox-linters-ansible-2.9
|
||||
- openstack-tox-linters-ansible-2.11
|
||||
# - openstack-tox-linters-ansible-2.11
|
||||
|
||||
- ansible-collections-openstack-functional-devstack-releases:
|
||||
dependencies: *deps_unit_lint
|
||||
@@ -413,7 +413,7 @@
|
||||
gate:
|
||||
jobs:
|
||||
- tox-pep8
|
||||
- openstack-tox-linters-ansible-2.11
|
||||
# - openstack-tox-linters-ansible-2.11
|
||||
- openstack-tox-linters-ansible-2.9
|
||||
- ansible-collections-openstack-functional-devstack
|
||||
- ansible-collections-openstack-functional-devstack-releases
|
||||
@@ -453,6 +453,6 @@
|
||||
- ansible-collections-openstack-functional-devstack-rocky-ansible-2.11
|
||||
- ansible-collections-openstack-functional-devstack-queens-ansible-devel
|
||||
|
||||
pre-release:
|
||||
tag:
|
||||
jobs:
|
||||
- ansible-collections-openstack-release
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
requires_ansible: ">=2.8"
|
||||
action_groups:
|
||||
openstack:
|
||||
- address_scope
|
||||
|
||||
@@ -296,6 +296,35 @@ from ansible_collections.openstack.cloud.plugins.module_utils.openstack import O
|
||||
|
||||
class LoadBalancerModule(OpenStackModule):
|
||||
|
||||
def _wait_for_pool(self, pool, provisioning_status, operating_status, failures, interval=5):
|
||||
"""Wait for pool to be in a particular provisioning and operating status."""
|
||||
timeout = self.params['timeout'] # reuse loadbalancer timeout
|
||||
|
||||
total_sleep = 0
|
||||
if failures is None:
|
||||
failures = []
|
||||
|
||||
while total_sleep < timeout:
|
||||
pool = self.conn.load_balancer.find_pool(name_or_id=pool.id)
|
||||
if pool:
|
||||
if pool.provisioning_status == provisioning_status and pool.operating_status == operating_status:
|
||||
return None
|
||||
if pool.provisioning_status in failures:
|
||||
self.fail_json(
|
||||
msg="Pool %s transitioned to failure state %s" %
|
||||
(pool.id, pool.provisioning_status)
|
||||
)
|
||||
else:
|
||||
if provisioning_status == "DELETED":
|
||||
return None
|
||||
else:
|
||||
self.fail_json(
|
||||
msg="Pool %s transitioned to DELETED" % pool.id
|
||||
)
|
||||
|
||||
time.sleep(interval)
|
||||
total_sleep += interval
|
||||
|
||||
def _wait_for_lb(self, lb, status, failures, interval=5):
|
||||
"""Wait for load balancer to be in a particular provisioning status."""
|
||||
timeout = self.params['timeout']
|
||||
@@ -497,6 +526,7 @@ class LoadBalancerModule(OpenStackModule):
|
||||
protocol=protocol,
|
||||
lb_algorithm=lb_algorithm
|
||||
)
|
||||
self._wait_for_pool(pool, "ACTIVE", "ONLINE", ["ERROR"])
|
||||
changed = True
|
||||
|
||||
# Ensure members in the pool
|
||||
@@ -538,6 +568,7 @@ class LoadBalancerModule(OpenStackModule):
|
||||
protocol_port=protocol_port,
|
||||
subnet_id=subnet_id
|
||||
)
|
||||
self._wait_for_pool(pool, "ACTIVE", "ONLINE", ["ERROR"])
|
||||
changed = True
|
||||
|
||||
# Associate public ip to the load balancer VIP. If
|
||||
|
||||
Reference in New Issue
Block a user