)]}'
{"oslo_policy/policy.py":[{"author":{"_account_id":14131,"name":"shaohef","email":"shaohe.feng@intel.com","username":"shaohefeng"},"change_message_id":"e48dd4d25f80a07c0fe4c865088be81f5d0f36b5","unresolved":false,"context_lines":[{"line_number":316,"context_line":"    def _process_call_back(self, path):"},{"line_number":317,"context_line":"        if self.call_back is not None:"},{"line_number":318,"context_line":"            if self.lock is not None:"},{"line_number":319,"context_line":"                if self.lock.acquire():"},{"line_number":320,"context_line":"                    self.call_back(path)"},{"line_number":321,"context_line":"                    self.lock.release()"},{"line_number":322,"context_line":"            else:"}],"source_content_type":"text/x-python","patch_set":1,"id":"7a016987_8a3f19b3","line":319,"updated":"2015-05-25 06:16:34.000000000","message":"for lock, we userally use as follow:\n try:\n     lock.acquire()\n     ...\n finally:\n     lock.release()\n\neven excption, we can still relase the lock.","commit_id":"8161b155e41e8a9edb85161fcdf7ce4fff7280b8"},{"author":{"_account_id":12175,"name":"Eli Qiao","email":"qiaoliyong@gmail.com","username":"Eli"},"change_message_id":"4f6446fe0f7fbde2cf2e824ea52a50a9e426afcd","unresolved":false,"context_lines":[{"line_number":316,"context_line":"    def _process_call_back(self, path):"},{"line_number":317,"context_line":"        if self.call_back is not None:"},{"line_number":318,"context_line":"            if self.lock is not None:"},{"line_number":319,"context_line":"                if self.lock.acquire():"},{"line_number":320,"context_line":"                    self.call_back(path)"},{"line_number":321,"context_line":"                    self.lock.release()"},{"line_number":322,"context_line":"            else:"}],"source_content_type":"text/x-python","patch_set":1,"id":"7a016987_cd42ba68","line":319,"in_reply_to":"7a016987_8a3f19b3","updated":"2015-09-02 01:13:06.000000000","message":"Done","commit_id":"8161b155e41e8a9edb85161fcdf7ce4fff7280b8"},{"author":{"_account_id":14131,"name":"shaohef","email":"shaohe.feng@intel.com","username":"shaohefeng"},"change_message_id":"11381d79af2e322afccf6d4e0cc568f36adb69ef","unresolved":false,"context_lines":[{"line_number":332,"context_line":"                        (self.suffix is not None and"},{"line_number":333,"context_line":"                         event.src_path.endswith(self.suffix))):"},{"line_number":334,"context_line":"                    self.file_list.append(event.src_path)"},{"line_number":335,"context_line":"                    self._process_call_back(event.src_path)"},{"line_number":336,"context_line":""},{"line_number":337,"context_line":"    def on_created(self, event):"},{"line_number":338,"context_line":"        # This will be handled by on_modified"}],"source_content_type":"text/x-python","patch_set":1,"id":"7a016987_bf45796f","line":335,"updated":"2015-05-25 06:13:03.000000000","message":"when  delete a file, do we need to reload the policy rules? \n I have write a scipt for the Event handler:\n\nclass MyFileMonitor(FileSystemEventHandler):\n    def on_created(self, event):\n        super(MyFileMonitor, self).on_created(event)\n        print \"*\" * 80\n        print \"on_created\"\n        print \"is FileModifiedEvent %s\" % isinstance(event, FileModifiedEvent)\n        if not event.is_directory:\n            print \"created name:[%s]\" % event.src_path\n\n    def on_modified(self, event):\n        super(MyFileMonitor, self).on_created(event)\n        print \"*\" * 80\n        print \"on_modified\"\n        print \"is FileModifiedEvent %s\" % isinstance(event, FileModifiedEvent)\n        if not event.is_directory:\n            print \"modified name:[%s]\" % event.src_path\n            abs_path \u003d event.src_path\n            # MyFTPClient().instance().upload_file(abs_path)\n\n\n $ python whatchdog.py \n \n 1:   ~/test_wd/c$ rm c.txt \n********************************************************************************\n on_modified\n is FileModifiedEvent False\n\n 2:   ~/test_wd/c$ echo \"abc\" \u003e  c.txt\n********************************************************************************\n on_created\n is FileModifiedEvent False\n created name:[/home/shhfeng/test_wd/c/c.txt]\n ********************************************************************************\n on_modified\n is FileModifiedEvent False\n ********************************************************************************\n on_modified\n is FileModifiedEvent True\n modified name:[/home/shhfeng/test_wd/c/c.txt]\n\n\n 3:   ~/test_wd/c$ echo \"123\" \u003e\u003e  c.txt\n ********************************************************************************\n on_modified\n is FileModifiedEvent True\n modified name:[/home/shhfeng/test_wd/c/c.txt]","commit_id":"8161b155e41e8a9edb85161fcdf7ce4fff7280b8"},{"author":{"_account_id":12175,"name":"Eli Qiao","email":"qiaoliyong@gmail.com","username":"Eli"},"change_message_id":"4f6446fe0f7fbde2cf2e824ea52a50a9e426afcd","unresolved":false,"context_lines":[{"line_number":332,"context_line":"                        (self.suffix is not None and"},{"line_number":333,"context_line":"                         event.src_path.endswith(self.suffix))):"},{"line_number":334,"context_line":"                    self.file_list.append(event.src_path)"},{"line_number":335,"context_line":"                    self._process_call_back(event.src_path)"},{"line_number":336,"context_line":""},{"line_number":337,"context_line":"    def on_created(self, event):"},{"line_number":338,"context_line":"        # This will be handled by on_modified"}],"source_content_type":"text/x-python","patch_set":1,"id":"7a016987_ad477e76","line":335,"in_reply_to":"7a016987_bf45796f","updated":"2015-09-02 01:13:06.000000000","message":"hmm.. for current impliment, we don\u0027t support delete rule yet.","commit_id":"8161b155e41e8a9edb85161fcdf7ce4fff7280b8"},{"author":{"_account_id":14131,"name":"shaohef","email":"shaohe.feng@intel.com","username":"shaohefeng"},"change_message_id":"84fad528cf6f9a20959ec91d0cff5058f2933910","unresolved":false,"context_lines":[{"line_number":482,"context_line":"            func(os.path.join(path, policy_file), *args)"},{"line_number":483,"context_line":""},{"line_number":484,"context_line":"    def _load_policy_file(self, path, force_reload, overwrite\u003dTrue):"},{"line_number":485,"context_line":"        if lock.acquire():"},{"line_number":486,"context_line":"            with open(path) as fap:"},{"line_number":487,"context_line":"                rules \u003d fap.read()"},{"line_number":488,"context_line":"            if force_reload or not self.rules or not overwrite:"}],"source_content_type":"text/x-python","patch_set":1,"id":"7a016987_4ab3614d","line":485,"updated":"2015-05-25 06:55:49.000000000","message":"dito.\nlock.","commit_id":"8161b155e41e8a9edb85161fcdf7ce4fff7280b8"},{"author":{"_account_id":12175,"name":"Eli Qiao","email":"qiaoliyong@gmail.com","username":"Eli"},"change_message_id":"4f6446fe0f7fbde2cf2e824ea52a50a9e426afcd","unresolved":false,"context_lines":[{"line_number":482,"context_line":"            func(os.path.join(path, policy_file), *args)"},{"line_number":483,"context_line":""},{"line_number":484,"context_line":"    def _load_policy_file(self, path, force_reload, overwrite\u003dTrue):"},{"line_number":485,"context_line":"        if lock.acquire():"},{"line_number":486,"context_line":"            with open(path) as fap:"},{"line_number":487,"context_line":"                rules \u003d fap.read()"},{"line_number":488,"context_line":"            if force_reload or not self.rules or not overwrite:"}],"source_content_type":"text/x-python","patch_set":1,"id":"7a016987_6d5aa652","line":485,"in_reply_to":"7a016987_4ab3614d","updated":"2015-09-02 01:13:06.000000000","message":"Done","commit_id":"8161b155e41e8a9edb85161fcdf7ce4fff7280b8"},{"author":{"_account_id":14131,"name":"shaohef","email":"shaohe.feng@intel.com","username":"shaohefeng"},"change_message_id":"84fad528cf6f9a20959ec91d0cff5058f2933910","unresolved":false,"context_lines":[{"line_number":483,"context_line":""},{"line_number":484,"context_line":"    def _load_policy_file(self, path, force_reload, overwrite\u003dTrue):"},{"line_number":485,"context_line":"        if lock.acquire():"},{"line_number":486,"context_line":"            with open(path) as fap:"},{"line_number":487,"context_line":"                rules \u003d fap.read()"},{"line_number":488,"context_line":"            if force_reload or not self.rules or not overwrite:"},{"line_number":489,"context_line":"                rules \u003d Rules.load_json(rules, self.default_rule)"}],"source_content_type":"text/x-python","patch_set":1,"id":"7a016987_eaa32dfe","line":486,"updated":"2015-05-25 06:55:49.000000000","message":"fap ?  abbreviation for what?　curious on it","commit_id":"8161b155e41e8a9edb85161fcdf7ce4fff7280b8"},{"author":{"_account_id":12175,"name":"Eli Qiao","email":"qiaoliyong@gmail.com","username":"Eli"},"change_message_id":"4f6446fe0f7fbde2cf2e824ea52a50a9e426afcd","unresolved":false,"context_lines":[{"line_number":483,"context_line":""},{"line_number":484,"context_line":"    def _load_policy_file(self, path, force_reload, overwrite\u003dTrue):"},{"line_number":485,"context_line":"        if lock.acquire():"},{"line_number":486,"context_line":"            with open(path) as fap:"},{"line_number":487,"context_line":"                rules \u003d fap.read()"},{"line_number":488,"context_line":"            if force_reload or not self.rules or not overwrite:"},{"line_number":489,"context_line":"                rules \u003d Rules.load_json(rules, self.default_rule)"}],"source_content_type":"text/x-python","patch_set":1,"id":"7a016987_8d5de24a","line":486,"in_reply_to":"7a016987_eaa32dfe","updated":"2015-09-02 01:13:06.000000000","message":"this is copied from fileutils, I don\u0027t know..\nbut will use a better one instead","commit_id":"8161b155e41e8a9edb85161fcdf7ce4fff7280b8"},{"author":{"_account_id":14131,"name":"shaohef","email":"shaohe.feng@intel.com","username":"shaohefeng"},"change_message_id":"84fad528cf6f9a20959ec91d0cff5058f2933910","unresolved":false,"context_lines":[{"line_number":535,"context_line":"                 ``True``.  Note: for rules using the \"case\" expression, this"},{"line_number":536,"context_line":"                 ``True`` value will be the specified string from the"},{"line_number":537,"context_line":"                 expression."},{"line_number":538,"context_line":"        \"\"\""},{"line_number":539,"context_line":""},{"line_number":540,"context_line":"        # Allow the rule to be a Check tree"},{"line_number":541,"context_line":"        if isinstance(rule, _checks.BaseCheck):"}],"source_content_type":"text/x-python","patch_set":1,"id":"7a016987_8a93995a","line":538,"updated":"2015-05-25 06:55:49.000000000","message":"IMHO, \nload_rules is producter.\nand the enforce is consumer. \n\nSo the enforce  is a transaction.\nthe lock should apply for it.","commit_id":"8161b155e41e8a9edb85161fcdf7ce4fff7280b8"},{"author":{"_account_id":12175,"name":"Eli Qiao","email":"qiaoliyong@gmail.com","username":"Eli"},"change_message_id":"4f6446fe0f7fbde2cf2e824ea52a50a9e426afcd","unresolved":false,"context_lines":[{"line_number":535,"context_line":"                 ``True``.  Note: for rules using the \"case\" expression, this"},{"line_number":536,"context_line":"                 ``True`` value will be the specified string from the"},{"line_number":537,"context_line":"                 expression."},{"line_number":538,"context_line":"        \"\"\""},{"line_number":539,"context_line":""},{"line_number":540,"context_line":"        # Allow the rule to be a Check tree"},{"line_number":541,"context_line":"        if isinstance(rule, _checks.BaseCheck):"}],"source_content_type":"text/x-python","patch_set":1,"id":"7a016987_2a2ee5fa","line":538,"in_reply_to":"7a016987_8a93995a","updated":"2015-09-02 01:13:06.000000000","message":"thanks , you are right, this is the right place to add lock.","commit_id":"8161b155e41e8a9edb85161fcdf7ce4fff7280b8"}]}
