示例#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
示例#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)
示例#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)
示例#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
示例#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             
示例#6
0
 def get_bucket_instance(self, bucket):
     metadata = client.get_metadata(self.src_conn, 'bucket', bucket)
     return bucket + ':' + metadata['data']['bucket']['bucket_id']
示例#7
0
 def test_get_metadata_no_re_encoding(self):
     self.register()
     client.get_metadata(self.connection, 'bucket.instance', 'mybar:r0z0.4140.1')
     server_request = httpretty.last_request()
     assert server_request.path == '/admin/metadata/bucket.instance?key=mybar%3Ar0z0.4140.1'
示例#8
0
 def test_get_metadata(self):
     self.register()
     client.get_metadata(self.connection, 'bucket.instance', 'foo')
     server_request = httpretty.last_request()
     assert server_request.path == '/admin/metadata/bucket.instance?key=foo'
示例#9
0
 def get_bucket_instance(self, bucket):
     metadata = client.get_metadata(self.src_conn, "bucket", bucket)
     return bucket + ":" + metadata["data"]["bucket"]["bucket_id"]
示例#10
0
 def test_get_metadata_no_re_encoding(self):
     self.register()
     client.get_metadata(self.connection, 'bucket.instance', 'mybar:r0z0.4140.1')
     server_request = httpretty.last_request()
     assert server_request.path == '/admin/metadata/bucket.instance?key=mybar%3Ar0z0.4140.1'
示例#11
0
 def test_get_metadata(self):
     self.register()
     client.get_metadata(self.connection, 'bucket.instance', 'foo')
     server_request = httpretty.last_request()
     assert server_request.path == '/admin/metadata/bucket.instance?key=foo'