Esempio n. 1
0
 def sync_meta(self, section, name):
     log.debug('syncing metadata type %s key "%s"', section, name)
     try:
         metadata = client.get_metadata(self.src_conn, section, name)
     except NotFound:
         log.debug('%s "%s" not found on master, deleting from secondary',
                   section, name)
         try:
             client.delete_metadata(self.dest_conn, section, name)
         except NotFound:
             # Since this error is handled appropriately, return success
             return RESULT_SUCCESS
     except Exception as e:
         log.warn('error getting metadata for %s "%s": %s',
                  section,
                  name,
                  e,
                  exc_info=True)
         return RESULT_ERROR
     else:
         try:
             client.update_metadata(self.dest_conn, section, name, metadata)
             return RESULT_SUCCESS
         except Exception as e:
             log.warn('error updating metadata for %s "%s": %s',
                      section,
                      name,
                      e,
                      exc_info=True)
             return RESULT_ERROR
Esempio n. 2
0
 def sync_meta(self, section, name):
     log.debug('syncing metadata type %s key "%s"', section, name)
     try:
         metadata = client.get_metadata(self.source_conn, section, name)
     except client.HttpError as e:
         log.error('error getting metadata for %s "%s": %s',
                   section, name, e)
         raise
     except client.NotFound:
         client.delete_metadata(self.dest_conn, section, name)
     else:
         client.update_metadata(self.dest_conn, section, name, metadata)
Esempio n. 3
0
 def sync_meta(self, section, name):
     log.debug('syncing metadata type %s key %r', section, name)
     try:
         metadata = client.get_metadata(self.source_conn, section, name)
     except client.NotFound:
         log.debug('%s %r not found on master, deleting from secondary',
                   section, name)
         try:
             client.delete_metadata(self.dest_conn, section, name)
         except client.NotFound:
             pass
     except client.HttpError as e:
         log.error('error getting metadata for %s "%s": %s',
                   section, name, e)
         raise
     else:
         client.update_metadata(self.dest_conn, section, name, metadata)
Esempio n. 4
0
 def sync_meta(self, section, name):
     log.debug('syncing metadata type %s key "%s"', section, name)
     try:
         metadata = client.get_metadata(self.src_conn, section, name)
     except NotFound:
         log.debug('%s "%s" not found on master, deleting from secondary', section, name)
         try:
             client.delete_metadata(self.dest_conn, section, name)
         except NotFound:
             # Since this error is handled appropriately, return success
             return RESULT_SUCCESS
     except Exception as e:
         log.warn('error getting metadata for %s "%s": %s', section, name, e, exc_info=True)
         return RESULT_ERROR
     else:
         try:
             client.update_metadata(self.dest_conn, section, name, metadata)
             return RESULT_SUCCESS
         except Exception as e:
             log.warn('error updating metadata for %s "%s": %s', section, name, e, exc_info=True)
             return RESULT_ERROR
Esempio n. 5
0
 def sync_meta(self, section, name):
     log.debug('syncing metadata type %s key %r', section, name)
     try:
         metadata = client.get_metadata(self.source_conn, section, name)
     except client.NotFound:
         log.debug('%s %r not found on master, deleting from secondary',
                   section, name)
         try:
             client.delete_metadata(self.dest_conn, section, name)
         except client.NotFound:
             # Since this error is handled appropriately, return success
             return RESULT_SUCCESS 
     except client.HttpError as e:
         log.error('error getting metadata for %s "%s": %s',
                   section, name, e)
         return RESULT_ERROR             
     else:
         try:
             client.update_metadata(self.dest_conn, section, name, metadata)
             return RESULT_SUCCESS 
         except client.HttpError as e:
             log.error('error getting metadata for %s "%s": %s',
                       section, name, e)
             return RESULT_ERROR