Exemple #1
0
def _parse_core_site():
    """
  Parse core-site.xml and store in _CORE_SITE_DICT
  """
    global _CORE_SITE_DICT
    global _CORE_SITE_PATH

    for indentifier in conf.HDFS_CLUSTERS.get():
        _CORE_SITE_PATH = os.path.join(
            conf.HDFS_CLUSTERS[indentifier].HADOOP_CONF_DIR.get(),
            'core-site.xml')
        try:
            data = file(_CORE_SITE_PATH, 'r').read()
            break
        except IOError, err:
            if err.errno != errno.ENOENT:
                LOG.error('Cannot read from "%s": %s' % (_CORE_SITE_PATH, err))
                return
            # Keep going and make an empty ConfParse
            data = ""

    _CORE_SITE_DICT = confparse.ConfParse(data)


def get_trash_interval():
    """
  Get trash interval

  Also indicates whether trash is enabled or not.
  """
    return get_conf().get(_CNF_TRASH_INTERVAL, None)
Exemple #2
0
  if get_conf().get(_CNF_NN_SENTRY_PREFIXES, ''):
    prefixes |= set(get_conf().get(_CNF_NN_SENTRY_PREFIXES, '').split(','))

  if get_conf().get(_CNF_NN_SENTRY_PATH_PREFIXES, ''):
    prefixes |= set(get_conf().get(_CNF_NN_SENTRY_PATH_PREFIXES, '').split(','))

  return list(prefixes)


def get_supergroup():
  return get_conf().get(_CNF_NN_PERMISSIONS_SUPERGROUP, 'supergroup')


def _parse_hdfs_site():
  global _HDFS_SITE_DICT
  hdfs_site_path = ''

  try:
    hdfs_site_path = os.path.join(conf.HDFS_CLUSTERS['default'].HADOOP_CONF_DIR.get(), 'hdfs-site.xml')
    data = file(hdfs_site_path, 'r').read()
  except KeyError:
    data = ""
  except IOError, err:
    if err.errno != errno.ENOENT:
      LOG.error('Cannot read from "%s": %s' % (hdfs_site_path, err))
      return
    # Keep going and make an empty ConfParse
    data = ""

  _HDFS_SITE_DICT = confparse.ConfParse(data)
Exemple #3
0
    if _SSL_SITE_DICT is None:
        _parse_ssl_client_site()
    return _SSL_SITE_DICT


def _parse_ssl_client_site():
    global _SSL_SITE_DICT
    global _SSL_SITE_PATH

    for indentifier in conf.HDFS_CLUSTERS.get():
        try:
            _SSL_SITE_PATH = os.path.join(
                conf.HDFS_CLUSTERS[indentifier].HADOOP_CONF_DIR.get(),
                'ssl-client.xml')
            data = file(_SSL_SITE_PATH, 'r').read()
            break
        except KeyError:
            data = ""
        except IOError, err:
            if err.errno != errno.ENOENT:
                LOG.error('Cannot read from "%s": %s' % (_SSL_SITE_PATH, err))
                return
            # Keep going and make an empty ConfParse
            data = ""

    _SSL_SITE_DICT = confparse.ConfParse(data)


def get_trustore_location():
    return get_conf().get(_CNF_TRUSTORE_LOCATION)