Don't add tarball to config-download dir

GitPyton's repo.index.add defaults to force adding all ignored file
patterns from .gitignore. This was causing the generated
overcloud-config.tar.gz to also be included in the git repo. This caused
the config-download directory to recursivley grow larger in size as each
commit contained a tarball of the whole repo.

Using repo.git.add instead allows the .gitignore to be honored so that
the tarball isn't included in any commits.

Change-Id: I5c7b4fc448d957e30c0ea386795c9b698e9febed
Closes-Bug: #1795949
(cherry picked from commit 356334b131)
This commit is contained in:
James Slagle 2018-10-03 16:12:00 -04:00 committed by Emilien Macchi
parent 39ec3f6169
commit e8d9d162e5
1 changed files with 3 additions and 1 deletions

View File

@ -150,7 +150,9 @@ class Config(object):
def snapshot_config_dir(self, repo, commit_message):
if repo.is_dirty(untracked_files=True):
self.log.info('Snapshotting {}'.format(repo.working_dir))
repo.index.add('*')
# Use repo.git.add directly as repo.index.add defaults to forcing
# commit of ignored files, which we don't want.
repo.git.add('.')
commit = repo.index.commit(commit_message)
self.log.info('Created commit {}'.format(commit.hexsha))
else: