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.
Adjusts Unit test for stable/stein as [1] is not in
stable/stein.
[1] https://review.opendev.org/#/c/663466/
Closes-Bug: #1838536
Depends-On: https://review.opendev.org/#/c/674530/
Change-Id: Ie41ba6de1170a9c9ffc94889e47bce9ef1200521
(cherry picked from commit 6a35576e9e
)
This commit is contained in:
parent
5525d4d6d2
commit
df8f0243d0
@ -289,14 +289,15 @@ class TripleoInventory(object):
|
|||||||
service_children = [role for role in roles
|
service_children = [role for role in roles
|
||||||
if ret.get(role) is not None]
|
if ret.get(role) is not None]
|
||||||
if service_children:
|
if service_children:
|
||||||
ret[service.lower()] = {
|
svc_host = service.lower()
|
||||||
|
ret[svc_host] = {
|
||||||
'children': self._hosts(service_children),
|
'children': self._hosts(service_children),
|
||||||
'vars': {
|
'vars': {
|
||||||
'ansible_ssh_user': self.ansible_ssh_user
|
'ansible_ssh_user': self.ansible_ssh_user
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if self.ansible_python_interpreter:
|
if self.ansible_python_interpreter:
|
||||||
ret[role]['vars']['ansible_python_interpreter'] = \
|
ret[svc_host]['vars']['ansible_python_interpreter'] = \
|
||||||
self.ansible_python_interpreter
|
self.ansible_python_interpreter
|
||||||
|
|
||||||
if not self.hosts_format_dict:
|
if not self.hosts_format_dict:
|
||||||
|
@ -280,6 +280,24 @@ class TestInventory(base.TestCase):
|
|||||||
'container_cli': 'podman',
|
'container_cli': 'podman',
|
||||||
'ctlplane_vip': 'x.x.x.4',
|
'ctlplane_vip': 'x.x.x.4',
|
||||||
'redis_vip': 'x.x.x.6'}},
|
'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'}},
|
||||||
|
'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': {
|
'Undercloud': {
|
||||||
'hosts': ['undercloud'],
|
'hosts': ['undercloud'],
|
||||||
'vars': {'ansible_connection': 'ssh',
|
'vars': {'ansible_connection': 'ssh',
|
||||||
|
Loading…
Reference in New Issue
Block a user