AIDEGen: Skip error message of git command to get user's LDAP
Do not show error message even the git config command can't get user's
email.
Bug: 128444947
Test: 1. vi ~/.gitconfig
2. remove whole content of [user]
3. m aidegen
4. aidegen-dev framework
5. No error message about subprocess.CalledProcessError.
Change-Id: I63faf4ab98d9a4ccd0f36190218dbbbe30849c68
diff --git a/aidegen/lib/metrics.py b/aidegen/lib/metrics.py
index 90a6547..15da13f 100644
--- a/aidegen/lib/metrics.py
+++ b/aidegen/lib/metrics.py
@@ -1,3 +1,4 @@
+#!/usr/bin/env python3
# Copyright 2018 - The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -51,6 +52,9 @@
ldap, domain = email.split('@', 2)
if domain in _VALID_DOMAINS:
return ldap
+ except subprocess.CalledProcessError as err:
+ logging.debug('error subprocess[%s]: %s', ' '.join(_COMMAND_GIT_CONFIG),
+ err.output)
except Exception:
logging.exception('error retrieving email')
return None