Track leftover files in config-download

After deployment completes add and commit the
untracked files to the git repository in the
config-download directory
- ansible-playbook-command.sh
- group_vars/overcloud.json
- tripleo-ansible-inventory.yaml

Closes-Bug: #1891925
Signed-off-by: Yadnesh Kulkarni <ykulkarn@redhat.com>
Change-Id: I4f4402e34f4a5536080c9af65603540913565841
This commit is contained in:
Yadnesh Kulkarni 2020-12-09 16:57:33 +05:30
parent da75777ebf
commit 132c4d3df8
1 changed files with 19 additions and 0 deletions

View File

@ -19,6 +19,7 @@ from heatclient.common import event_utils
from heatclient import exc as heat_exc
from openstackclient import shell
from tripleo_common.utils import overcloudrc as rc_utils
from tripleo_common.utils.safe_import import git
from tripleoclient.constants import ANSIBLE_TRIPLEO_PLAYBOOKS
from tripleoclient.constants import CLOUD_HOME_DIR
@ -424,6 +425,24 @@ def config_download(log, clients, stack, ssh_network='ctlplane',
print_msg=(verbosity == 0)
)
if os.path.exists(stack_work_dir):
# Object to the git repository
repo = git.Repo(stack_work_dir)
# Configure git user.name and user.email
git_config_user = "mistral"
git_config_email = git_config_user + '@' + os.uname().nodename.strip()
repo.config_writer().set_value(
"user", "name", git_config_user
).release()
repo.config_writer().set_value(
"user", "email", git_config_email
).release()
# Add and commit all files to the git repository
repo.git.add(".")
repo.git.commit("--amend", "--no-edit")
def get_horizon_url(stack, verbosity=0):
"""Return horizon URL string.