[sysadmin-bin] Add a proper exception handling in the case pexpect.spawn() will return a non-zero exit status.
- From: Andrea Veri <av src gnome org>
- To: gnome-sysadmin gnome org,commits-list gnome org
- Subject: [sysadmin-bin] Add a proper exception handling in the case pexpect.spawn() will return a non-zero exit status.
- Date: Fri, 6 Sep 2013 13:26:34 +0000 (UTC)
commit a0208771137e46af961bea4479267388133538d1
Author: Andrea Veri <av gnome org>
Date: Fri Sep 6 15:26:09 2013 +0200
Add a proper exception handling in the case pexpect.spawn() will return a non-zero exit status.
prosody.py | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/prosody.py b/prosody.py
index cb1177c..175a858 100755
--- a/prosody.py
+++ b/prosody.py
@@ -3,8 +3,6 @@
# Target host: chooser.gnome.org
# Description: script to automatize new Prosody user creation at jabber.gnome.org. Usage as
# follows: 'python prosody.py username email'. Example: 'python prosody.py av av gnome org'.
-# TODO: Add some exception handling in the case the prosody daemon isn't running or accepting
-# new user's creation.
import random
import string
@@ -26,6 +24,10 @@ def create_prosody_account():
child.sendline ('%s' % random_password)
child.expect ('Retype new password: ')
child.sendline ('%s' % random_password)
+ child.close()
+
+ if child.exitstatus == 1:
+ raise Exception("There was an error creating the Prosody account, please check logs!")
message = """
Hi,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]