diff options
author | Chris St. Pierre <chris.a.st.pierre@gmail.com> | 2013-01-24 07:59:11 -0500 |
---|---|---|
committer | Chris St. Pierre <chris.a.st.pierre@gmail.com> | 2013-01-24 07:59:11 -0500 |
commit | 282d6d7056bf8481d6f194e436dfb96ede6d559d (patch) | |
tree | dad8b007ed20ebb3df4bb069359f3d71b0bb4fef /src | |
parent | b8165648b009518495171c3b8df5047f0065e79e (diff) | |
download | bcfg2-282d6d7056bf8481d6f194e436dfb96ede6d559d.tar.gz bcfg2-282d6d7056bf8481d6f194e436dfb96ede6d559d.tar.bz2 bcfg2-282d6d7056bf8481d6f194e436dfb96ede6d559d.zip |
Git: log output of GitPython commands
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/Bcfg2/Server/Plugins/Git.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/lib/Bcfg2/Server/Plugins/Git.py b/src/lib/Bcfg2/Server/Plugins/Git.py index 8cc63a46f..e46c331b3 100644 --- a/src/lib/Bcfg2/Server/Plugins/Git.py +++ b/src/lib/Bcfg2/Server/Plugins/Git.py @@ -31,6 +31,11 @@ class Git(Bcfg2.Server.Plugin.Version): self.logger.debug("Initialized git plugin with git directory %s" % self.vcs_path) + def _log_git_cmd(self, output): + """ Send output from a GitPython command to the debug log """ + for line in output.strip().splitlines(): + self.debug_log("Git: %s" % line) + def get_revision(self): """Read git revision information for the Bcfg2 repository.""" try: @@ -60,7 +65,7 @@ class Git(Bcfg2.Server.Plugin.Version): self.debug_log("Git: Performing garbage collection on repo at %s" % self.vcs_root) try: - self.repo.git.gc('--auto') + self._log_git_cmd(self.repo.git.gc('--auto')) except git.GitCommandError: self.logger.warning("Git: Failed to perform garbage collection: %s" % sys.exc_info()[1]) @@ -68,7 +73,7 @@ class Git(Bcfg2.Server.Plugin.Version): if ref: self.debug_log("Git: Checking out %s" % ref) try: - self.repo.git.checkout('-f', ref) + self._log_git_cmd(self.repo.git.checkout('-f', ref)) except git.GitCommandError: err = sys.exc_info()[1] msg = "Git: Failed to checkout %s: %s" % (ref, err) @@ -87,7 +92,7 @@ class Git(Bcfg2.Server.Plugin.Version): self.debug_log("Git: %s is a tracking branch, pulling from %s" % (self.repo.head.ref.name, tracking)) try: - self.repo.git.pull("--rebase") + self._log_git_cmd(self.repo.git.pull("--rebase")) except: # pylint: disable=W0702 err = sys.exc_info()[1] msg = "Git: Failed to pull from upstream: %s" % err |