Merge "Replace deprecated library function os.popen() with subprocess"

This commit is contained in:
Jenkins 2016-01-16 22:29:41 +00:00 committed by Gerrit Code Review
commit 55925aee55
1 changed files with 4 additions and 3 deletions

View File

@ -20,7 +20,7 @@
# All configuration values have a default; values that are commented out
# serve to show the default.
import os
import subprocess
# import sys
@ -74,8 +74,9 @@ release = '1.0.0'
# bug_tag: Tag for categorizing the bug. Must be set manually.
# These variables are passed to the logabug code via html_context.
giturl = u'http://git.openstack.org/cgit/openstack/i18n/tree/doc/source'
git_cmd = "/usr/bin/git log | head -n1 | cut -f2 -d' '"
gitsha = os.popen(git_cmd).read().strip('\n')
git_cmd = ["/usr/bin/git", "rev-parse", "HEAD"]
gitsha = subprocess.Popen(
git_cmd, stdout=subprocess.PIPE).communicate()[0].strip('\n')
html_context = {"gitsha": gitsha, "bug_tag": bug_tag,
"giturl": giturl}