<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<p><font size="+1">Hi John , <br>
</font></p>
<p><font size="+1">you're right, thank you.</font><br>
</p>
<pre class="moz-signature" cols="72">--
----------------------------------------------------
Margin Hu
Love Open Source Software.
Mobile: (86) 186-8035-6499
email : <a class="moz-txt-link-abbreviated" href="mailto:jhu_com@outlook.com">jhu_com@outlook.com</a>
github: <a class="moz-txt-link-freetext" href="http://github.com/todaygood">http://github.com/todaygood</a>
-----------------------------------------------------</pre>
<div class="moz-cite-prefix">On 12/10/2016 03:08 PM, John Petrini wrote:<br>
</div>
<blockquote cite="mid:CAD4AmV7RLzWZSA3DqEM+7U8khz5MouQ6WVzFMjxtryV0R7AS3g@mail.gmail.com" type="cite">
<div dir="ltr">It looks like when you request the token you are not providing tenantName so you're not generating a token for authenticating to tenant/project you want to authenticate to. i.e. e5ec75ca491049b2b3d6758269aad07c<br>
<div class="gmail_extra"><br clear="all">
<div>
<div class="gmail_signature">
<div dir="ltr">
<div dir="ltr">
<div>
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<p style="margin-top:8px;margin-bottom:8px;font-family:helvetica,verdana,arial,sans-serif;font-size:0.85em;color:rgb(51,51,51);line-height:1.4">
<span style="font-size:0.85em;line-height:1.4">___</span><br>
</p>
<p style="margin-top:8px;margin-bottom:8px;font-family:helvetica,verdana,arial,sans-serif;font-size:1.1em;color:rgb(51,51,51);line-height:1.4">
John Petrini</p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<br>
<div class="gmail_quote">On Sat, Dec 10, 2016 at 7:43 AM, Jun Hu <span dir="ltr">
<<a moz-do-not-send="true" href="mailto:jhu_com@outlook.com" target="_blank">jhu_com@outlook.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px
0.8ex;border-left:1px solid
rgb(204,204,204);padding-left:1ex">
<div bgcolor="#FFFFFF">
<p><font size="+1">Hi Guys:</font></p>
<p><font size="+1">My openstack version is Mitaka. I want to use curl to call openstack API , but I met a issue. Can you help me ?
<br>
</font></p>
<p><font size="+1">[root@ospp9-ctrl1 site-packages(keystone_demo)]# source ~/keystonerc_admin<br>
<br>
[root@ospp9-ctrl1 site-packages(keystone_admin)]<wbr># curl -s -X POST $OS_AUTH_URL/tokens -H "Content-Type: application/json" -d '{"auth": {"tenantName": "", "passwordCredentials": {"username": "'"$OS_USERNAME"'", "password": "'"$OS_PASSWORD"'"}}}' | python
-m json.tool<br>
{<br>
"access": {<br>
"metadata": {<br>
"is_admin": 0,<br>
"roles": []<br>
},<br>
"serviceCatalog": [],<br>
"token": {<br>
"audit_ids": [<br>
"RJrDyNfIShyKTmXu5IWZUw"<br>
],<br>
"expires": "2016-12-10T13:12:15Z",<br>
"id": "<wbr>80b3d146c5614c149ccf983b21d930<wbr>55",<br>
"issued_at": "2016-12-10T12:12:15.171884Z"<br>
},<br>
"user": {<br>
"id": "<wbr>ae11a07ef07e47bba4a91d1c3516ac<wbr>01",<br>
"name": "admin",<br>
"roles": [],<br>
"roles_links": [],<br>
"username": "admin"<br>
}<br>
}<br>
}<br>
[root@ospp9-ctrl1 site-packages(keystone_admin)]<wbr># export OS_TOKEN=<wbr>80b3d146c5614c149ccf983b21d930<wbr>55<br>
[root@ospp9-ctrl1 site-packages(keystone_admin)]<wbr># export OS_PROJECT_ID=<wbr>e5ec75ca491049b2b3d6758269aad0<wbr>7c<br>
[root@ospp9-ctrl1 site-packages(keystone_admin)]<wbr># curl -s -H "X-Auth-Token:$OS_TOKEN"
<a moz-do-not-send="true" class="gmail-m_-263425083183485215moz-txt-link-freetext" href="http://192.168.122.64:8774/v2/e5ec75ca491049b2b3d6758269aad07c/flavors" target="_blank">
http://192.168.122.64:8774/v2/<wbr>e5ec75ca491049b2b3d6758269aad0<wbr>7c/flavors</a> | python -m json.tool
<br>
{<br>
"badRequest": {<br>
"code": 400,<br>
"message": "Malformed request URL: URL's project_id '<wbr>e5ec75ca491049b2b3d6758269aad0<wbr>7c' doesn't match Context's project_id 'None'"<br>
}<br>
}<br>
<br>
[root@ospp9-ctrl1 site-packages(keystone_admin)]<wbr># openstack catalog show nova<br>
+-----------+-----------------<wbr>------------------------------<wbr>------------------------------<wbr>--+<br>
| Field | Value <wbr> <wbr> |<br>
+-----------+-----------------<wbr>------------------------------<wbr>------------------------------<wbr>--+<br>
| endpoints | RegionOne <wbr> <wbr> |<br>
| | publicURL: <a moz-do-not-send="true" class="gmail-m_-263425083183485215moz-txt-link-freetext" href="http://192.168.122.64:8774/v2/e5ec75ca491049b2b3d6758269aad07c" target="_blank">
http://192.168.122.64:8774/v2/<wbr>e5ec75ca491049b2b3d6758269aad0<wbr>7c</a> |<br>
| | internalURL: <a moz-do-not-send="true" class="gmail-m_-263425083183485215moz-txt-link-freetext" href="http://192.168.122.64:8774/v2/e5ec75ca491049b2b3d6758269aad07c" target="_blank">
http://192.168.122.64:8774/v2/<wbr>e5ec75ca491049b2b3d6758269aad0<wbr>7c</a> |<br>
| | adminURL: <a moz-do-not-send="true" class="gmail-m_-263425083183485215moz-txt-link-freetext" href="http://192.168.122.64:8774/v2/e5ec75ca491049b2b3d6758269aad07c" target="_blank">
http://192.168.122.64:8774/v2/<wbr>e5ec75ca491049b2b3d6758269aad0<wbr>7c</a> |<br>
| | <wbr> <wbr> |<br>
| name | nova <wbr> <wbr> |<br>
| type | compute <wbr> <wbr> |<br>
+-----------+-----------------<wbr>------------------------------<wbr>------------------------------<wbr>--+<br>
</font></p>
<p><font size="+1">1. After I deep into the code, and have a question : How to get/set the
</font><font size="+1"><font size="+1">context.project_id? <br>
</font></font></p>
<p><br>
</p>
<p><font size="+1">[root@ospp9-ctrl1 site-packages(keystone_admin)]<wbr># vim nova/api/openstack/wsgi.py +721<br>
```python<br>
project_id = action_args.pop("project_id", None)<br>
context = request.environ.get('nova.<wbr>context')<br>
if (context and project_id and (project_id != context.project_id)):<br>
msg = _("Malformed request URL: URL's project_id '%(project_id)s'"<br>
" doesn't match Context's project_id"<br>
" '%(context_project_id)s'") % \<br>
{'project_id': project_id,<br>
'context_project_id': context.project_id}<br>
return Fault(webob.exc.<wbr>HTTPBadRequest(explanation=<wbr>msg))<br>
```<br>
</font></p>
<p>2. Why got empty SeviceCatalog <font size="+1">"serviceCatalog": []" but it is not in official docs
<br>
</font></p>
<a moz-do-not-send="true" class="gmail-m_-263425083183485215moz-txt-link-freetext" href="http://developer.openstack.org/api-guide/quick-start/api-quick-start.html#openstack-api-quick-guide" target="_blank">http://developer.openstack.<wbr>org/api-guide/quick-start/api-<wbr>quick-start.html#openstack-<wbr>api-quick-guide</a><span class="gmail-HOEnZb"><font color="#888888"><br>
<br>
<pre class="gmail-m_-263425083183485215moz-signature" cols="72">--
------------------------------<wbr>----------------------
Margin Hu
Love Open Source Software.
Mobile: (86) 186-8035-6499
email : <a moz-do-not-send="true" class="gmail-m_-263425083183485215moz-txt-link-abbreviated" href="mailto:jhu_com@outlook.com" target="_blank">jhu_com@outlook.com</a>
github: <a moz-do-not-send="true" class="gmail-m_-263425083183485215moz-txt-link-freetext" href="http://github.com/todaygood" target="_blank">http://github.com/todaygood</a>
-----------------------------<wbr>----------------------</pre>
</font></span></div>
______________________________<wbr>_________________ Mailing list: <a moz-do-not-send="true" href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack" rel="noreferrer" target="_blank">
http://lists.openstack.org/<wbr>cgi-bin/mailman/listinfo/<wbr>openstack</a> Post to :
<a moz-do-not-send="true" href="mailto:openstack@lists.openstack.org">openstack@lists.openstack.org</a> Unsubscribe :
<a moz-do-not-send="true" href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack" rel="noreferrer" target="_blank">
http://lists.openstack.org/<wbr>cgi-bin/mailman/listinfo/<wbr>openstack</a> </blockquote>
</div>
</div>
</div>
</blockquote>
</body>
</html>