Bug 1267821

Summary: [abrt] packagedb-cli: base.py:652:login:BugzillaError: Login failed: The username or password you entered is not valid.
Product: [Fedora] Fedora Reporter: Vít Ondruch <vondruch>
Component: packagedb-cliAssignee: Pierre-YvesChibon <pingou>
Status: CLOSED UPSTREAM QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: crobinso, lmacken, pingou, vondruch
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
URL: https://retrace.fedoraproject.org/faf/reports/bthash/736fca2617182b5113d9d623def16f68daa30293
Whiteboard: abrt_hash:9c059f75f8b2042e48b60714ab284f39fab4b43f;
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-10-07 12:42:41 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
File: backtrace
none
File: dso_list
none
File: environ none

Description Vít Ondruch 2015-10-01 07:22:13 UTC
Version-Release number of selected component:
packagedb-cli-2.9-1.fc24

Additional info:
reporter:       libreport-2.6.2
cmdline:        /usr/bin/python /usr/bin/pkgdb-cli acl rubygem-i18n_data
executable:     /usr/bin/pkgdb-cli
kernel:         4.3.0-0.rc2.git1.1.fc24.x86_64
runlevel:       N 5
type:           Python
uid:            16025

Truncated backtrace:
base.py:652:login:BugzillaError: Login failed: The username or password you entered is not valid.

Traceback (most recent call last):
  File "/usr/bin/pkgdb-cli", line 9, in <module>
    load_entry_point('packagedb-cli==2.9', 'console_scripts', 'pkgdb-cli')()
  File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 558, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2682, in load_entry_point
    return ep.load()
  File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2355, in load
    return self.resolve()
  File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2361, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/usr/lib/python2.7/site-packages/pkgdb2client/cli.py", line 28, in <module>
    import pkgdb2client.utils
  File "/usr/lib/python2.7/site-packages/pkgdb2client/utils.py", line 40, in <module>
    BZCLIENT = Bugzilla(url=RH_BZ_API)
  File "/usr/lib/python2.7/site-packages/bugzilla/base.py", line 396, in __init__
    self.__class__.__init__(self, **kwargs)
  File "/usr/lib/python2.7/site-packages/bugzilla/rhbugzilla.py", line 55, in __init__
    _parent.__init__(self, *args, **kwargs)
  File "/usr/lib/python2.7/site-packages/bugzilla/base.py", line 450, in __init__
    self.connect(url)
  File "/usr/lib/python2.7/site-packages/bugzilla/base.py", line 603, in connect
    self.login()
  File "/usr/lib/python2.7/site-packages/bugzilla/base.py", line 652, in login
    raise BugzillaError("Login failed: %s" % str(e.faultString))
BugzillaError: Login failed: The username or password you entered is not valid.

Local variables in innermost frame:
self: <bugzilla.rhbugzilla.RHBugzilla object at 0x7fb876392b10>
password: None
e: <Fault 300: 'The username or password you entered is not valid.'>
user: None

Comment 1 Vít Ondruch 2015-10-01 07:22:17 UTC
Created attachment 1078958 [details]
File: backtrace

Comment 2 Vít Ondruch 2015-10-01 07:22:19 UTC
Created attachment 1078959 [details]
File: dso_list

Comment 3 Vít Ondruch 2015-10-01 07:22:20 UTC
Created attachment 1078960 [details]
File: environ

Comment 4 Pierre-YvesChibon 2015-10-01 14:37:33 UTC
The source is python-bugzilla, I've asked on their mailing list for input as throwing an exception here seems odd to me.
Let's see where the bug lays :)

Comment 5 Cole Robinson 2015-10-05 19:47:12 UTC
Vit, on the affected system, can you run this mini script:

$ cat test.py 
import bugzilla
import logging
logging.basicConfig(level=logging.DEBUG)

bzapi = bugzilla.Bugzilla("https://bugzilla.redhat.com/xmlrpc.cgi")
print bzapi.getbug(1267821)


And post the output?

Comment 6 Vít Ondruch 2015-10-06 06:46:24 UTC
(In reply to Cole Robinson from comment #5)
$ python test.py 
DEBUG:bugzilla:Detecting subclass for https://bugzilla.redhat.com/xmlrpc.cgi
INFO:bugzilla:Using RHBugzilla for URL containing bugzilla.redhat.com
INFO:bugzilla:Chose subclass RHBugzilla v0.1
DEBUG:bugzilla.base:Using tokenfile=/home/vondruch/.bugzillatoken
DEBUG:bugzilla.base:Using cookiefile=/home/vondruch/.bugzillacookies
DEBUG:bugzilla.base:Searching for config section matching https://bugzilla.redhat.com/xmlrpc.cgi
DEBUG:bugzilla.base:Found matching section: bugzilla.redhat.com
DEBUG:bugzilla.base:Setting 'user' from configfile
DEBUG:bugzilla.base:Setting 'password' from configfile
INFO:bugzilla.base:user and password present - doing login()
INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): bugzilla.redhat.com
DEBUG:requests.packages.urllib3.connectionpool:"POST /xmlrpc.cgi HTTP/1.1" 200 None
Traceback (most recent call last):
  File "test.py", line 5, in <module>
    bzapi = bugzilla.Bugzilla("https://bugzilla.redhat.com/xmlrpc.cgi")
  File "/usr/lib/python2.7/site-packages/bugzilla/base.py", line 396, in __init__
    self.__class__.__init__(self, **kwargs)
  File "/usr/lib/python2.7/site-packages/bugzilla/rhbugzilla.py", line 55, in __init__
    _parent.__init__(self, *args, **kwargs)
  File "/usr/lib/python2.7/site-packages/bugzilla/base.py", line 450, in __init__
    self.connect(url)
  File "/usr/lib/python2.7/site-packages/bugzilla/base.py", line 603, in connect
    self.login()
  File "/usr/lib/python2.7/site-packages/bugzilla/base.py", line 652, in login
    raise BugzillaError("Login failed: %s" % str(e.faultString))
bugzilla.base.BugzillaError: Login failed: The username or password you entered is not valid.


Actually, I had to change my password after recent BZ update, while the old is persisted somewhere in ~/.bugzillarc presumably.

So I tried to remove ~/.bugzilla* from my home and I got pkgdb-cli working. I tried to remove just ~/.bugzillarc and I got error "Error: <Fault 32000: 'The cookies or token provide were not valid or have expired. You may login again to get new cookies or a new token.'>". Fixing the password in ~/.bugzillarc helped as well.

And a few additional remarks:

1) pkgdb-cli should handle all these states gracefully.
2) Why is Bugzilla queried anyway? The package name implies that it is CLI utility for pkgdb, so pkgdb is the only service which should be queried.
3) How the password actually got into the ~/.bugzillarc file? I am totally unaware that I have stored the password in plain text in such file.

Comment 7 Pierre-YvesChibon 2015-10-06 07:07:36 UTC

> 1) pkgdb-cli should handle all these states gracefully.

Agreed, but I'm first interested in finding out why this happens in the first place

> 2) Why is Bugzilla queried anyway? The package name implies that it is CLI 
> utility for pkgdb, so pkgdb is the only service which should be queried.

That's the beauty of this bug, bugzilla isn't being queried. I just instantiate a bugzilla object that is used by the pkgdb-admin script.

> 3) How the password actually got into the ~/.bugzillarc file? I am totally 
> unaware that I have stored the password in plain text in such file.

I checked on my system, I do not even have this file :-/

Comment 8 Cole Robinson 2015-10-06 14:49:56 UTC
(In reply to Vít Ondruch from comment #6)
> 
> 
> Actually, I had to change my password after recent BZ update, while the old
> is persisted somewhere in ~/.bugzillarc presumably.
> 
> So I tried to remove ~/.bugzilla* from my home and I got pkgdb-cli working.
> I tried to remove just ~/.bugzillarc and I got error "Error: <Fault 32000:
> 'The cookies or token provide were not valid or have expired. You may login
> again to get new cookies or a new token.'>". Fixing the password in
> ~/.bugzillarc helped as well.
> 

If you delete .bugzillarc, then run '/usr/bin/bugzilla login', a bugzilla API token will be saved to ~/.bugzillatoken, and you won't need to keep a plain text password around.

> 3) How the password actually got into the ~/.bugzillarc file? I am totally
> unaware that I have stored the password in plain text in such file.

FWIW python-bugzilla will never create that file, so my guess is you created it a long time ago and forgot about it?

Also, I'll make a note to add better logging and possible error messages here if .bugzillarc is used

Comment 9 Pierre-YvesChibon 2015-10-07 12:42:41 UTC
Fixed upstream in https://github.com/fedora-infra/packagedb-cli/pull/43