diff options
author | Martin Kosek <mkosek@redhat.com> | 2011-07-18 09:33:57 +0200 |
---|---|---|
committer | Martin Kosek <mkosek@redhat.com> | 2011-07-18 09:36:43 +0200 |
commit | 50a2c45760d51e7a13888702e1a047a113bc1f5e (patch) | |
tree | 26445179b4e7a072800072f78a1cf5cf1a5740e1 /install/tools/ipa-compliance | |
parent | 5f0adc3fbe5b193a57b05eed70b9f59463d9d9da (diff) | |
download | freeipa-50a2c45760d51e7a13888702e1a047a113bc1f5e.tar.gz freeipa-50a2c45760d51e7a13888702e1a047a113bc1f5e.tar.xz freeipa-50a2c45760d51e7a13888702e1a047a113bc1f5e.zip |
Check IPA configuration in install tools
Install tools may fail with unexpected error when IPA server is not
installed on a system. Improve user experience by implementing
a check to affected tools.
https://fedorahosted.org/freeipa/ticket/1327
https://fedorahosted.org/freeipa/ticket/1347
Diffstat (limited to 'install/tools/ipa-compliance')
-rw-r--r-- | install/tools/ipa-compliance | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/install/tools/ipa-compliance b/install/tools/ipa-compliance index 81cd8c370..8ae91b777 100644 --- a/install/tools/ipa-compliance +++ b/install/tools/ipa-compliance @@ -35,6 +35,7 @@ try: from ipaserver.plugins.ldap2 import ldap2 from ipalib import api, errors, backend + from ipaserver.install import installutils except ImportError, e: # If python-rhsm isn't installed exit gracefully and quietly. if e.args[0] == 'No module named rhsm.certificate': @@ -165,8 +166,7 @@ def check_compliance(tmpdir, debug=False): print 'IPA is in compliance: %d of %d entitlements used.' % (hostcount, available) def main(): - if os.getegid() != 0: - sys.exit("Must be root to check compliance") + installutils.check_server_configuration() if not os.path.exists('/etc/ipa/default.conf'): return 0 @@ -189,4 +189,12 @@ def main(): return 0 -sys.exit(main()) +try: + if not os.geteuid()==0: + sys.exit("\nMust be root to check compliance\n") + + main() +except SystemExit, e: + sys.exit(e) +except RuntimeError, e: + sys.exit(e) |