Project

General

Profile

Bug #34005

Add default values to keys that need it in sharing/cifs API

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

Status:
Done
Priority:
No priority
Assignee:
Brandon Schneider
Category:
Middleware
Target version:
Severity:
New
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

Look like validation failed.

File "/usr/local/lib/python3.6/site-packages/middlewared/plugins/smb.py", line 241, in validate data['home'], schema_name, verrors, old)

def test_06_Creating_a_cifs_share_on_SMB_PATH():
        payload = {"comment": "My Test SMB Share",
                   "path": SMB_PATH,
                   "name": SMB_NAME,
                   "guestok": True,
                   "vfsobjects": ["streams_xattr"]}
        results = POST("/sharing/cifs", payload)
>       assert results.status_code == 201, results.text
E       AssertionError: <h1>500 Internal Server Error</h1><br><h2>Traceback:</h2>
E         &lt;pre&gt;Traceback (most recent call last):
E           File &amp;quot;/usr/local/lib/python3.6/site-packages/aiohttp/web_protocol.py&amp;quot;, line 381, in start
E             resp = await self._request_handler(request)
E           File &amp;quot;/usr/local/lib/python3.6/asyncio/coroutines.py&amp;quot;, line 110, in __next__
E             return self.gen.send(None)
E           File &amp;quot;/usr/local/lib/python3.6/site-packages/aiohttp/web_app.py&amp;quot;, line 322, in _handle
E             resp = await handler(request)
E           File &amp;quot;/usr/local/lib/python3.6/asyncio/coroutines.py&amp;quot;, line 110, in __next__
E             return self.gen.send(None)
E           File &amp;quot;/usr/local/lib/python3.6/site-packages/aiohttp/web_middlewares.py&amp;quot;, line 88, in impl
E             return await handler(request)
E           File &amp;quot;/usr/local/lib/python3.6/asyncio/coroutines.py&amp;quot;, line 110, in __next__
E             return self.gen.send(None)
E           File &amp;quot;/usr/local/lib/python3.6/site-packages/aiohttp/web_middlewares.py&amp;quot;, line 78, in impl
E             return await handler(request)
E           File &amp;quot;/usr/local/lib/python3.6/asyncio/coroutines.py&amp;quot;, line 110, in __next__
E             return self.gen.send(None)
E           File &amp;quot;/usr/local/lib/python3.6/site-packages/middlewared/restful.py&amp;quot;, line 362, in on_method
E             return await do(method, req, resp, *args, **kwargs)
E           File &amp;quot;/usr/local/lib/python3.6/asyncio/coroutines.py&amp;quot;, line 110, in __next__
E             return self.gen.send(None)
E           File &amp;quot;/usr/local/lib/python3.6/site-packages/middlewared/restful.py&amp;quot;, line 488, in do
E             result = await self.middleware.call(methodname, *method_args)
E           File &amp;quot;/usr/local/lib/python3.6/asyncio/coroutines.py&amp;quot;, line 110, in __next__
E             return self.gen.send(None)
E           File &amp;quot;/usr/local/lib/python3.6/site-packages/middlewared/main.py&amp;quot;, line 1018, in call
E             return await self._call(name, serviceobj, methodobj, params, pipes=pipes)
E           File &amp;quot;/usr/local/lib/python3.6/asyncio/coroutines.py&amp;quot;, line 110, in __next__
E             return self.gen.send(None)
E           File &amp;quot;/usr/local/lib/python3.6/site-packages/middlewared/main.py&amp;quot;, line 953, in _call
E             return await methodobj(*args)
E           File &amp;quot;/usr/local/lib/python3.6/asyncio/coroutines.py&amp;quot;, line 110, in __next__
E             return self.gen.send(None)
E           File &amp;quot;/usr/local/lib/python3.6/site-packages/middlewared/service.py&amp;quot;, line 269, in create
E             f&amp;#x27;{self._config.namespace}.create&amp;#x27;, self, self.do_create, [data]
E           File &amp;quot;/usr/local/lib/python3.6/asyncio/coroutines.py&amp;quot;, line 110, in __next__
E             return self.gen.send(None)
E           File &amp;quot;/usr/local/lib/python3.6/site-packages/middlewared/main.py&amp;quot;, line 953, in _call
E             return await methodobj(*args)
E           File &amp;quot;/usr/local/lib/python3.6/asyncio/coroutines.py&amp;quot;, line 110, in __next__
E             return self.gen.send(None)
E           File &amp;quot;/usr/local/lib/python3.6/site-packages/middlewared/schema.py&amp;quot;, line 646, in nf
E             return await f(*args, **kwargs)
E           File &amp;quot;/usr/local/lib/python3.6/asyncio/coroutines.py&amp;quot;, line 110, in __next__
E             return self.gen.send(None)
E           File &amp;quot;/usr/local/lib/python3.6/site-packages/middlewared/plugins/smb.py&amp;quot;, line 154, in do_create
E             await self.validate(data, &amp;#x27;sharingcifs_create&amp;#x27;, verrors)
E           File &amp;quot;/usr/local/lib/python3.6/asyncio/coroutines.py&amp;quot;, line 110, in __next__
E             return self.gen.send(None)
E           File &amp;quot;/usr/local/lib/python3.6/site-packages/middlewared/plugins/smb.py&amp;quot;, line 241, in validate
E             data[&amp;#x27;home&amp;#x27;], schema_name, verrors, old)
E         KeyError: &amp;#x27;home&amp;#x27;
E         &lt;/pre&gt;
E       assert 500 == 201
E        +  where 500 = &lt;Response [500]&gt;.status_code

Associated revisions

Revision 992d7e4f (diff)
Added by Brandon Schneider about 1 year ago

fix(sharing/cifs): Add defaults to keys that need it.

Ticket: #34005

Revision a5c8af91 (diff)
Added by Brandon Schneider about 1 year ago

fix(sharing/cifs): Add defaults to keys that need it. (#1290)

  • fix(sharing/cifs): Add defaults to keys that need it.

Ticket: #34005

  • Address William's review

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

  • Assignee changed from William Grzybowski to Brandon Schneider
  • Target version changed from Backlog to 11.2-BETA1
  • Seen in changed from Master - FreeBSD-HEAD to Master - FreeNAS Nightlies

#3 Updated by Brandon Schneider about 1 year ago

  • Status changed from Unscreened to In Progress

#4 Updated by Brandon Schneider about 1 year ago

  • Status changed from In Progress to Ready for Testing

#5 Updated by Brandon Schneider about 1 year ago

  • Needs Merging changed from Yes to No

#6 Updated by Dru Lavigne about 1 year ago

  • Subject changed from Rest API 2 POST /sharing/cifs faild with 500 to Add default values to keys that need it in sharing/cifs API
  • Needs Doc changed from Yes to No

#7 Updated by Eric Turgeon about 1 year ago

  • Needs QA changed from Yes to No

Just finish to test and it is working now.

#8 Updated by Dru Lavigne about 1 year ago

  • Status changed from Ready for Testing to Done

Also available in: Atom PDF