Change in vdsm[master]: contrib: schema converter
nsoffer at redhat.com
nsoffer at redhat.com
Mon Apr 4 13:12:36 UTC 2016
Nir Soffer has posted comments on this change.
Change subject: contrib: schema converter
......................................................................
Patch Set 27:
(1 comment)
https://gerrit.ovirt.org/#/c/52864/27/lib/api/schemaapi.py
File lib/api/schemaapi.py:
Line 41: for directory in localpath, installedpath:
Line 42: path = os.path.join(directory, schema_name + '.yaml')
Line 43: # we use source tree and deployment directory
Line 44: # so we need to check whether file exists
Line 45: if os.access(path, os.R_OK):
> It is not about hiding an issue. This method is used to choose a location f
You are using R_OK, which will return false if the file cannot be read by the real uid or gid of the process, instead of the existence of the file. Hence you are hiding a deployment issue (see access(2) for the details).
You intent (if I understand it correctly), is to use either the local from from source tree, or the one installed in the system. Lets use code that make this intent clear:
if os.path.exists(path):
return path
If the file exists but the permissions are wrong, it will fail loudly as it should.
Line 46: return path
Line 47:
Line 48: raise SchemaNotFound("Unable to find API schema file in %s or %s",
Line 49: localpath, installedpath)
--
To view, visit https://gerrit.ovirt.org/52864
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I3921cebb7f550f63849f3bc5c80636b6e9495c92
Gerrit-PatchSet: 27
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Piotr Kliczewski <piotr.kliczewski at gmail.com>
Gerrit-Reviewer: Adam Litke <alitke at redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken at redhat.com>
Gerrit-Reviewer: Darshan N <dnarayan at redhat.com>
Gerrit-Reviewer: Edward Haas <edwardh at redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani at redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Martin Polednik <mpolednik at redhat.com>
Gerrit-Reviewer: Martin Sivák <msivak at redhat.com>
Gerrit-Reviewer: Milan Zamazal <mzamazal at redhat.com>
Gerrit-Reviewer: Nir Soffer <nsoffer at redhat.com>
Gerrit-Reviewer: Oved Ourfali <oourfali at redhat.com>
Gerrit-Reviewer: Piotr Kliczewski <piotr.kliczewski at gmail.com>
Gerrit-Reviewer: Sahina Bose <sabose at redhat.com>
Gerrit-Reviewer: Vinzenz Feenstra <vfeenstr at redhat.com>
Gerrit-Reviewer: Yaniv Bronhaim <ybronhei at redhat.com>
Gerrit-Reviewer: gerrit-hooks <automation at ovirt.org>
Gerrit-HasComments: Yes
More information about the vdsm-patches
mailing list