Fix validation runs in a containerized environment

This fix addresses the following issues:
- No validations user present in the mistral-executor container
- The ssh_keys environment isn't initially created

Change-Id: I53078723b0995d6cd9590f119b28a7ca2b95dafd
Closes-Bug: #1789886
This commit is contained in:
Florian Fuchs 2018-08-31 15:43:17 +02:00
parent 649ba2aeff
commit ec26073d14
2 changed files with 14 additions and 0 deletions

View File

@ -376,6 +376,9 @@ RUN mkdir -p /openstack && \
RUN mkdir -p /openstack && \
ln -s /usr/share/openstack-tripleo-common/healthcheck/mistral-executor /openstack/healthcheck && \
chmod a+rx /openstack/healthcheck
USER root
RUN useradd validations
USER mistral
{% endblock %}
{% block mistral_event_engine_footer %}

View File

@ -131,8 +131,19 @@ class RunValidationAction(base.TripleOAction):
swift = self.get_object_client(context)
identity_file = None
# Make sure the ssh_keys environment exists
try:
env = mc.environments.get('ssh_keys')
except Exception:
workflow_env = {
'name': 'ssh_keys',
'description': 'SSH keys for TripleO validations',
'variables': password_utils.create_ssh_keypair()
}
env = mc.environments.create(**workflow_env)
try:
private_key = env.variables['private_key']
identity_file = utils.write_identity_file(private_key)