[oe-commits] [openembedded-core] 10/26: oe-build-perf-report-email.py: use pwd for getting user name
git at git.openembedded.org
git at git.openembedded.org
Wed Apr 12 23:01:26 UTC 2017
This is an automated email from the git hooks/post-receive script.
rpurdie pushed a commit to branch master-next
in repository openembedded-core.
commit 66b7f495bb000c043ae24176dcdec0cb087eeecf
Author: Markus Lehtonen <markus.lehtonen at linux.intel.com>
AuthorDate: Wed Apr 12 22:17:32 2017 +0300
oe-build-perf-report-email.py: use pwd for getting user name
Use pwd data instead of os.getlogin() to get the username for fallback
email address. os.getlogin() basically returns the name of the user
logged in on the controlling terminal of the process and raises an
exception on some systems if the process does not have a controlling
terminal - when executed from a cron script, for example.
Signed-off-by: Markus Lehtonen <markus.lehtonen at linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
scripts/contrib/oe-build-perf-report-email.py | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/scripts/contrib/oe-build-perf-report-email.py b/scripts/contrib/oe-build-perf-report-email.py
index 055a7b1..261ca51 100755
--- a/scripts/contrib/oe-build-perf-report-email.py
+++ b/scripts/contrib/oe-build-perf-report-email.py
@@ -211,9 +211,10 @@ def send_email(text_fn, html_fn, subject, recipients):
else:
raise ReportError("Neither plain text nor html body specified")
- full_name = pwd.getpwuid(os.getuid()).pw_gecos.split(',')[0]
+ pw_data = pwd.getpwuid(os.getuid())
+ full_name = pw_data.pw_gecos.split(',')[0]
email = os.environ.get('EMAIL',
- '{}@{}'.format(os.getlogin(), socket.getfqdn()))
+ '{}@{}'.format(pw_data.pw_name, socket.getfqdn()))
msg['From'] = "{} <{}>".format(full_name, email)
msg['To'] = ', '.join(recipients)
msg['Subject'] = subject
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Openembedded-commits
mailing list