libkas: Improve further on error/success output
Don't add a newline to stderr dumps on failing commands, the logger does that already. And don't print success messages if the fetch command actually failed. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
This commit is contained in:
parent
1e405f155d
commit
f0a18868c9
@ -118,7 +118,7 @@ def run_cmd_async(cmd, cwd, env=None, fail=True, shell=False, liveupdate=True):
|
|||||||
ret = yield from process.wait()
|
ret = yield from process.wait()
|
||||||
|
|
||||||
if ret and fail:
|
if ret and fail:
|
||||||
msg = 'Command "{cwd}$ {cmd}" failed\n'.format(cwd=cwd, cmd=cmdstr)
|
msg = 'Command "{cwd}$ {cmd}" failed'.format(cwd=cwd, cmd=cmdstr)
|
||||||
for line in logo.stderr:
|
for line in logo.stderr:
|
||||||
msg += line
|
msg += line
|
||||||
logging.error(msg)
|
logging.error(msg)
|
||||||
@ -166,10 +166,11 @@ def _repo_fetch_async(config, repo):
|
|||||||
cmd = ['/usr/bin/git', 'clone', '-q', repo.url, repo.path]
|
cmd = ['/usr/bin/git', 'clone', '-q', repo.url, repo.path]
|
||||||
if config.get_repo_ref_dir() and os.path.exists(gitsrcdir):
|
if config.get_repo_ref_dir() and os.path.exists(gitsrcdir):
|
||||||
cmd.extend(['--reference', gitsrcdir])
|
cmd.extend(['--reference', gitsrcdir])
|
||||||
yield from run_cmd_async(cmd,
|
(retc, _) = yield from run_cmd_async(cmd,
|
||||||
env=config.environ,
|
env=config.environ,
|
||||||
cwd=config.kas_work_dir)
|
cwd=config.kas_work_dir)
|
||||||
logging.info('Repository %s cloned', repo.name)
|
if retc == 0:
|
||||||
|
logging.info('Repository %s cloned', repo.name)
|
||||||
return
|
return
|
||||||
|
|
||||||
# Does refspec exist in the current repository?
|
# Does refspec exist in the current repository?
|
||||||
@ -194,7 +195,8 @@ def _repo_fetch_async(config, repo):
|
|||||||
if retc:
|
if retc:
|
||||||
logging.warning('Could not update repository %s: %s',
|
logging.warning('Could not update repository %s: %s',
|
||||||
repo.name, output)
|
repo.name, output)
|
||||||
logging.info('Repository %s updated', repo.name)
|
else:
|
||||||
|
logging.info('Repository %s updated', repo.name)
|
||||||
|
|
||||||
|
|
||||||
def repos_fetch(config, repos):
|
def repos_fetch(config, repos):
|
||||||
|
Loading…
Reference in New Issue
Block a user