Specify python interpreter for undercloud

We always gather facts for the undercloud and which should match the
python interpreter that the inventory code was generated with.  This is
overridable with the --deploy-python-interpreter.

There is a single case where these might be mismatched from the
overcloud if a user is running python2.7 mistral containers on a python3
undercloud and uses config-download to deploy against python2.7
hosts. But I beleive this is not going to be a supported use case so we
should be able to default to the python version used to generate the
inventory file or use a specified value from the command line.

Change-Id: I877cf123d3ef4df045c95f8484e0b5f1ae66a8ba
Related-Blueprint: python3-support
This commit is contained in:
Alex Schultz 2018-11-21 14:00:13 -07:00
parent d6404dd372
commit 2c76f9fed9
2 changed files with 11 additions and 0 deletions

View File

@ -17,6 +17,7 @@
from collections import OrderedDict
import os.path
import sys
import yaml
from heatclient.exc import HTTPNotFound
@ -150,6 +151,7 @@ class TripleoInventory(object):
'vars': {
'ansible_host': 'localhost',
'ansible_connection': 'local',
'ansible_python_interpreter': sys.executable,
# see https://github.com/ansible/ansible/issues/41808
'ansible_remote_tmp': '/tmp/ansible-${USER}',
'auth_url': self.auth_url,
@ -163,6 +165,10 @@ class TripleoInventory(object):
}
})
if self.ansible_python_interpreter:
ret['Undercloud']['vars']['ansible_python_interpreter'] = \
self.ansible_python_interpreter
swift_url = None
if self.session:
swift_url = self.session.get_endpoint(service_type='object-store',

View File

@ -14,6 +14,7 @@
import fixtures
import os
import sys
import yaml
from heatclient.exc import HTTPNotFound
@ -199,6 +200,7 @@ class TestInventory(base.TestCase):
'hosts': ['undercloud'],
'vars': {'ansible_connection': 'local',
'ansible_host': 'localhost',
'ansible_python_interpreter': sys.executable,
'ansible_remote_tmp': '/tmp/ansible-${USER}',
'auth_url': 'xyz://keystone.local',
'cacert': 'acacert',
@ -272,6 +274,7 @@ class TestInventory(base.TestCase):
'hosts': ['undercloud'],
'vars': {'ansible_connection': 'local',
'ansible_host': 'localhost',
'ansible_python_interpreter': 'foo',
'ansible_remote_tmp': '/tmp/ansible-${USER}',
'auth_url': 'xyz://keystone.local',
'cacert': 'acacert',
@ -369,6 +372,8 @@ class TestInventory(base.TestCase):
'Undercloud': {'hosts': {'undercloud': {}},
'vars': {'ansible_connection': 'local',
'ansible_host': 'localhost',
'ansible_python_interpreter':
sys.executable,
'ansible_remote_tmp':
'/tmp/ansible-${USER}',
'auth_url': 'xyz://keystone.local',