From f3970c2db0bb56b668da1ab82b557d52c458a28e Mon Sep 17 00:00:00 2001 From: Emilien Macchi Date: Mon, 14 May 2018 11:02:05 -0700 Subject: [PATCH] Include 'tripleo_role_name' in the inventory "role_name" is internal to Ansible, we should not use it. As a transition, include "tripleo_role_name" in the inventory and once we're ready we'll remove our usage of "role_name", in a future patch. Related-Bug: #1771171 Change-Id: I57c4eac87e2f96dfe5490b111cd2508505715d56 (cherry picked from commit 9ce1c075253900a7944531bcb8357082b481e34e) --- tripleo_common/inventory.py | 3 +++ tripleo_common/tests/test_inventory.py | 27 +++++++++++++++++--------- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/tripleo_common/inventory.py b/tripleo_common/inventory.py index 4520da04a..d2b2485af 100644 --- a/tripleo_common/inventory.py +++ b/tripleo_common/inventory.py @@ -242,7 +242,10 @@ class TripleoInventory(object): 'ansible_ssh_user': self.ansible_ssh_user, 'bootstrap_server_id': role_node_id_map.get( 'bootstrap_server_id'), + # Keep "role_name" until we get rid of it + # https://bugs.launchpad.net/tripleo/+bug/1771171 'role_name': role, + 'tripleo_role_name': role, } } diff --git a/tripleo_common/tests/test_inventory.py b/tripleo_common/tests/test_inventory.py index 1cd21b8a7..5c841435e 100644 --- a/tripleo_common/tests/test_inventory.py +++ b/tripleo_common/tests/test_inventory.py @@ -192,17 +192,20 @@ class TestInventory(base.TestCase): 'hosts': ['cp-0'], 'vars': {'ansible_ssh_user': ansible_ssh_user, 'bootstrap_server_id': 'a', - 'role_name': 'Compute'}}, + 'role_name': 'Compute', + 'tripleo_role_name': 'Compute'}}, 'Controller': { 'hosts': ['c-0', 'c-1', 'c-2'], 'vars': {'ansible_ssh_user': ansible_ssh_user, 'bootstrap_server_id': 'a', - 'role_name': 'Controller'}}, + 'role_name': 'Controller', + 'tripleo_role_name': 'Controller'}}, 'CustomRole': { 'hosts': ['cs-0'], 'vars': {'ansible_ssh_user': ansible_ssh_user, 'bootstrap_server_id': 'a', - 'role_name': 'CustomRole'}}, + 'role_name': 'CustomRole', + 'tripleo_role_name': 'CustomRole'}}, 'overcloud': { 'children': ['Compute', 'Controller', 'CustomRole'], @@ -262,17 +265,20 @@ class TestInventory(base.TestCase): 'hosts': ['cp-0'], 'vars': {'ansible_ssh_user': ansible_ssh_user, 'bootstrap_server_id': 'a', - 'role_name': 'Compute'}}, + 'role_name': 'Compute', + 'tripleo_role_name': 'Compute'}}, 'Controller': { 'hosts': ['c-0', 'c-1', 'c-2'], 'vars': {'ansible_ssh_user': ansible_ssh_user, 'bootstrap_server_id': 'a', - 'role_name': 'Controller'}}, + 'role_name': 'Controller', + 'tripleo_role_name': 'Controller'}}, 'CustomRole': { 'hosts': ['cs-0'], 'vars': {'ansible_ssh_user': ansible_ssh_user, 'bootstrap_server_id': 'a', - 'role_name': 'CustomRole'}}, + 'role_name': 'CustomRole', + 'tripleo_role_name': 'CustomRole'}}, 'overcloud': { 'children': ['Compute', 'Controller', 'CustomRole'], 'vars': { @@ -328,7 +334,8 @@ class TestInventory(base.TestCase): 'enabled_networks': ['ctlplane']}}, 'vars': {'ansible_ssh_user': ansible_ssh_user, 'bootstrap_server_id': 'a', - 'role_name': 'Compute'}}, + 'role_name': 'Compute', + 'tripleo_role_name': 'Compute'}}, 'Controller': { 'hosts': { 'c-0': { @@ -348,7 +355,8 @@ class TestInventory(base.TestCase): 'enabled_networks': ['ctlplane']}}, 'vars': {'ansible_ssh_user': ansible_ssh_user, 'bootstrap_server_id': 'a', - 'role_name': 'Controller'}}, + 'role_name': 'Controller', + 'tripleo_role_name': 'Controller'}}, 'CustomRole': { 'hosts': { 'cs-0': { @@ -358,7 +366,8 @@ class TestInventory(base.TestCase): 'enabled_networks': ['ctlplane']}}, 'vars': {'ansible_ssh_user': ansible_ssh_user, 'bootstrap_server_id': 'a', - 'role_name': 'CustomRole'}}, + 'role_name': 'CustomRole', + 'tripleo_role_name': 'CustomRole'}}, 'overcloud': {'children': {'Compute': {}, 'Controller': {}, 'CustomRole': {}},