)]}'
{"oslo_config/cfg.py":[{"author":{"_account_id":21722,"name":"Dharini Chandrasekar","email":"dharini.chandrasekar@intel.com","username":"dharinic"},"change_message_id":"04c81e54fff95f6d85ca1828ed180addb4cf5328","unresolved":false,"context_lines":[{"line_number":1457,"context_line":"    :param name: the option\u0027s name"},{"line_number":1458,"context_line":"    :param \\*\\*kwargs: arbitrary keyword arguments passed to :class:`Opt`"},{"line_number":1459,"context_line":""},{"line_number":1460,"context_line":"    .. versionadded:: 3.22"},{"line_number":1461,"context_line":"    \"\"\""},{"line_number":1462,"context_line":"    def __init__(self, name, **kwargs):"},{"line_number":1463,"context_line":"        super(FilepathOpt, self).__init__(name,"}],"source_content_type":"text/x-python","patch_set":1,"id":"bff0334d_9dc3b057","line":1460,"range":{"start_line":1460,"start_character":24,"end_line":1460,"end_character":26},"updated":"2017-04-11 00:55:02.000000000","message":"Need to change this.","commit_id":"5cf5d2e9f24a741005c99d46d9669cc208619851"},{"author":{"_account_id":9796,"name":"ChangBo Guo","email":"glongwave@gmail.com","username":"gcb"},"change_message_id":"87c8f400b68ec5ff813a12eca1e1a573f821b52b","unresolved":false,"context_lines":[{"line_number":1457,"context_line":"    :param name: the option\u0027s name"},{"line_number":1458,"context_line":"    :param \\*\\*kwargs: arbitrary keyword arguments passed to :class:`Opt`"},{"line_number":1459,"context_line":""},{"line_number":1460,"context_line":"    .. versionadded:: 3.22"},{"line_number":1461,"context_line":"    \"\"\""},{"line_number":1462,"context_line":"    def __init__(self, name, **kwargs):"},{"line_number":1463,"context_line":"        super(FilepathOpt, self).__init__(name,"}],"source_content_type":"text/x-python","patch_set":1,"id":"bff0334d_b8fa0240","line":1460,"range":{"start_line":1460,"start_character":24,"end_line":1460,"end_character":26},"in_reply_to":"bff0334d_9dc3b057","updated":"2017-04-11 02:09:00.000000000","message":"We plan to release 4.0 today, so please change to 4.1","commit_id":"5cf5d2e9f24a741005c99d46d9669cc208619851"}],"oslo_config/types.py":[{"author":{"_account_id":2472,"name":"Doug Hellmann","email":"dhellmann@redhat.com","username":"doug-hellmann"},"change_message_id":"984b8912bbfc5aa3842ee3ebd21f65dd13051630","unresolved":false,"context_lines":[{"line_number":886,"context_line":"            try:"},{"line_number":887,"context_line":"                _tmpfile \u003d tempfile.TemporaryFile(dir\u003dvalue)"},{"line_number":888,"context_line":"            except OSError as err:"},{"line_number":889,"context_line":"                msg \u003d ((\"Unable to use the directory set with %s. Error: %s\") %"},{"line_number":890,"context_line":"                       value, err)"},{"line_number":891,"context_line":"                raise ValueError(msg)"},{"line_number":892,"context_line":"            else:"}],"source_content_type":"text/x-python","patch_set":2,"id":"bff0334d_abddc7dd","line":889,"updated":"2017-04-12 18:03:25.000000000","message":"What if I only want to read files in the directory and don\u0027t need to create new ones?","commit_id":"482551f93ff7cb928f948a1cf3026d2c25762588"},{"author":{"_account_id":9796,"name":"ChangBo Guo","email":"glongwave@gmail.com","username":"gcb"},"change_message_id":"a58424b8566f9bcf7b7fcd6c24e4c28d331610e2","unresolved":false,"context_lines":[{"line_number":883,"context_line":"        if os.path.isfile(value):"},{"line_number":884,"context_line":"            return value"},{"line_number":885,"context_line":"        elif os.path.isdir(value):"},{"line_number":886,"context_line":"            try:"},{"line_number":887,"context_line":"                _tmpfile \u003d tempfile.TemporaryFile(dir\u003dvalue)"},{"line_number":888,"context_line":"            except OSError as err:"},{"line_number":889,"context_line":"                msg \u003d ((\"Unable to use the directory set with %s. Error: %s\") %"},{"line_number":890,"context_line":"                       value, err)"},{"line_number":891,"context_line":"                raise ValueError(msg)"},{"line_number":892,"context_line":"            else:"},{"line_number":893,"context_line":"                _tmpfile.close()"},{"line_number":894,"context_line":"                return value"},{"line_number":895,"context_line":"        else:"},{"line_number":896,"context_line":"            raise ValueError(\"Invalid file path or directory\")"},{"line_number":897,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"bff0334d_8ff46ff2","line":894,"range":{"start_line":886,"start_character":0,"end_line":894,"end_character":28},"updated":"2017-04-12 02:06:21.000000000","message":"Why we need create temporary file here ? oslo.config should only check if it is file or directory, the directory may be used other user to access, The logic here should be handled by application, not oslo.config.\n\nBTW, we leave temporary file here, should delete it.","commit_id":"482551f93ff7cb928f948a1cf3026d2c25762588"},{"author":{"_account_id":2472,"name":"Doug Hellmann","email":"dhellmann@redhat.com","username":"doug-hellmann"},"change_message_id":"984b8912bbfc5aa3842ee3ebd21f65dd13051630","unresolved":false,"context_lines":[{"line_number":883,"context_line":"        if os.path.isfile(value):"},{"line_number":884,"context_line":"            return value"},{"line_number":885,"context_line":"        elif os.path.isdir(value):"},{"line_number":886,"context_line":"            try:"},{"line_number":887,"context_line":"                _tmpfile \u003d tempfile.TemporaryFile(dir\u003dvalue)"},{"line_number":888,"context_line":"            except OSError as err:"},{"line_number":889,"context_line":"                msg \u003d ((\"Unable to use the directory set with %s. Error: %s\") %"},{"line_number":890,"context_line":"                       value, err)"},{"line_number":891,"context_line":"                raise ValueError(msg)"},{"line_number":892,"context_line":"            else:"},{"line_number":893,"context_line":"                _tmpfile.close()"},{"line_number":894,"context_line":"                return value"},{"line_number":895,"context_line":"        else:"},{"line_number":896,"context_line":"            raise ValueError(\"Invalid file path or directory\")"},{"line_number":897,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"bff0334d_8b64434b","line":894,"range":{"start_line":886,"start_character":0,"end_line":894,"end_character":28},"in_reply_to":"bff0334d_8a1c4178","updated":"2017-04-12 18:03:25.000000000","message":"I don\u0027t think we want the option type class to do that work, because the check could happen much earlier than the code that uses the option would run, and there\u0027s a chance the state of the filesystem could change to make the earlier test invalid (permissions can be changed or a directory can be deleted, for example). The result is we need to have two sets of code doing the same test, and handling the error cases. I would prefer to do that in the application code, since at that point a decision about how to proceed can be made (maybe an invalid value results in some fallback behavior, for example).\n\nWe should definitely *not* be creating temporary files as part of validating directories.","commit_id":"482551f93ff7cb928f948a1cf3026d2c25762588"},{"author":{"_account_id":21722,"name":"Dharini Chandrasekar","email":"dharini.chandrasekar@intel.com","username":"dharinic"},"change_message_id":"9c761ac4fd5b2407407705e3b37c168a022a5533","unresolved":false,"context_lines":[{"line_number":883,"context_line":"        if os.path.isfile(value):"},{"line_number":884,"context_line":"            return value"},{"line_number":885,"context_line":"        elif os.path.isdir(value):"},{"line_number":886,"context_line":"            try:"},{"line_number":887,"context_line":"                _tmpfile \u003d tempfile.TemporaryFile(dir\u003dvalue)"},{"line_number":888,"context_line":"            except OSError as err:"},{"line_number":889,"context_line":"                msg \u003d ((\"Unable to use the directory set with %s. Error: %s\") %"},{"line_number":890,"context_line":"                       value, err)"},{"line_number":891,"context_line":"                raise ValueError(msg)"},{"line_number":892,"context_line":"            else:"},{"line_number":893,"context_line":"                _tmpfile.close()"},{"line_number":894,"context_line":"                return value"},{"line_number":895,"context_line":"        else:"},{"line_number":896,"context_line":"            raise ValueError(\"Invalid file path or directory\")"},{"line_number":897,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"bff0334d_8a1c4178","line":894,"range":{"start_line":886,"start_character":0,"end_line":894,"end_character":28},"in_reply_to":"bff0334d_8ff46ff2","updated":"2017-04-12 16:33:01.000000000","message":"Hi gcb,\nI thought it might be required to ensure that the directoru is usable (enough space, write-able, etc.) Hence creating a temporary file.\n\nAs per [1], tempfile.TemporaryFile deletes the file once we close it. Hence I have _tmpfile.close() in L893.\n\n[1] https://docs.python.org/3/library/tempfile.html#tempfile.TemporaryFile","commit_id":"482551f93ff7cb928f948a1cf3026d2c25762588"},{"author":{"_account_id":2472,"name":"Doug Hellmann","email":"dhellmann@redhat.com","username":"doug-hellmann"},"change_message_id":"984b8912bbfc5aa3842ee3ebd21f65dd13051630","unresolved":false,"context_lines":[{"line_number":892,"context_line":"            else:"},{"line_number":893,"context_line":"                _tmpfile.close()"},{"line_number":894,"context_line":"                return value"},{"line_number":895,"context_line":"        else:"},{"line_number":896,"context_line":"            raise ValueError(\"Invalid file path or directory\")"},{"line_number":897,"context_line":""},{"line_number":898,"context_line":"    def __repr__(self):"}],"source_content_type":"text/x-python","patch_set":2,"id":"bff0334d_4bcf5b28","line":895,"updated":"2017-04-12 18:03:25.000000000","message":"What if the value points to a symlink? Do isfile() and isdir() dereference the link before checking the type of the reference?","commit_id":"482551f93ff7cb928f948a1cf3026d2c25762588"}]}
