tripleo-heat-templates/tripleo_heat_templates/tests/test_tht_ansible_syntax.py
Michele Baldessari b0e7008196 standalone/overcloud: enable the HA deployment by default
With the HA NG work having landed, the impact of pacemaker
is reduced and only very few core services are being managed
by pacemaker. Since the HA deployments work just fine
with a single node, it makes little sense to use the non-ha
deployment as default any longer (Also because downstream
we do the default to the HA deployment by default and this
keeps confusing users).

This patch does the following :

* Remove Keepalived services from all CI scenarios running it.
* Make sure all HA services deployed in CI run with Pacemaker.
* Remove non HA containers so Pacemaker can
  bootstrap the new containers safely.
* Before removing mysql container, create the clustercheck user and
  grant correct permissions to avoid bootstrap issues later when galera
  is spawned.
* Disable HA on the minor update job, it seems to not working fine if
  only one controller is deployed.

Depends-On: https://review.opendev.org/#/c/718759
Change-Id: I0f61016df6a9f07971c5eab51cc9674a1458c66f
2020-04-09 21:27:02 +00:00

67 lines
1.8 KiB
Python

# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import os
import ansible_runner
role_paths = [
'tripleo-ansible/tripleo-ansible/tripleo_ansible/roles'
]
module_paths = [
'tripleo-ansible/tripleo-ansible/tripleo_ansible/ansible_plugins/modules',
'ansible-pacemaker/modules'
]
def append_path(path, new):
if path == '':
return new
else:
return path + ':' + new
def test_tht_ansible_syntax(pytestconfig):
role_path = ''
mod_path = ''
tht_root = str(pytestconfig.invocation_params.dir)
tht_test_path = os.path.join(tht_root, 'tripleo_heat_templates/tests')
for r in role_paths:
role_path = append_path(
role_path, os.path.join(tht_test_path, r))
for m in module_paths:
mod_path = append_path(
mod_path, os.path.join(tht_test_path, m))
play_path = os.path.join(tht_test_path, 'test_tht_ansible_syntax.yml')
os.environ["ANSIBLE_ROLES_PATH"] = role_path
os.environ["ANSIBLE_LIBRARY"] = mod_path
# Some variables are generated by config-download and part of TripleO inventory,
# absent from this testing
os.environ["ANSIBLE_ERROR_ON_UNDEFINED_VARS"] = "False"
run = ansible_runner.run(
playbook=play_path,
extravars={'tht_root': tht_root}
)
try:
assert run.rc == 0
finally:
print("{}: {}".format(run.status, run.rc))