)]}'
{"vitrage/common/file_utils.py":[{"author":{"_account_id":19122,"name":"Alexey Weyl","email":"aloshaweyl@gmail.com","username":"alexey_weyl"},"change_message_id":"60324ca33060a34e2652db159740a36561a56012","unresolved":false,"context_lines":[{"line_number":25,"context_line":"               with_pathname\u003dFalse,"},{"line_number":26,"context_line":"               with_exception\u003dFalse):"},{"line_number":27,"context_line":"    try:"},{"line_number":28,"context_line":"        file_list \u003d os.listdir(dir_path)"},{"line_number":29,"context_line":"    except Exception as e:"},{"line_number":30,"context_line":"        if with_exception:"},{"line_number":31,"context_line":"            raise"}],"source_content_type":"text/x-python","patch_set":1,"id":"7a77a97e_5cc3b538","line":28,"updated":"2016-11-21 06:51:56.000000000","message":"please add the change that I offered","commit_id":"00af951ddb98d8c011bc219804be1e35ddea515c"},{"author":{"_account_id":19159,"name":"Ifat Afek","email":"ifat.afek@nokia.com","username":"ifat_afek"},"change_message_id":"544d62cb2061c9598fc0fb14d9bee04f9e3737c8","unresolved":false,"context_lines":[{"line_number":30,"context_line":"        if with_exception:"},{"line_number":31,"context_line":"            raise"},{"line_number":32,"context_line":"        else:"},{"line_number":33,"context_line":"            LOG.error(\"Fails to list files in %s: %s\" % (dir_path, e))"},{"line_number":34,"context_line":"            return []"},{"line_number":35,"context_line":"    if suffix:"},{"line_number":36,"context_line":"        file_list \u003d [os.path.join(dir_path, f) if with_pathname else f"}],"source_content_type":"text/x-python","patch_set":1,"id":"7a77a97e_0ade0011","line":33,"range":{"start_line":33,"start_character":67,"end_line":33,"end_character":68},"updated":"2016-11-16 08:32:46.000000000","message":"Please make sure the exception is not printed as a stack trace, so in case it happens over and over again the log won\u0027t become huge","commit_id":"00af951ddb98d8c011bc219804be1e35ddea515c"},{"author":{"_account_id":19122,"name":"Alexey Weyl","email":"aloshaweyl@gmail.com","username":"alexey_weyl"},"change_message_id":"da4a98cf3f01d31f8f65705aa42f91953a97459e","unresolved":false,"context_lines":[{"line_number":33,"context_line":"            LOG.error(\"Fails to list files in %s: %s\" % (dir_path, e))"},{"line_number":34,"context_line":"            return []"},{"line_number":35,"context_line":"    if suffix:"},{"line_number":36,"context_line":"        file_list \u003d [os.path.join(dir_path, f) if with_pathname else f"},{"line_number":37,"context_line":"                     for f in file_list if f.endswith(suffix)]"},{"line_number":38,"context_line":""},{"line_number":39,"context_line":"    return file_list"}],"source_content_type":"text/x-python","patch_set":1,"id":"7a77a97e_3aa17daa","line":36,"updated":"2016-11-15 10:25:54.000000000","message":"nice :)","commit_id":"00af951ddb98d8c011bc219804be1e35ddea515c"}],"vitrage/datasources/static_physical/driver.py":[{"author":{"_account_id":19122,"name":"Alexey Weyl","email":"aloshaweyl@gmail.com","username":"alexey_weyl"},"change_message_id":"da4a98cf3f01d31f8f65705aa42f91953a97459e","unresolved":false,"context_lines":[{"line_number":52,"context_line":"    def _get_all_entities(self):"},{"line_number":53,"context_line":"        static_entities \u003d []"},{"line_number":54,"context_line":""},{"line_number":55,"context_line":"        if os.path.isdir(self.cfg.static_physical.directory):"},{"line_number":56,"context_line":"            files \u003d file_utils.load_files("},{"line_number":57,"context_line":"                self.cfg.static_physical.directory, \u0027.yaml\u0027)"},{"line_number":58,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"7a77a97e_3a041d7d","side":"PARENT","line":55,"updated":"2016-11-15 10:25:54.000000000","message":"I think that we need this if statement, because otherwise every 30 changes_interval or snapshot_interval we will have a message in the log that says that this path doesn\u0027t exist.","commit_id":"0f9d08adcffb935f31d7c7ae806701e1e8f907aa"},{"author":{"_account_id":21414,"name":"Yujun Zhang","email":"zhang.yujunz@zte.com.cn","username":"yujunz"},"change_message_id":"5c3291e07e3ccbbcb238609c3328a894bb5a0074","unresolved":false,"context_lines":[{"line_number":52,"context_line":"    def _get_all_entities(self):"},{"line_number":53,"context_line":"        static_entities \u003d []"},{"line_number":54,"context_line":""},{"line_number":55,"context_line":"        if os.path.isdir(self.cfg.static_physical.directory):"},{"line_number":56,"context_line":"            files \u003d file_utils.load_files("},{"line_number":57,"context_line":"                self.cfg.static_physical.directory, \u0027.yaml\u0027)"},{"line_number":58,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"7a77a97e_3dbc176c","side":"PARENT","line":55,"in_reply_to":"7a77a97e_3a041d7d","updated":"2016-11-15 10:54:21.000000000","message":"I think if the path does not exist should be considered as an error which need to be fixed. Suppressing the message will make it harder to be detected.","commit_id":"0f9d08adcffb935f31d7c7ae806701e1e8f907aa"},{"author":{"_account_id":19122,"name":"Alexey Weyl","email":"aloshaweyl@gmail.com","username":"alexey_weyl"},"change_message_id":"252a4e128cb0211f2f725724f56a61de1495103d","unresolved":false,"context_lines":[{"line_number":52,"context_line":"    def _get_all_entities(self):"},{"line_number":53,"context_line":"        static_entities \u003d []"},{"line_number":54,"context_line":""},{"line_number":55,"context_line":"        if os.path.isdir(self.cfg.static_physical.directory):"},{"line_number":56,"context_line":"            files \u003d file_utils.load_files("},{"line_number":57,"context_line":"                self.cfg.static_physical.directory, \u0027.yaml\u0027)"},{"line_number":58,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"7a77a97e_a00e3a32","side":"PARENT","line":55,"in_reply_to":"7a77a97e_3dbc176c","updated":"2016-11-15 10:57:22.000000000","message":"I agree, but should this message appear like every 30 seconds? it will blow our log very fast.","commit_id":"0f9d08adcffb935f31d7c7ae806701e1e8f907aa"},{"author":{"_account_id":21414,"name":"Yujun Zhang","email":"zhang.yujunz@zte.com.cn","username":"yujunz"},"change_message_id":"64d4b604a2ae8f3e8229b9a995b1125ff2770bdd","unresolved":false,"context_lines":[{"line_number":52,"context_line":"    def _get_all_entities(self):"},{"line_number":53,"context_line":"        static_entities \u003d []"},{"line_number":54,"context_line":""},{"line_number":55,"context_line":"        if os.path.isdir(self.cfg.static_physical.directory):"},{"line_number":56,"context_line":"            files \u003d file_utils.load_files("},{"line_number":57,"context_line":"                self.cfg.static_physical.directory, \u0027.yaml\u0027)"},{"line_number":58,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"7a77a97e_ac0adacf","side":"PARENT","line":55,"in_reply_to":"7a77a97e_87f6df5a","updated":"2016-11-21 02:21:40.000000000","message":"I\u0027m OK with @Alexey\u0027s proposal.\n\nFor future, after https://blueprints.launchpad.net/vitrage/+spec/static-datasource-config-format and https://blueprints.launchpad.net/vitrage/+spec/crud-templates-api is done, the directory may only be used during intialization step and during runtime with CRUD api, no checking on directory any more.\n\nWhat do you think?","commit_id":"0f9d08adcffb935f31d7c7ae806701e1e8f907aa"},{"author":{"_account_id":21414,"name":"Yujun Zhang","email":"zhang.yujunz@zte.com.cn","username":"yujunz"},"change_message_id":"3cdf9ca4aca2034305ec81916ec08433049d8ce0","unresolved":false,"context_lines":[{"line_number":52,"context_line":"    def _get_all_entities(self):"},{"line_number":53,"context_line":"        static_entities \u003d []"},{"line_number":54,"context_line":""},{"line_number":55,"context_line":"        if os.path.isdir(self.cfg.static_physical.directory):"},{"line_number":56,"context_line":"            files \u003d file_utils.load_files("},{"line_number":57,"context_line":"                self.cfg.static_physical.directory, \u0027.yaml\u0027)"},{"line_number":58,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"7a77a97e_98919555","side":"PARENT","line":55,"in_reply_to":"7a77a97e_90ed058e","updated":"2016-11-16 02:29:30.000000000","message":"Ifat, this solution shall disable the error detection during runtime, the case that the folder BECOMES inaccessible for some reason, e.g. deleted by accident or permission modification.\n\nIs that the intention?","commit_id":"0f9d08adcffb935f31d7c7ae806701e1e8f907aa"},{"author":{"_account_id":19122,"name":"Alexey Weyl","email":"aloshaweyl@gmail.com","username":"alexey_weyl"},"change_message_id":"d4f05d87b918c9d0de4c71940da89ede67b45210","unresolved":false,"context_lines":[{"line_number":52,"context_line":"    def _get_all_entities(self):"},{"line_number":53,"context_line":"        static_entities \u003d []"},{"line_number":54,"context_line":""},{"line_number":55,"context_line":"        if os.path.isdir(self.cfg.static_physical.directory):"},{"line_number":56,"context_line":"            files \u003d file_utils.load_files("},{"line_number":57,"context_line":"                self.cfg.static_physical.directory, \u0027.yaml\u0027)"},{"line_number":58,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"7a77a97e_87f6df5a","side":"PARENT","line":55,"in_reply_to":"7a77a97e_98919555","updated":"2016-11-20 14:27:51.000000000","message":"The question is what should we do?\nMaybe we should check in the list_files method if the directory exists, and if not just return an empty list. Because if the user has deleted the directory is up to him.","commit_id":"0f9d08adcffb935f31d7c7ae806701e1e8f907aa"},{"author":{"_account_id":21414,"name":"Yujun Zhang","email":"zhang.yujunz@zte.com.cn","username":"yujunz"},"change_message_id":"dc63df2ecf28a7230ed8752ee4d515d66308b9ff","unresolved":false,"context_lines":[{"line_number":52,"context_line":"    def _get_all_entities(self):"},{"line_number":53,"context_line":"        static_entities \u003d []"},{"line_number":54,"context_line":""},{"line_number":55,"context_line":"        if os.path.isdir(self.cfg.static_physical.directory):"},{"line_number":56,"context_line":"            files \u003d file_utils.load_files("},{"line_number":57,"context_line":"                self.cfg.static_physical.directory, \u0027.yaml\u0027)"},{"line_number":58,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"7a77a97e_a4964792","side":"PARENT","line":55,"in_reply_to":"7a77a97e_a00e3a32","updated":"2016-11-15 13:34:23.000000000","message":"Emm, we need to think of some way to handle repeating errors. I think it is common for all period operations. \n\nTo me, it is more important to expose the error. Suppose the in condition that the configuration folder is deleted BY ACCIDENT.\n\nBut it\u0027s also OK, if we decide to suppress ALL recurring log message before we figure out a better solution.\n\nBTW, I removed it partly because there is no such check in L78 _get_changed_entities","commit_id":"0f9d08adcffb935f31d7c7ae806701e1e8f907aa"},{"author":{"_account_id":19122,"name":"Alexey Weyl","email":"aloshaweyl@gmail.com","username":"alexey_weyl"},"change_message_id":"257d621ccc9ee6df3e5519248c669d27f5055962","unresolved":false,"context_lines":[{"line_number":52,"context_line":"    def _get_all_entities(self):"},{"line_number":53,"context_line":"        static_entities \u003d []"},{"line_number":54,"context_line":""},{"line_number":55,"context_line":"        if os.path.isdir(self.cfg.static_physical.directory):"},{"line_number":56,"context_line":"            files \u003d file_utils.load_files("},{"line_number":57,"context_line":"                self.cfg.static_physical.directory, \u0027.yaml\u0027)"},{"line_number":58,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"7a77a97e_b7f67bd5","side":"PARENT","line":55,"in_reply_to":"7a77a97e_a4964792","updated":"2016-11-15 14:01:08.000000000","message":"I have an idea:\n1. In _get_all_entities do this:\n    def _get_all_entities(self, sync_mode):\n        def _get_all_entities_local(self):\n            static_entities \u003d []\n            files \u003d file_utils.load_files(\n                self.cfg.static_physical.directory, \u0027.yaml\u0027)\n\n            for file_ in files:\n                full_path \u003d self.cfg.static_physical.directory \\\n                            + \u0027/\u0027 + file_\n                static_entities +\u003d self._get_entities_from_file(file_,\n                                                                full_path)\n        \n        if sync_mode \u003d\u003d SyncMode.INIT_SNAPSHOT:\n            return _get_all_entities_local()\n        elif os.path.isdir(self.cfg.static_physical.directory):\n            return _get_all_entities_local()\n\nIn this case we will have the error message in the first get_all and in the others we won\u0027t have it. You need to import the class SyncMode from constants and also pass the sync_mode parameter which you already have in this class.\n\n2. In the _get_changes_entities add this \u0027if os.path.isdir(self.cfg.static_physical.directory):\u0027 right after the definition of entities_updates\n\nPlease check that it works.","commit_id":"0f9d08adcffb935f31d7c7ae806701e1e8f907aa"},{"author":{"_account_id":19122,"name":"Alexey Weyl","email":"aloshaweyl@gmail.com","username":"alexey_weyl"},"change_message_id":"60324ca33060a34e2652db159740a36561a56012","unresolved":false,"context_lines":[{"line_number":52,"context_line":"    def _get_all_entities(self):"},{"line_number":53,"context_line":"        static_entities \u003d []"},{"line_number":54,"context_line":""},{"line_number":55,"context_line":"        if os.path.isdir(self.cfg.static_physical.directory):"},{"line_number":56,"context_line":"            files \u003d file_utils.load_files("},{"line_number":57,"context_line":"                self.cfg.static_physical.directory, \u0027.yaml\u0027)"},{"line_number":58,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"7a77a97e_fcb3a1e7","side":"PARENT","line":55,"in_reply_to":"7a77a97e_ac0adacf","updated":"2016-11-21 06:51:56.000000000","message":"Sounds good to me.\nIt was always on my mind that if someone really wnats to change the static_datasources files then he needs to restart the vitrage service.","commit_id":"0f9d08adcffb935f31d7c7ae806701e1e8f907aa"},{"author":{"_account_id":19159,"name":"Ifat Afek","email":"ifat.afek@nokia.com","username":"ifat_afek"},"change_message_id":"12d9345e9fe5b98b6bf316075fa5a91cca52df89","unresolved":false,"context_lines":[{"line_number":52,"context_line":"    def _get_all_entities(self):"},{"line_number":53,"context_line":"        static_entities \u003d []"},{"line_number":54,"context_line":""},{"line_number":55,"context_line":"        if os.path.isdir(self.cfg.static_physical.directory):"},{"line_number":56,"context_line":"            files \u003d file_utils.load_files("},{"line_number":57,"context_line":"                self.cfg.static_physical.directory, \u0027.yaml\u0027)"},{"line_number":58,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"7a77a97e_90ed058e","side":"PARENT","line":55,"in_reply_to":"7a77a97e_b7f67bd5","updated":"2016-11-15 15:11:00.000000000","message":"Alexey, your solution will probably work, but it\u0027s not clear from the code what was the motivation for writing these if/elif condition. Why not do instead something like:\n        if sync_mode \u003d\u003d SyncMode.INIT_SNAPSHOT and not os.path.isdir(self.cfg.static_physical.directory) :\n            LOG.error(...)\n        else if(os.path.isdir(self.cfg.static_physical.directory):\n            return _get_all_entities","commit_id":"0f9d08adcffb935f31d7c7ae806701e1e8f907aa"}]}
