Fix ansible-generate-inventory action
ansible-generate-inventory action raises Exception when 'ansible_python_interpreter' input is passed to it. This patch fixes it and also update unit test to cover missing part. Closes-Bug: #1838536 Change-Id: Ie41ba6de1170a9c9ffc94889e47bce9ef1200521
This commit is contained in:
parent
ecdafeba8c
commit
6a35576e9e
@ -319,14 +319,15 @@ class TripleoInventory(object):
|
||||
service_children = [role for role in roles
|
||||
if ret.get(role) is not None]
|
||||
if service_children:
|
||||
ret[service.lower()] = {
|
||||
svc_host = service.lower()
|
||||
ret[svc_host] = {
|
||||
'children': self._hosts(service_children),
|
||||
'vars': {
|
||||
'ansible_ssh_user': self.ansible_ssh_user
|
||||
}
|
||||
}
|
||||
if self.ansible_python_interpreter:
|
||||
ret[role]['vars']['ansible_python_interpreter'] = \
|
||||
ret[svc_host]['vars']['ansible_python_interpreter'] = \
|
||||
self.ansible_python_interpreter
|
||||
|
||||
if not self.hosts_format_dict:
|
||||
|
@ -288,6 +288,30 @@ class TestInventory(base.TestCase):
|
||||
'container_cli': 'podman',
|
||||
'ctlplane_vip': 'x.x.x.4',
|
||||
'redis_vip': 'x.x.x.6'}},
|
||||
'sa': {'children': ['Controller'],
|
||||
'vars': {'ansible_ssh_user': 'my-custom-admin',
|
||||
'ansible_python_interpreter': 'foo'}},
|
||||
'sb': {'children': ['Controller'],
|
||||
'vars': {'ansible_ssh_user': 'my-custom-admin',
|
||||
'ansible_python_interpreter': 'foo'}},
|
||||
'sd': {'children': ['Compute'],
|
||||
'vars': {'ansible_ssh_user': 'my-custom-admin',
|
||||
'ansible_python_interpreter': 'foo'}},
|
||||
'se': {'children': ['Compute'],
|
||||
'vars': {'ansible_ssh_user': 'my-custom-admin',
|
||||
'ansible_python_interpreter': 'foo'}},
|
||||
'ceph_client': {'children': ['Compute'],
|
||||
'vars': {'ansible_ssh_user': 'my-custom-admin',
|
||||
'ansible_python_interpreter': 'foo'}},
|
||||
'clients': {'children': ['Compute'],
|
||||
'vars': {'ansible_ssh_user': 'my-custom-admin',
|
||||
'ansible_python_interpreter': 'foo'}},
|
||||
'sg': {'children': ['CustomRole'],
|
||||
'vars': {'ansible_ssh_user': 'my-custom-admin',
|
||||
'ansible_python_interpreter': 'foo'}},
|
||||
'sh': {'children': ['CustomRole'],
|
||||
'vars': {'ansible_ssh_user': 'my-custom-admin',
|
||||
'ansible_python_interpreter': 'foo'}},
|
||||
'Undercloud': {
|
||||
'hosts': ['undercloud'],
|
||||
'vars': {'ansible_connection': 'ssh',
|
||||
|
Loading…
Reference in New Issue
Block a user