Bug 439268 - ipa-addservice throws python exception
ipa-addservice throws python exception
Product: freeIPA
Classification: Community
Component: ipa-admintools (Show other bugs)
All Linux
low Severity low
: ---
: ---
Assigned To: Rob Crittenden
Fedora Extras Quality Assurance
Depends On:
Blocks: freeipa10 453489
  Show dependency treegraph
Reported: 2008-03-27 15:33 EDT by Daniel Berrange
Modified: 2010-09-03 10:34 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2010-09-03 10:34:35 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Daniel Berrange 2008-03-27 15:33:23 EDT
Description of problem:
# ipa-addservice 
Traceback (most recent call last):
  File "/usr/sbin/ipa-addservice", line 79, in <module>
    except xmlrpclib.Fault, fault:
NameError: name 'xmlrpclib' is not defined

Looking at the code, it appears the 'import xmlrpclib' block is in the wrong
place. It is inside the earlier 'try' statement, so is out of scope when python
tries to process the 'except xmlrpclib' code.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1.Run   "ipa-addservice"
Actual results:

Expected results:
Traceback (most recent call last):
  File "/usr/sbin/ipa-addservice", line 79, in <module>
    except xmlrpclib.Fault, fault:
NameError: name 'xmlrpclib' is not defined

Additional info:
Comment 1 Rob Crittenden 2008-03-27 15:38:49 EDT
Yes, I saw this too in another program. Went a little nuts trying to let the
user hit ^C without seeing a backtrace if they did it during the import stage.

If you move the imports to the top of the file you'll be able to see the root
cause of the failure. Can you do that so I try to tackle that as well?
Comment 2 Daniel Berrange 2008-03-27 15:54:45 EDT
I had todo several things:

 - Move all the import statements to the top of ipa-addservice
 - Add a missing 'import ldap' statement to ipa.py, or equivalently move 'import
ldap' before 'import ipa'. The former is better though.
 - Install the  'python-ldap'  RPM - a missing Requires:  on ipa-admintools RPM spec

Then i finally got the error i was expecting

# ipa-addservice 
IPA server not found in DNS, in the config file (/etc/ipa/ipa.conf) or on the
command line.
Comment 3 Bug Zapper 2008-05-14 04:20:34 EDT
Changing version to '9' as part of upcoming Fedora 9 GA.
More information and reason for this action is here:
Comment 4 Rob Crittenden 2008-05-14 11:54:56 EDT
This was fixed upstream as a side-effect of bug 443987.
Comment 6 Michael Gregg 2008-11-19 19:46:19 EST
Verified against  

[root@ipaqa-64vm ~]# ipa-addservice
usage: ipa-addservice [options] principal

ipa-addservice: error: no principal specified
[root@ipaqa-64vm ~]# echo $?

Note You need to log in before you can comment on or make changes to this bug.