tripleo-ansible/tripleo_ansible/tests/modules/test_container_puppet_config.py
Emilien Macchi 24e9c33ad4 Add module "container_puppet_config"
This module will do two things:

Summary:

(1) Generate container configs for each container that has a puppet
    deployment step; and but the files in
    /var/lib/tripleo-config/container-puppet-config
(2) Update the container-startup-config of the containers which have a new
    hash; so they get restarted later.

Details:

(1) Here are the steps that happen to generate the puppet container
    configs:

    - Create /var/lib/tripleo-config/container-puppet-config/step_X
    - Generate a JSON file, that is the same format as the
      well-known container-startup-configs (which are understood by
      Paunch and tripleo-container-manage Ansible role). It mimics
      the logic from THT/common/container-puppet.py to add the
      required configuration so the container can run.

(2) If a container has a new configuration, the TRIPLEO_CONFIG_HASH
    will be updated in the startup config of the container, so later
    Paunch or tripleo-container-manage Ansible role can restart the
    container so the config is applied.

Note: it processing a bunch of files and data, so it's better for it to
be a module and not an action plugin so the file generation can be
delegated on to the remote nodes instead of the undercloud.
In the future, we'll try to generate container configuration directly in
config-download so the data will be ready to be copied.

Change-Id: I6b656df725803db0c1cdaac6f534766398a15810
2020-02-06 18:00:52 +00:00

24 lines
894 B
Python

# Copyright 2019 Red Hat, Inc.
# All Rights Reserved.
#
# 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.
from tripleo_ansible.ansible_plugins.modules import container_puppet_config
from tripleo_ansible.tests import base as tests_base
class TestContainerPuppetConfig(tests_base.TestCase):
def test_run(self):
# TODO(emilien) write actual tests
pass