[debian-edu-commits] debian-edu/upstream/ 63/71: Rewrite runcmd() to work with Python om Wheezy.

Petter Reinholdtsen pere at moszumanska.debian.org
Mon Jun 9 18:25:40 UTC 2014


This is an automated email from the git hooks/post-receive script.

pere pushed a commit to branch master
in repository libpam-mklocaluser.

commit a5de0aa1a686daa4afdab76228c4d6256798c37b
Author: Petter Reinholdtsen <pere at hungry.com>
Date:   Sat May 4 09:51:46 2013 +0000

    Rewrite runcmd() to work with Python om Wheezy.
---
 debian/changelog     |  1 +
 debian/pam-python.py | 14 ++++++++------
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 7ad8075..90961db 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -10,6 +10,7 @@ libpam-mklocaluser (0.8) UNRELEASED; urgency=low
     more info during testing.
   * Make sure syslog message make it clear that both passwd and shadow
     is updated by the module.
+  * Rewrite runcmd() to work with Python om Wheezy.
 
  -- Petter Reinholdtsen <pere at debian.org>  Sat, 04 May 2013 08:25:53 +0200
 
diff --git a/debian/pam-python.py b/debian/pam-python.py
index a396ac3..a50ef46 100755
--- a/debian/pam-python.py
+++ b/debian/pam-python.py
@@ -27,15 +27,17 @@ def chown_recursive(path, uid, gid):
     for filename in files:
       os.chown(os.path.join(root, filename), uid, gid)
 
-# FIXME This function always report an error
 def runcmd(pamh, cmd):
-  proc = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE,)
+  proc = subprocess.Popen(cmd, shell=True, \
+                            stdout=subprocess.PIPE, \
+                            stderr=subprocess.PIPE,)
   while proc.poll() == None:
     pass
-  result = proc.communicate(input=None)[0]
-  if result != 0:
-    syslog.syslog("Command %(command)s failed with %(msg)s" % ( cmd, proc.stderr.read()) )
-#  print "output: %s" % output
+  (resultstdout, resultstderr) = proc.communicate(input=None)
+  if proc.returncode != 0:
+    msg = "Command '%s' failed with %s" % ( cmd, resultstderr.strip())
+    syslog.syslog(msg)
+#    print "output: %s" % msg
 
 def check_and_create_localuser(pamh, user):
   # Location of local users

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-edu/upstream/libpam-mklocaluser.git



More information about the debian-edu-commits mailing list