Skip to content

Commit

Permalink
Bug fix: don't fall back to user/pass if kerberos is configured
Browse files Browse the repository at this point in the history
this was revealed by the recently added integration test:
https://github.com/kiwitcms/tcms-api/runs/522277212

the root cause is that if statement checking for `use_kerberos`
doesn't have a false branch and execution falls-through to
raising exception b/c username/password aren't defined in tcms.conf
  • Loading branch information
atodorov committed Mar 20, 2020
1 parent 54f5d92 commit d110656
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion tcms_api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,15 +97,18 @@ def __init__(self):
if strtobool(config['tcms'].get('use_kerberos', 'False')):
# use Kerberos
TCMS._connection = TCMSKerbXmlrpc(config['tcms']['url']).server
return

# use plain authentication otherwise
try:
# use password authentication
TCMS._connection = TCMSXmlrpc(config['tcms']['username'],
config['tcms']['password'],
config['tcms']['url']).server
except KeyError:
raise Exception("username/password required in %s" % self._path)

return

@property
def exec(self):
"""
Expand Down

0 comments on commit d110656

Please sign in to comment.