Merge "Don't run playbooks if role count == 0"

This commit is contained in:
Zuul 2021-12-21 09:07:53 +00:00 committed by Gerrit Code Review
commit 294e42f599
2 changed files with 5 additions and 0 deletions

View File

@ -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,

View File

@ -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', []):