Project

General

Profile

Bug #33387

Allow REST to run Jobs returning its `id`

Added by Eric Turgeon about 1 year ago. Updated about 1 year ago.

Status:
Done
Priority:
No priority
Assignee:
William Grzybowski
Category:
Middleware
Target version:
Severity:
Medium
Reason for Closing:
Reason for Blocked:
Needs QA:
No
Needs Doc:
No
Needs Merging:
No
Needs Automation:
No
Support Suite Ticket:
n/a
Hardware Configuration:
ChangeLog Required:
No

Description

Every time I try to delete a bootenv it output 500 and DELETE it should output 200.

Here is my IPython output

In [25]: POST('/bootenv', {'name': 'eric_env', 'source': 'default'}).text
Out[25]: '"eric_env"'

In [26]: GET('/bootenv?name=eric_env').json()
Out[26]: 
[{'active': '-',
  'created': {'$date': 1525955460000},
  'id': 'eric_env',
  'keep': None,
  'mountpoint': '-',
  'name': 'eric_env',
  'rawspace': '1024',
  'realname': 'eric_env',
  'space': '1.0K'}]

In [27]: DELETE("/bootenv/id/eric_env").text
Out[27]: '<h1>500 Internal Server Error</h1><br><h2>Traceback:</h2>\n&lt;pre&gt;Traceback (most recent call last):\n  File &amp;quot;/usr/local/lib/python3.6/site-packages/aiohttp/web_protocol.py&amp;quot;, line 381, in start\n    resp = await self._request_handler(request)\n  File &amp;quot;/usr/local/lib/python3.6/asyncio/coroutines.py&amp;quot;, line 110, in __next__\n    return self.gen.send(None)\n  File &amp;quot;/usr/local/lib/python3.6/site-packages/aiohttp/web_app.py&amp;quot;, line 322, in _handle\n    resp = await handler(request)\n  File &amp;quot;/usr/local/lib/python3.6/asyncio/coroutines.py&amp;quot;, line 110, in __next__\n    return self.gen.send(None)\n  File &amp;quot;/usr/local/lib/python3.6/site-packages/middlewared/restful.py&amp;quot;, line 359, in on_method\n    return await do(method, req, resp, *args, **kwargs)\n  File &amp;quot;/usr/local/lib/python3.6/asyncio/coroutines.py&amp;quot;, line 110, in __next__\n    return self.gen.send(None)\n  File &amp;quot;/usr/local/lib/python3.6/site-packages/middlewared/restful.py&amp;quot;, line 489, in do\n    resp.text = json.dumps(result, indent=True)\n  File &amp;quot;/usr/local/lib/python3.6/site-packages/middlewared/client/ejson.py&amp;quot;, line 38, in dumps\n    return json.dumps(obj, cls=JSONEncoder, **kwargs)\n  File &amp;quot;/usr/local/lib/python3.6/json/__init__.py&amp;quot;, line 238, in dumps\n    **kw).encode(obj)\n  File &amp;quot;/usr/local/lib/python3.6/json/encoder.py&amp;quot;, line 201, in encode\n    chunks = list(chunks)\n  File &amp;quot;/usr/local/lib/python3.6/json/encoder.py&amp;quot;, line 437, in _iterencode\n    o = _default(o)\n  File &amp;quot;/usr/local/lib/python3.6/site-packages/middlewared/client/ejson.py&amp;quot;, line 18, in default\n    return super(JSONEncoder, self).default(obj)\n  File &amp;quot;/usr/local/lib/python3.6/json/encoder.py&amp;quot;, line 180, in default\n    o.__class__.__name__)\nTypeError: Object of type &amp;#x27;Job&amp;#x27; is not JSON serializable\n&lt;/pre&gt;'

In [28]: GET('/bootenv?name=eric_env').json()
Out[28]: []

In [29]: 

Associated revisions

Revision 165385f8 (diff)
Added by William Grzybowski about 1 year ago

fix(middlewared/rest): allow REST to run Jobs returning its `id`

Ticket: #33387

Revision b3867720 (diff)
Added by William Grzybowski about 1 year ago

fix(middlewared/rest): allow REST to run Jobs returning its `id`

Ticket: #33387

History

#1 Updated by Dru Lavigne about 1 year ago

  • Assignee changed from Release Council to William Grzybowski

#2 Updated by William Grzybowski about 1 year ago

  • Status changed from Unscreened to Not Started
  • Target version changed from Backlog to 11.2-BETA1
  • Severity changed from New to Medium

#3 Updated by William Grzybowski about 1 year ago

  • Status changed from Not Started to In Progress
  • Needs QA changed from Yes to No
  • Needs Doc changed from Yes to No
  • Needs Merging changed from Yes to No

#4 Updated by William Grzybowski about 1 year ago

  • Status changed from In Progress to Done

#5 Updated by Dru Lavigne about 1 year ago

  • Subject changed from API 2.0 DELETE /bootenv/id/{id} return 500 even if it got deleted. to Allow REST to run Jobs returning its `id`

Also available in: Atom PDF