<div dir="ltr"><div class="gmail_default" style="font-family:'times new roman',serif">I did something to keystone, I'm not sure what.</div><div class="gmail_default" style="font-family:'times new roman',serif">
<br></div><div class="gmail_default" style><div class="gmail_default" style="font-family:'times new roman',serif">root@controller1-prod.controller1-prod:~# keystone role-list</div><div class="gmail_default" style="font-family:'times new roman',serif">
Authorization Failed: 'module' object is not callable<br></div><div class="gmail_default" style="font-family:'times new roman',serif">root@controller1-prod.controller1-prod:~#</div><div class="gmail_default" style="font-family:'times new roman',serif">
root@controller1-prod.controller1-prod:~# keystone role-get admin</div><div class="gmail_default" style="font-family:'times new roman',serif">Authorization Failed: 'module' object is not callable<br></div>
<div class="gmail_default" style="font-family:'times new roman',serif">root@controller1-prod.controller1-prod:~# </div><div><br></div><div class="gmail_default" style="font-family:'times new roman',serif">
<br></div><div class="gmail_default" style="font-family:'times new roman',serif">I have envars OS_USERNAME, OS_PASSWORD, OS_TENANT defined.  OS_AUTH_URL has a URL:</div><div class="gmail_default" style><div class="gmail_default" style>
<font face="times new roman, serif">root@controller1-prod.controller1-prod:~# curl -i <a href="http://controller1-prod.sea.opencandy.com:35357/v2.0">http://controller1-prod.sea.opencandy.com:35357/v2.0</a></font></div><div class="gmail_default" style>
<font face="times new roman, serif">HTTP/1.1 200 OK</font></div><div class="gmail_default" style><font face="times new roman, serif">Vary: X-Auth-Token</font></div><div class="gmail_default" style><font face="times new roman, serif">Content-Type: application/json</font></div>
<div class="gmail_default" style><font face="times new roman, serif">Date: Fri, 01 Aug 2014 21:10:47 GMT</font></div><div class="gmail_default" style><font face="times new roman, serif">Transfer-Encoding: chunked</font></div>
<div class="gmail_default" style><font face="times new roman, serif"><br></font></div><div class="gmail_default" style><font face="times new roman, serif">{"version": {"status": "stable", "updated": "2012-10-13T17:42:56Z", "media-types": [{"base": "application/json", "type": "application/vnd.openstack.identity-v2.0+json"}, {"base": "application/xml", "type": "application/vnd.openstack.identity-v2.0+xml"}], "id": "v2.0", "links": [{"href": "<a href="http://controller1-prod.sea.opencandy.com:35357/v2.0/">http://controller1-prod.sea.opencandy.com:35357/v2.0/</a>", "rel": "self"}, {"href": "<a href="http://docs.openstack.org/api/openstack-identity-service/2.0/content/">http://docs.openstack.org/api/openstack-identity-service/2.0/content/</a>", "type": "text/html", "rel": "describedby"}, {"href": "<a href="http://docs.openstack.org/api/openstack-identity-service/2.0/identity-dev-guide-2.0.pdf">http://docs.openstack.org/api/openstack-identity-service/2.0/identity-dev-guide-2.0.pdf</a>", "type": "application/pdf", "rel": "describedby"}]}}root@controller1-prod.controller1-prod:~# </font></div>
<div style="font-family:'times new roman',serif"><br></div></div><div class="gmail_default" style="font-family:'times new roman',serif"><br></div><div class="gmail_default" style="font-family:'times new roman',serif">
I have been poking at keystone with pdb to try find the point where the exception is raised, with little success.  Maybe I am incompetent as a python programmer.</div><div class="gmail_default" style="font-family:'times new roman',serif">
<br></div><div class="gmail_default" style="font-family:'times new roman',serif">I have discovered that keystoneclient does a call to the identity server to get a token - I think.  I tried to simulate the call using curl.</div>
<div class="gmail_default" style="font-family:'times new roman',serif"><br></div><div class="gmail_default" style="font-family:'times new roman',serif"><pre>root@controller1-prod.controller1-prod:~# curl -i <a href="http://controller1-prod.sea.opencandy.com:35357/v2.0/tokens">http://controller1-prod.sea.opencandy.com:35357/v2.0/tokens</a><br>
HTTP/1.1 404 Not Found<br>Vary: X-Auth-Token<br>Content-Type: application/json<br>Date: Fri, 01 Aug 2014 20:26:00 GMT<br>Transfer-Encoding: chunked<br><br>{"error": {"message": "The resource could not be found.", "code": 404, "title": "Not Found"}}</pre>
</div><div class="gmail_default" style="font-family:'times new roman',serif"><br></div><div class="gmail_default" style="font-family:'times new roman',serif">One of the things I find frustrating is the code assumes that any error is an authorization problem, which means that any bug is handled and doesn't percolate up the stack.  There seems to be no way to get the debugger to halt on a handled exception.  In client.py, there is</div>
<div class="gmail_default" style="font-family:'times new roman',serif"><div class="gmail_default">        except Exception as e:</div><div class="gmail_default">            raise exceptions.AuthorizationFailure("Authorization Failed: "</div>
<div>which makes debugging a challenge..</div></div><div class="gmail_default" style="font-family:'times new roman',serif"><br></div><div class="gmail_default" style="font-family:'times new roman',serif">I think that the exception is in the call to a.get_auth_ref(self.session).  I think that the problem is that a, a Password object, is not callable.</div>
<div class="gmail_default" style="font-family:'times new roman',serif"><br></div><div class="gmail_default" style><div class="gmail_default" style="font-family:'times new roman',serif">(Pdb) print callable(a)</div>
<div class="gmail_default" style="font-family:'times new roman',serif">False</div><div class="gmail_default" style="font-family:'times new roman',serif">(Pdb) </div><div class="gmail_default" style><div class="gmail_default" style>
<font face="times new roman, serif">(Pdb) list</font></div><div class="gmail_default" style><font face="times new roman, serif">168  <span class="" style="white-space:pre">     </span>                                      token=token,</font></div>
<div class="gmail_default" style><font face="times new roman, serif">169  <span class="" style="white-space:pre">    </span>                                      trust_id=trust_id,</font></div><div class="gmail_default" style>
<font face="times new roman, serif">170  <span class="" style="white-space:pre">     </span>                                      tenant_id=project_id or tenant_id,</font></div><div class="gmail_default" style><font face="times new roman, serif">171  <span class="" style="white-space:pre">   </span>                                      tenant_name=project_name or tenant_name)</font></div>
<div class="gmail_default" style><font face="times new roman, serif">172  <span class="" style="white-space:pre">    </span></font></div><div class="gmail_default" style><font face="times new roman, serif">173  -><span class="" style="white-space:pre"> </span>            return a.get_auth_ref(self.session)</font></div>
<div class="gmail_default" style><font face="times new roman, serif">174  <span class="" style="white-space:pre">    </span>        except (exceptions.AuthorizationFailure, exceptions.Unauthorized):</font></div><div class="gmail_default" style>
<font face="times new roman, serif">175  <span class="" style="white-space:pre">     </span>            _logger.debug("Authorization Failed.")</font></div><div class="gmail_default" style><font face="times new roman, serif">176  <span class="" style="white-space:pre">    </span>            raise</font></div>
<div class="gmail_default" style><font face="times new roman, serif">177  <span class="" style="white-space:pre">    </span>        except exceptions.EndpointNotFound:</font></div><div class="gmail_default" style><font face="times new roman, serif">178  <span class="" style="white-space:pre">       </span>            msg = 'There was no suitable authentication url for this request'</font></div>
<div style="font-family:'times new roman',serif"><br></div></div><div style="font-family:'times new roman',serif"><br></div><div style><div style><font face="times new roman, serif">(Pdb) pp vars(a)</font></div>
<div style><font face="times new roman, serif">{'auth_ref': None,</font></div><div style><font face="times new roman, serif"> 'auth_url': '<a href="http://controller1-prod.sea.opencandy.com:35357/v2.0">http://controller1-prod.sea.opencandy.com:35357/v2.0</a>',</font></div>
<div style><font face="times new roman, serif"> 'password': "XXXXXXXXXXX",</font></div><div style><font face="times new roman, serif"> 'tenant_id': None,</font></div><div style><font face="times new roman, serif"> 'tenant_name': 'admin',</font></div>
<div style><font face="times new roman, serif"> 'token': None,</font></div><div style><font face="times new roman, serif"> 'trust_id': None,</font></div><div style><font face="times new roman, serif"> 'username': 'admin'}</font></div>
<div style><font face="times new roman, serif">(Pdb) </font></div></div><div style="font-family:'times new roman',serif"><br></div></div><div class="gmail_default" style="font-family:'times new roman',serif">
I instrumented the code to see if I could get a better handle on the exception getting thrown:</div><div class="gmail_default" style="font-family:'times new roman',serif"><br></div><div class="gmail_default" style>
<div class="gmail_default" style><font face="times new roman, serif">(Pdb) list 165,184</font></div><div class="gmail_default" style><font face="times new roman, serif">165  <span class="" style="white-space:pre">    </span>            a = v2_auth.Auth._factory(auth_url,</font></div>
<div class="gmail_default" style><font face="times new roman, serif">166  <span class="" style="white-space:pre">    </span>                                      username=username,</font></div><div class="gmail_default" style>
<font face="times new roman, serif">167  <span class="" style="white-space:pre">     </span>                                      password=password,</font></div><div class="gmail_default" style><font face="times new roman, serif">168  <span class="" style="white-space:pre">   </span>                                      token=token,</font></div>
<div class="gmail_default" style><font face="times new roman, serif">169  <span class="" style="white-space:pre">    </span>                                      trust_id=trust_id,</font></div><div class="gmail_default" style>
<font face="times new roman, serif">170  <span class="" style="white-space:pre">     </span>                                      tenant_id=project_id or tenant_id,</font></div><div class="gmail_default" style><font face="times new roman, serif">171  <span class="" style="white-space:pre">   </span>                                      tenant_name=project_name or tenant_name)</font></div>
<div class="gmail_default" style><font face="times new roman, serif">172  <span class="" style="white-space:pre">    </span></font></div><div class="gmail_default" style><font face="times new roman, serif">173  <span class="" style="white-space:pre">      </span>            try:</font></div>
<div class="gmail_default" style><font face="times new roman, serif">174  <span class="" style="white-space:pre">    </span>                return a.get_auth_ref(self.session)</font></div><div class="gmail_default" style><font face="times new roman, serif">175  <span class="" style="white-space:pre">   </span>            except Exception as e:</font></div>
<div class="gmail_default" style><font face="times new roman, serif">176  <span class="" style="white-space:pre">    </span>                print "Hit an exception %s" % e </font></div><div class="gmail_default" style>
<font face="times new roman, serif">177  <span class="" style="white-space:pre">     </span>                pdb.set_trace()</font></div><div class="gmail_default" style><font face="times new roman, serif">178  -><span class="" style="white-space:pre">  </span>                raise</font></div>
<div class="gmail_default" style><font face="times new roman, serif">179  <span class="" style="white-space:pre">    </span>        except (exceptions.AuthorizationFailure, exceptions.Unauthorized):</font></div><div class="gmail_default" style>
<font face="times new roman, serif">180  <span class="" style="white-space:pre">     </span>            _logger.debug("Authorization Failed.")</font></div><div class="gmail_default" style><font face="times new roman, serif">181  <span class="" style="white-space:pre">    </span>            raise</font></div>
<div class="gmail_default" style><font face="times new roman, serif">182  <span class="" style="white-space:pre">    </span>        except exceptions.EndpointNotFound:</font></div><div class="gmail_default" style><font face="times new roman, serif">183  <span class="" style="white-space:pre">       </span>            msg = 'There was no suitable authentication url for this request'</font></div>
<div class="gmail_default" style><font face="times new roman, serif">184  <span class="" style="white-space:pre">    </span>            raise exceptions.AuthorizationFailure(msg)</font></div><div style="font-family:'times new roman',serif">
<br></div><div style="font-family:'times new roman',serif"><div>(Pdb) c</div><div>Hit an exception 'module' object is not callable</div><div>> /usr/lib/python2.6/site-packages/keystoneclient/v2_0/client.py(178)get_raw_token_from_identity_service()</div>
<div>-> raise</div><div><br></div></div></div><div class="gmail_default" style="font-family:'times new roman',serif"><br></div><div class="gmail_default" style="font-family:'times new roman',serif">Not sure what to do next.</div>
<div class="gmail_default" style="font-family:'times new roman',serif"><br></div><div class="gmail_default" style="font-family:'times new roman',serif"><br></div><div class="gmail_default" style="font-family:'times new roman',serif">
Jeff</div><div class="gmail_default" style="font-family:'times new roman',serif"><br></div><div class="gmail_default" style="font-family:'times new roman',serif"><br></div></div><div><br></div>-- <br><div dir="ltr">
<b>Jeff Silverman</b><div>Systems Engineer</div><div>(253) 459-2318 (c)</div><div><img src="https://dl.dropboxusercontent.com/u/16943296/SweetLabs-Signatures/New_2014/signature-logo.png"><br></div></div>
</div>