Don't run playbooks if role count == 0
There is no reason to try to run playbooks limited to a role name when the role count is zero. It actually fails because no hosts match. Add a check to skip roles with count == 0. Closes-Bug: #1955432 Change-Id: I5312e5362bdeac8337d1d0991e5a94ded5e83f3f
This commit is contained in:
parent
7e1d133308
commit
b9b9dbd74e
|
@ -406,6 +406,8 @@ class TestRunRolePlaybooks(TestCase):
|
|||
@mock.patch('tripleoclient.utils.run_ansible_playbook')
|
||||
def test_role_playbooks(self, mock_run):
|
||||
roles = [
|
||||
# No playbooks should execute for the role if count is 0.
|
||||
{'count': 0, 'name': 'ZeroNodesRole'},
|
||||
{'count': 10, 'name': 'Compute'},
|
||||
{
|
||||
'count': 3,
|
||||
|
|
|
@ -3002,6 +3002,9 @@ def run_role_playbooks(self, working_dir, roles_file_dir, roles,
|
|||
|
||||
# Pre-Network Config
|
||||
for role in roles:
|
||||
if role.get('count', 1) == 0:
|
||||
continue
|
||||
|
||||
role_playbooks = []
|
||||
|
||||
for x in role.get('ansible_playbooks', []):
|
||||
|
|
Loading…
Reference in New Issue