[autodoc] guessing converge playbook

If a molecule has a defined converge playbook, we should use it instead
of defaulting to the role's playbook.

Change-Id: Idc55fba78ce91d472ed367f5097505c9a5d9b6dd
(cherry picked from commit cde77aa3b7)
(cherry picked from commit 21d3f2f986)
This commit is contained in:
David Vallee Delisle 2021-02-09 21:28:41 -05:00
parent 29a859089a
commit 91db61e55b

View File

@ -233,6 +233,7 @@ class AnsibleAutoPluginDirective(Directive):
)
)
default_playbook = [molecule_path, test, 'converge.yml']
provisioner_data = molecule_conf.get('provisioner')
if provisioner_data:
inventory = provisioner_data.get('inventory')
@ -243,12 +244,13 @@ class AnsibleAutoPluginDirective(Directive):
section_title='Molecule Inventory'
)
)
try:
converge = provisioner_data['playbooks']['converge']
default_playbook = default_playbook[:-1] + [converge]
except KeyError:
pass
molecule_playbook_path = os.path.join(
molecule_path,
test,
'converge.yml'
)
molecule_playbook_path = os.path.join(*default_playbook)
with open(molecule_playbook_path) as f:
molecule_playbook = yaml.safe_load(f.read())
molecule_section.append(