Beispiel #1
0
 def _update_attr_when_hash_equal(self, item_local_path, item):
     t = datetime_to_timestamp(item.modified_time)
     try:
         self.logger.info('Updating timestamp for file "%s" to "%s".',
                          item_local_path, str(item.modified_time))
         os.utime(item_local_path, (t, t))
         self.items_store.update_item(item, ItemRecordStatuses.OK)
     except (IOError, OSError) as e:
         self.logger.error(
             'IO error when updating timestamp for file "%s": %s',
             item_local_path, e)
         if not self.task_pool.has_pending_task(item_local_path):
             self.logger.info(
                 'Update server timestamp for file "%s" instead.',
                 item_local_path)
             self.task_pool.add_task(
                 UpdateMetadataTask(self,
                                    rel_parent_path=self.rel_path + '/',
                                    item_name=item.name,
                                    new_mtime=t))
Beispiel #2
0
 def setUp(self):
     self.initialize_obj()
     self.new_mtime = 123412341234
     self.task = UpdateMetadataTask(self.parent_task, '/', 'foo.txt',
                                    self.new_mtime)