kimchi-project / kimchi

An HTML5 management interface for KVM guests
https://github.com/kimchi-project/kimchi/releases/latest
Other
3.11k stars 364 forks source link

Unexpected error when unauthorized https path tried under Filepath while creating Template. #959

Closed pvital closed 8 years ago

pvital commented 8 years ago

When provided a URL like "https:xxx.xx" which user don't have authorization to access while trying to create template its throwing an exception error.

Steps to reproduce:

  1. Login to host Wok using browser
  2. Navigate to Virtualization tab and click on Templates tab
  3. On Right side click on + icon to add a new template
  4. Add Template window pops up on the screen
  5. Try to give incorrect path under File Path.
  6. Click on create button
  7. It throws error “ Server encountered an unexpected condition which prevented it from fulfilling the request”

Instead of above error it should through some relevant error message like incorrect path.

pvital commented 8 years ago

Tracelog of exception is:

[14/Jun/2016:00:57:23] HTTP Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/cherrypy/_cprequest.py", line 656, in respond
response.body = self.handler()
File "/usr/lib/python2.7/site-packages/cherrypy/lib/encoding.py", line 188, in __call__
self.body = self.oldhandler(*args, **kwargs)
File "/usr/lib/python2.7/site-packages/cherrypy/_cpdispatch.py", line 34, in __call__
return self.callable(*self.args, **self.kwargs)
File "/usr/lib/python2.7/site-packages/wok/control/base.py", line 448, in index
result = self.create(params, *args)
File "/usr/lib/python2.7/site-packages/wok/control/base.py", line 356, in create
name = create(*args)
File "/usr/lib/python2.7/site-packages/wok/plugins/kimchi/model/templates.py", line 82, in create
return self.save_template(params)
File "/usr/lib/python2.7/site-packages/wok/plugins/kimchi/model/templates.py", line 117, in save_template
t = LibvirtVMTemplate(params, scan=True, conn=self.conn)
File "/usr/lib/python2.7/site-packages/wok/plugins/kimchi/model/templates.py", line 322, in __init__
VMTemplate.__init__(self, args, scan, netboot)
File "/usr/lib/python2.7/site-packages/wok/plugins/kimchi/vmtemplate.py", line 64, in __init__
distro, version = self._get_os_info(args, scan)
File "/usr/lib/python2.7/site-packages/wok/plugins/kimchi/vmtemplate.py", line 139, in _get_os_info
distro, version = self.get_iso_info(iso)
File "/usr/lib/python2.7/site-packages/wok/plugins/kimchi/vmtemplate.py", line 172, in get_iso_info
iso_img = IsoImage(iso)
File "/usr/lib/python2.7/site-packages/wok/plugins/kimchi/isoinfo.py", line 155, in __init__
self._scan()
File "/usr/lib/python2.7/site-packages/wok/plugins/kimchi/isoinfo.py", line 437, in _scan
data = self._get_iso_data(offset, size)
File "/usr/lib/python2.7/site-packages/wok/plugins/kimchi/isoinfo.py", line 425, in _get_iso_data
with contextlib.closing(urllib2.urlopen(request)) as response:
File "/usr/lib64/python2.7/urllib2.py", line 154, in urlopen
return opener.open(url, data, timeout)
File "/usr/lib64/python2.7/urllib2.py", line 431, in open
response = self._open(req, data)
File "/usr/lib64/python2.7/urllib2.py", line 449, in _open
'_open', req)
File "/usr/lib64/python2.7/urllib2.py", line 409, in _call_chain
result = func(*args)
File "/usr/lib64/python2.7/urllib2.py", line 1258, in https_open
context=self._context, check_hostname=self._check_hostname)
File "/usr/lib64/python2.7/urllib2.py", line 1214, in do_open
raise URLError(err)
URLError: <urlopen error [Errno 111] Connection refused>
pvital commented 8 years ago

Patch submitted to ML

pvital commented 8 years ago

Fixed.