In Kilo code release, nova boot failed on keystoneclient with 500 error - openstack-nova

I have kilo rc1 installed on CentOS7 with following rpm pkgs.
# rpm -qa | grep -Ei 'nova|urllib3|request|six'
requests-2.6.0-1.noarch
python-novaclient-2.23.0.post13-1.noarch
nova-2015.1.0rc1-1.noarch
six-1.9.0-1.noarch
nova-docker-0.0.0.post183-1.noarch
urllib3-1.10.1-1.noarch
Keystone, Glance and Neutron work as expected plus nova GET method such as nova service-list. All password and configuration files have been verified. when issuing a nova boot cmd, I got http 500 error detailed below.
--- Get the token with neutron/password ----
# openstack token issue
+------------+----------------------------------+
| Field | Value |
+------------+----------------------------------+
| expires | 2015-04-22T21:12:14Z |
| id | 24e6a5e2546c41c98865c946f10f7ddb |
| project_id | 0ece3f1cc56a4a0bba1906b43d1faceb |
| user_id | ef18eea137ed4dabad1f92f4a393fd70 |
+------------+----------------------------------+
-------------- Used the issued token to call nova API ---------------
# curl -g -i -X GET http://10.0.0.244:8774/v2/0ece3f1cc56a4a0bba1906b43d1faceb/os-services -H "User-Agent: python-novaclient" -H "Accept: application/json" -H "X-Auth-Token: 24e6a5e2546c41c98865c946f10f7ddb"
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 1285
Date: Wed, 22 Apr 2015 20:14:57 GMT
{"services": [{"status": "enabled", "binary": "nova-scheduler", "zone": "internal", "state": "up", "updated_at": "2015-04-22T20:14:53.000000", "host": "ctrail72", "disabled_reason": null, "id": 1}, {"status": "enabled", "binary": "nova-conductor", "zone": "internal", "state": "up", "updated_at": "2015-04-22T20:14:55.000000", "host": "ctrail72", "disabled_reason": null, "id": 2}, {"status": "enabled", "binary": "nova-console", "zone": "internal", "state": "up", "updated_at": "2015-04-22T20:14:47.000000", "host": "ctrail72", "disabled_reason": null, "id": 3}, {"status": "enabled", "binary": "nova-consoleauth", "zone": "internal", "state": "up", "updated_at": "2015-04-22T20:14:48.000000", "host": "ctrail72", "disabled_reason": null, "id": 4}, {"status": "enabled", "binary": "nova-cert", "zone": "internal", "state": "up", "updated_at": "2015-04-22T20:14:50.000000", "host": "ctrail72", "disabled_reason": null, "id": 5}, {"status": "enabled", "binary": "nova-compute", "zone": "nova", "state": "up", "updated_at": "2015-04-22T20:14:51.000000", "host": "ctrail72", "disabled_reason": null, "id": 6}, {"status": "enabled", "binary": "nova-compute", "zone": "nova", "state": "up", "updated_at": "2015-04-22T20:14:54.000000", "host": "comp70-1", "disabled_reason": null, "id": 7}]}[
---------- Same token works for neutron API ------
# curl -g -i -X GET http://10.0.0.244:9696/v2.0/subnets.json -H "X-Auth- Token: 24e6a5e2546c41c98865c946f10f7ddb"
HTTP/1.1 200 OK
Content-Type: application/json; charset=UTF-8
Content-Length: 898
X-Openstack-Request-Id: req-4f547520-4cb2-4f59-835a-711c933664d1
Date: Wed, 22 Apr 2015 20:16:15 GMT
{"subnets": [{"name": "sub101", "enable_dhcp": true, "network_id": "40945ae1-344c-4ebd-a25b-2776feb0f409", "tenant_id": "959d7f7e020b48509aea18dcec819491", "dns_nameservers": [], "gateway_ip": "10.0.0.1", "ipv6_ra_mode": ...
-------- nova boot failed with 500 error code ------
nova --debug boot --flavor 1 --image dockerc7 --nic net-id=40945ae1-344c-4ebd-a25b-2776feb0f409 d01
.......
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/novaclient/shell.py", line 911, in main
OpenStackComputeShell().main(argv)
File "/usr/lib/python2.7/site-packages/novaclient/shell.py", line 838, in main
args.func(self.cs, args)
File "/usr/lib/python2.7/site-packages/novaclient/v2/shell.py", line 500, in do_boot
server = cs.servers.create(*boot_args, **boot_kwargs)
File "/usr/lib/python2.7/site-packages/novaclient/v2/servers.py", line 929, in create
**boot_kwargs)
File "/usr/lib/python2.7/site-packages/novaclient/v2/servers.py", line 557, in _boot
return_raw=return_raw, **kwargs)
File "/usr/lib/python2.7/site-packages/novaclient/base.py", line 152, in _create
_resp, body = self.api.client.post(url, body=body)
File "/usr/lib/python2.7/site-packages/keystoneclient/adapter.py", line 171, in post
return self.request(url, 'POST', **kwargs)
File "/usr/lib/python2.7/site-packages/novaclient/client.py", line 97, in request
raise exceptions.from_response(resp, body, url, method)
ClientException: The server has either erred or is incapable of performing
the requested operation. (HTTP 500)
ERROR (ClientException): The server has either erred or is incapable of performing the requested operation. (HTTP 500)
Further trace back it found that self._sock.recv in /usr/lib64/python2.7/socket.py returns 500 error.
> /usr/lib64/python2.7/socket.py(481)readline()
-> if not data:
(Pdb) l
476 data = self._sock.recv(self._rbufsize)
477 except error, e:
478 if e.args[0] == EINTR:
479 continue
480 raise
481 -> if not data:
482 break
483 left = size - buf_len
484 # did we just receive a newline?
485 nl = data.find('\n', 0, left)
486 if nl >= 0:
(Pdb) p data
'HTTP/1.1 500 Internal Server Error\r\nContent-Length: 128\r\nContent-Type: application/json; charset=UTF-8\r\nDate: Wed, 22 Apr 2015 18:21:28 GMT\r\nConnection: keep-alive\r\n\r\n{"computeFault": {"message": "The server has either erred or is incapable of performing the requested operation.", "code": 500}}'
Any suggestion and tips are appreciated!

Related

Jira curl issue create ends with error HTTP 415

I am trying to create issue in project via curl, but it ends with 415 error which I don't know why as I am pasting only text there.
curl -D- -s -u email:api_key -X POST --data "{\"fields\":{\"project\":{\"key\": \"PROBLEM\"},\"summary\": \"REST ye merry gentlemen.\",\"description\": \"Creating of an issue using project keys and issue type names using the REST API\",\"issuetype\": {\"name\": \"Outage\"}}}" https://company.atlassian.net/rest/api/2/issue/
Output:
HTTP/2 415
date: Tue, 27 Sep 2022 11:14:10 GMT
content-type: text/html;charset=UTF-8
server: globaledge-envoy
timing-allow-origin: *
x-arequestid: bbc0506d-8e7c-442f-a180-46632081b6a5
set-cookie: atlassian.xsrf.token=BAHL-ME69-JQ45-BS4O_929b97ddce3a4de2b40abbd3d2817ff133d29cee_lin; path=/; SameSite=None; Secure
x-aaccountid: 62b303db84d73c7201680c55
x-envoy-upstream-service-time: 56
expect-ct: report-uri="https://web-security-reports.services.atlassian.com/expect-ct-report/atlassian-proxy", max-age=86400
strict-transport-security: max-age=63072000; preload
x-content-type-options: nosniff
x-xss-protection: 1; mode=block
atl-traceid: b0b3324454c29763
report-to: {"endpoints": [{"url": "https://dz8aopenkvv6s.cloudfront.net"}], "group": "endpoint-1", "include_subdomains": true, "max_age": 600}
nel: {"failure_fraction": 0.001, "include_subdomains": true, "max_age": 600, "report_to": "endpoint-1"}
vary: Accept-Encoding
I don't understand why I am getting 415 message from Jira.
HTTP 415 means Unsupported Media Type (https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/415).
Basically, you have to tell JIRA you are sending a JSON. Just add:
-H 'Content-Type: application/json'
to your curl command.
Also another note you may want to use
rest/api/3/issue/ instead of rest/api/2/issue/
https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issues/#api-rest-api-3-issue-createmeta-get
and if you got some error message like:
Operation value must be an Atlassian Document (see the Atlassian Document Format)
change your "description" field to something like this:
"description": {
"type": "doc",
"version": 1,
"content": [
{
"type": "paragraph",
"content": [
{
"type": "text",
"text": "Creating of an issue using project keys and issue type names using the REST API"
}
]
}
]
}
For example
curl -i -u nanana#gmail.com:xxxxxx -H 'Content-Type: application/json' -XPOST --data '{"fields": {"project": {"key": "RW"}, "summary": "REST ye merry gentlemen.", "description": {"type": "doc", "version": 1, "content": [{"type": "paragraph", "content": [{"type": "text", "text": "Creating of an issue using project keys and issue type names using the REST API"} ] } ] }, "issuetype": {"name": "Task"} } }' https://s50600822.atlassian.net/rest/api/3/issue
{"id":"10013","key":"RW-6","self":"https://s50600822.atlassian.net/rest/api/3/issue/10013"}

No substitution in httpCustom payload

I would like to make a httpCustom payload in OCB but no replace info properly. I think i have tested all the ways i know but no results, someone who could help me. This is my code:
"notification": {
"httpCustom": {
"url": "http://xxxx.xxxx.xxxx:8080/api/v1/telemetry",
"payload": "[{ %22temperature%22: %22${id}%22, %22humidity%22: %22${humidity}%22, %22battery%22: %22${battery}%22 }]"
},
"attrs": [
"temperature","humidity","battery"
]
},
I have no error when i do subscription, but when i test in my end point no replace for the macros ${...}, the payload take object information compose but with no values.
I have test to write/send ${id} as then value of a field in payload and no substitution at all. Test it with URL encode and %22 and no success, I think could be disable substitution ? but i have check it and it has FALSE value.
This is a http response:
{
"method": "POST",
"path": "/",
"query": {},
"headers": {
"x-forwarded-for": "3.124.211.58",
"x-forwarded-proto": "https",
"x-forwarded-port": "443",
"host": "83efe9565d48d8bc8cf298d7786b8042.m.pipedream.net",
"x-amzn-trace-id": "Root=1-5f1bddce-7f2b4277458e77b98c0920d1",
"content-length": "54",
"user-agent": "orion/2.1.0 libcurl/7.29.0",
"fiware-service": "example",
"fiware-servicepath": "/example",
"accept": "application/json",
"content-type": "application/json",
"fiware-correlator": "a7fcfe32-ce47-11ea-9723-0242ac14000a",
"ngsiv2-attrsformat": "custom"
},
"bodyRaw": "[{ \"temperature\": \"\", \"humidity\": \"\", \"battery\": \"\" }]",
"body": [
{
"temperature": "",
"humidity": "",
"battery": ""
}
]
}
Orion VersiĆ³n: 2.1.0 and tested in 2.4.0
Any help ? Thanks in advance !!
I have done the following test, with Orion 2.4.0. Orion database is empty before starting the test.
First, create this subscription:
curl -v localhost:1026/v2/subscriptions -s -S -H 'Content-Type: application/json' -d #- <<EOF
{
"subject": {
"entities": [
{
"id": "Device1",
"type": "Device"
}
]
},
"notification": {
"httpCustom": {
"url": "http://localhost:1027/api/v1/telemetry",
"payload": "[{ %22temperature%22: %22\${id}%22, %22humidity%22: %22\${humidity}%22, %22battery%22: %22\${battery}%22 }]"},
"attrs": [
"temperature","humidity","battery"
]
}
}
EOF
Next, start a listining process at port 1027:
nc -l -p 1027
Next, create entity as follows (which triggers a notification):
curl localhost:1026/v2/entities -s -S -H 'Content-Type: application/json' -d #- <<EOF
{
"id": "Device1",
"type": "Device",
"temperature": {
"value": 23,
"type": "Number"
},
"humidity": {
"value": 99,
"type": "Number"
},
"battery": {
"value": 15,
"type": "Number"
}
}
EOF
What I get in nc is:
POST /api/v1/telemetry HTTP/1.1
Host: localhost:1027
User-Agent: orion/2.4.0 libcurl/7.52.1
Fiware-Servicepath: /
Accept: application/json
Content-Length: 65
Content-Type: text/plain; charset=utf-8
Fiware-Correlator: 4ae608b0-d248-11ea-81de-000c29df7908
Ngsiv2-AttrsFormat: custom
[{ "temperature": "Device1", "humidity": "99", "battery": "15" }]
which is the expected result, with replacements.
Next, restart the listening process and update the entity this way (triggering a new notification):
curl localhost:1026/v2/entities/Device1/attrs?options=forcedUpdate -s -S -H 'Content-Type: application/json' -d #- <<EOF
{
"temperature": {
"value": 32,
"type": "Number"
},
"humidity": {
"value": 79,
"type": "Number"
},
"battery": {
"value": 25,
"type": "Number"
}
}
EOF
and I get now in nc:
POST /api/v1/telemetry HTTP/1.1
Host: localhost:1027
User-Agent: orion/2.4.0 libcurl/7.52.1
Fiware-Servicepath: /
Accept: application/json
Content-Length: 65
Content-Type: text/plain; charset=utf-8
Fiware-Correlator: 66278dd8-d248-11ea-822d-000c29df7908
Ngsiv2-AttrsFormat: custom
[{ "temperature": "Device1", "humidity": "79", "battery": "25" }]
Conclusion: according my tests, Orion is working as expected.
I'd suggest to have a close look to the steps above and try to identify any possible diference comparing with your case. Note the \$ in the subscription creation payload: it is needed to avoid bash vars replacement in curl. Maybe you are facing a similar problem? You can check how your subscription is with GET /v2/subscriptions or checking directly in the database (csubs collection).

jq - setpath - Cannot index object with number

I would like to add new path into existing document
./jq < test.json
{
"correlationId": "6298865a73b477106c98d021",
"leg": 0,
"tag": "sent",
"offset": 322858,
"len": 178,
"prev": {
"page": {
"file": 10352,
"page": 2
},
"record": 911
},
"data": "HTTP/1.1 403 Forbidden\r\nDate: Fri, 16 Feb 2018 08:37:54 GMT\r\nServer: \r\nConnection: close\r\nX-CorrelationID: Id-6298865a73b477106c98d021 0\r\nContent-Type: text/html\r\n\r\nAccess Denied"
}
I am using filter setpath described in jq manual.
But even if I copied the documented string
./jq 'setpath([0,"a"]; 1)' < test.json
still getting error:
jq: error (at <stdin>:1): Cannot index object with number
I do not see there any syntax issue. Did I overlooked something?
Regards and thanks, Reddy
You cannot use integer indices as keys in the JSON object. For JSON objects, the key must be a string, so you could write:
jq 'setpath(["0","a"]; 1)' < test.json
Output:
{
"correlationId": "6298865a73b477106c98d021",
"leg": 0,
"tag": "sent",
"offset": 322858,
"len": 178,
"prev": {
"page": {
"file": 10352,
"page": 2
},
"record": 911
},
"data": "HTTP/1.1 403 Forbidden\r\nDate: Fri, 16 Feb 2018 08:37:54 GMT\r\nServer: \r\nConnection: close\r\nX-CorrelationID: Id-6298865a73b477106c98d021 0\r\nContent-Type: text/html\r\n\r\nAccess Denied",
"0": {
"a": 1
}
}

jq returns null from curl

I'm running the following command inside a docker container:
curl 'https://demo.cachethq.io/API/v1/components?name=Blog' | tac | tac | jq '.'
But I get null output (after the curl progress bar)
Running without the final jq command gives the correct json.
Any help would be appreciated
(The tac is to stop the curl output ending before the jq)
It is trivial error.
Please change the url from:
curl 'https://demo.cachethq.io/API/v1/components?name=Blog' | tac | tac | jq '.'
To:
curl 'https://demo.cachethq.io/api/v1/components?name=Blog' | tac | tac | jq '.'
Output:
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 426 0 426 0 0 176 0 --:--:-- 0:00:02 --:--:-- 176
{
"meta": {
"pagination": {
"total": 1,
"count": 1,
"per_page": 20,
"current_page": 1,
"total_pages": 1,
"links": {
"next_page": null,
"previous_page": null
}
}
},
"data": [
{
"id": 4,
"name": "Blog",
"description": "The Alt Three Blog.",
"link": "https://blog.alt-three.com",
"status": 1,
"order": 0,
"group_id": 2,
"created_at": "2016-11-03 01:30:01",
"updated_at": "2016-11-03 01:30:01",
"deleted_at": null,
"enabled": true,
"status_name": "Operational",
"tags": {
"": ""
}
}
]
}

where can I find a valid JSON link that I can use to test my applications?

I tried this one which I found here -
http://puppygifs.tumblr.com/api/read/json
But if I test its validity, it gives me an error.
I validated it here:
http://jsonlint.com/
Can anyone point me to a functional JSON link that I can use to test my applications?
Here's a 'My IP' type service that returns JSON.
http://whoami.bradallen.net/
Why not try out the free stackexchange api?
burhan#lenux:~$ http "http://api.stackexchange.com/2.1/users/1755023?site=stackoverflow"
HTTP/1.1 200 OK
Access-Control-Allow-Credentials: false
Access-Control-Allow-Methods: GET, POST
Access-Control-Allow-Origin: *
Cache-Control: private
Content-Encoding: gzip
Content-Length: 433
Content-Type: application/json; charset=utf-8
Date: Thu, 25 Jul 2013 16:54:31 GMT
{
"has_more": false,
"items": [
{
"accept_rate": 91,
"account_id": 1950909,
"age": 27,
"badge_counts": {
"bronze": 9,
"gold": 0,
"silver": 0
},
"creation_date": 1350528803,
"display_name": "Rj.",
"is_employee": false,
"last_access_date": 1374770664,
"last_modified_date": 1372353815,
"link": "http://stackoverflow.com/users/1755023/rj",
"location": "West Hollywood, CA",
"profile_image": "https://www.gravatar.com/avatar/f1f3ab1c31c6ee987ba28a78318586fd?d=identicon&r=PG",
"reputation": 423,
"reputation_change_day": 5,
"reputation_change_month": 95,
"reputation_change_quarter": 95,
"reputation_change_week": 5,
"reputation_change_year": 315,
"user_id": 1755023,
"user_type": "registered",
"website_url": ""
}
],
"quota_max": 300,
"quota_remaining": 294
}