def get_metastore():
 global _METASTORE_LOC_CACHE
 if (not _METASTORE_LOC_CACHE):
  thrift_uris = get_conf().get(_CNF_METASTORE_URIS)
  is_local = ((thrift_uris is None) or (thrift_uris == ''))
  if (not is_local):
   use_sasl = (str(get_conf().get(_CNF_METASTORE_SASL, 'false')).lower() == 'true')
   thrift_uri = thrift_uris.split(',')[0]
   host = socket.getfqdn()
   match = _THRIFT_URI_RE.match(thrift_uri)
   if (not match):
    LOG.error(('Cannot understand remote metastore uri "%s"' % thrift_uri))
   else:
    (host, port) = match.groups()
   kerberos_principal = security_util.get_kerberos_principal(get_conf().get(_CNF_METASTORE_KERBEROS_PRINCIPAL, None), host)
   _METASTORE_LOC_CACHE = {'use_sasl': use_sasl, 'thrift_uri': thrift_uri, 'kerberos_principal': kerberos_principal}
  else:
   LOG.error('Hue requires a remote metastore configuration')
 return _METASTORE_LOC_CACHE

def get_metastore ( ) : global _METASTORE_LOC_CACHE if ( not _METASTORE_LOC_CACHE ) : thrift_uris = get_conf ( ) . get ( _CNF_METASTORE_URIS ) is_local = ( ( thrift_uris is None ) or ( thrift_uris == '' ) ) if ( not is_local ) : use_sasl = ( str ( get_conf ( ) . get ( _CNF_METASTORE_SASL , 'false' ) ) . lower ( ) == 'true' ) thrift_uri = thrift_uris . split ( ',' ) [ 0 ] host = socket . getfqdn ( ) match = _THRIFT_URI_RE . match ( thrift_uri ) if ( not match ) : LOG . error ( ( 'Cannot understand remote metastore uri "%s"' % thrift_uri ) ) else : ( host , port ) = match . groups ( ) kerberos_principal = security_util . get_kerberos_principal ( get_conf ( ) . get ( _CNF_METASTORE_KERBEROS_PRINCIPAL , None ) , host ) _METASTORE_LOC_CACHE = { 'use_sasl' : use_sasl , 'thrift_uri' : thrift_uri , 'kerberos_principal' : kerberos_principal } else : LOG . error ( 'Hue requires a remote metastore configuration' ) return _METASTORE_LOC_CACHE
get first metastore information from local hive-site .