Commit 0216d4b9 authored by Ayush Tiwari's avatar Ayush Tiwari

Fix logging

parent 970dd4d4
import doctest import doctest
from zope.testing import renormalizing from zope.testing import renormalizing
import logging
import os import os
import re import re
import shutil import shutil
...@@ -9,7 +10,6 @@ import subprocess ...@@ -9,7 +10,6 @@ import subprocess
import tempfile import tempfile
import unittest import unittest
import zc.buildout.testing import zc.buildout.testing
from logging import log
from subprocess import check_call, check_output from subprocess import check_call, check_output
from slapos.recipe.gitclone import GIT_CLONE_ERROR_MESSAGE, \ from slapos.recipe.gitclone import GIT_CLONE_ERROR_MESSAGE, \
GIT_CLONE_CACHE_ERROR_MESSAGE GIT_CLONE_CACHE_ERROR_MESSAGE
...@@ -89,7 +89,7 @@ class GitCloneNonInformativeTests(unittest.TestCase): ...@@ -89,7 +89,7 @@ class GitCloneNonInformativeTests(unittest.TestCase):
subprocess.check_call('git add .', cwd=proj_dir, shell=True) subprocess.check_call('git add .', cwd=proj_dir, shell=True)
except subprocess.CalledProcessError as e: except subprocess.CalledProcessError as e:
# XXX: This is ugly and old. Change it before review # XXX: This is ugly and old. Change it before review
log.error("'git add .' failed with '{}'".format(e.returncode)) logging.error("'git add .' failed with '{}'".format(e.returncode))
def git_commit(self, proj_dir, msg): def git_commit(self, proj_dir, msg):
"""runs a 'git commit -m msg' in the provided git repo """runs a 'git commit -m msg' in the provided git repo
...@@ -98,7 +98,7 @@ class GitCloneNonInformativeTests(unittest.TestCase): ...@@ -98,7 +98,7 @@ class GitCloneNonInformativeTests(unittest.TestCase):
try: try:
subprocess.check_call('git commit -m "{}"'.format(msg), cwd=proj_dir, shell=True) subprocess.check_call('git commit -m "{}"'.format(msg), cwd=proj_dir, shell=True)
except subprocess.CalledProcessError as e: except subprocess.CalledProcessError as e:
log.error("'git commit' failed with '{}'".format(e.returncode)) logging.error("'git commit' failed with '{}'".format(e.returncode))
def get_repo_head_commit(self, proj_dir, branch='master'): def get_repo_head_commit(self, proj_dir, branch='master'):
""" """
...@@ -109,7 +109,7 @@ class GitCloneNonInformativeTests(unittest.TestCase): ...@@ -109,7 +109,7 @@ class GitCloneNonInformativeTests(unittest.TestCase):
cwd=proj_dir, shell=True).decode("utf-8") cwd=proj_dir, shell=True).decode("utf-8")
return output.rstrip() return output.rstrip()
except subprocess.CalledProcessError : except subprocess.CalledProcessError :
log.error("failed to call 'git rev-parse'") logging.error("failed to call 'git rev-parse'")
return None return None
def makeGitCloneRecipe(self, options): def makeGitCloneRecipe(self, options):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment