We should display a more useful error message when the script is unable to fetch the instance. For now, the script throws an exception, and users don't know what to do:
Traceback (most recent call last):
File "/usr/share/cozy/cozy-get-instance-param.py", line 55, in <module>
print get_cozy_param(sys.argv[1])
File "/usr/share/cozy/cozy-get-instance-param.py", line 39, in get_cozy_param
res = urllib2.urlopen(req)
File "/usr/lib/python2.7/urllib2.py", line 154, in urlopen
return opener.open(url, data, timeout)
File "/usr/lib/python2.7/urllib2.py", line 437, in open
response = meth(req, response)
File "/usr/lib/python2.7/urllib2.py", line 550, in http_response
'http', request, response, code, msg, hdrs)
File "/usr/lib/python2.7/urllib2.py", line 475, in error
return self._call_chain(*args)
File "/usr/lib/python2.7/urllib2.py", line 409, in _call_chain
result = func(*args)
File "/usr/lib/python2.7/urllib2.py", line 558, in http_error_default
raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
urllib2.HTTPError: HTTP Error 404: Object Not Found
We should display a more useful error message when the script is unable to fetch the instance. For now, the script throws an exception, and users don't know what to do: