diff options
author | John Dennis <jdennis@redhat.com> | 2007-12-04 10:08:08 -0500 |
---|---|---|
committer | John Dennis <jdennis@redhat.com> | 2007-12-04 10:08:08 -0500 |
commit | d53915954e68ad2fa1625ed016e7e65cd6f4e4e0 (patch) | |
tree | 6963257f9c07a23cbe7a33d621edae5e7c327d9f /ipa-python | |
parent | 4e1d291d15e198a0517a2c6787f865fe41147440 (diff) | |
parent | 299e45769811c7573d1389e5eb25643e62b1d128 (diff) | |
download | freeipa-d53915954e68ad2fa1625ed016e7e65cd6f4e4e0.tar.gz freeipa-d53915954e68ad2fa1625ed016e7e65cd6f4e4e0.tar.xz freeipa-d53915954e68ad2fa1625ed016e7e65cd6f4e4e0.zip |
merge
Diffstat (limited to 'ipa-python')
-rw-r--r-- | ipa-python/Makefile | 3 | ||||
-rw-r--r-- | ipa-python/ipaerror.py | 15 | ||||
-rw-r--r-- | ipa-python/ipautil.py | 18 |
3 files changed, 35 insertions, 1 deletions
diff --git a/ipa-python/Makefile b/ipa-python/Makefile index 525875377..bad5ca5c8 100644 --- a/ipa-python/Makefile +++ b/ipa-python/Makefile @@ -17,6 +17,9 @@ clean: distclean: clean +maintainer-clean: distclean + rm -rf build + .PHONY: test test: $(subst .py,.tst,$(TESTS)) diff --git a/ipa-python/ipaerror.py b/ipa-python/ipaerror.py index 5391b3fd4..2f9a98363 100644 --- a/ipa-python/ipaerror.py +++ b/ipa-python/ipaerror.py @@ -162,3 +162,18 @@ CONNECTION_UNWILLING = gen_error_code( CONNECTION_CATEGORY, 0x0004, "Account inactivated. Server is unwilling to perform.") + +# +# Configuration errors +# +CONFIGURATION_CATEGORY = 0x0004 + +CONFIG_REQUIRED_GROUPS = gen_error_code( + CONFIGURATION_CATEGORY, + 0x0001, + "The admins and editors groups are required.") + +CONFIG_DEFAULT_GROUP = gen_error_code( + CONFIGURATION_CATEGORY, + 0x0002, + "You cannot remove the default users group.") diff --git a/ipa-python/ipautil.py b/ipa-python/ipautil.py index 7006e1951..e98aa4c6e 100644 --- a/ipa-python/ipautil.py +++ b/ipa-python/ipautil.py @@ -36,6 +36,22 @@ from string import lower import re import xmlrpclib import datetime +try: + from subprocess import CalledProcessError + class CalledProcessError(subprocess.CalledProcessError): + def __init__(self, returncode, cmd): + super(CalledProcessError, self).__init__(returncode, cmd) +except ImportError: + # Python 2.4 doesn't implement CalledProcessError + class CalledProcessError(Exception): + """This exception is raised when a process run by check_call() returns + a non-zero exit status. The exit status will be stored in the + returncode attribute.""" + def __init__(self, returncode, cmd): + self.returncode = returncode + self.cmd = cmd + def __str__(self): + return "Command '%s' returned non-zero exit status %d" % (self.cmd, self.returncode) def realm_to_suffix(realm_name): s = realm_name.split(".") @@ -66,7 +82,7 @@ def run(args, stdin=None): logging.info(stderr) if p.returncode != 0: - raise subprocess.CalledProcessError(p.returncode, ' '.join(args)) + raise self.CalledProcessError(p.returncode, ' '.join(args)) def file_exists(filename): try: |