<s> import logging <EOL> import os <EOL> import sys <EOL> from django . utils . translation import ugettext_lazy as _t , ugettext as _ <EOL> from desktop . lib . conf import Config , validate_thrift_transport , coerce_bool <EOL> from desktop . lib . exceptions import StructuredThriftTransportException <EOL> LOG = logging . getLogger ( __name__ ) <EOL> HBASE_CLUSTERS = Config ( <EOL> key = "<STR_LIT>" , <EOL> default = "<STR_LIT>" , <EOL> help = _t ( "<STR_LIT>" <EOL> "<STR_LIT>" ) , <EOL> type = str <EOL> ) <EOL> TRUNCATE_LIMIT = Config ( <EOL> key = "<STR_LIT>" , <EOL> default = "<STR_LIT>" , <EOL> help = _t ( "<STR_LIT>" ) , <EOL> type = int <EOL> ) <EOL> THRIFT_TRANSPORT = Config ( <EOL> key = "<STR_LIT>" , <EOL> default = "<STR_LIT>" , <EOL> help = _t ( "<STR_LIT>" + <EOL> "<STR_LIT>" + <EOL> "<STR_LIT>" ) , <EOL> type = str <EOL> ) <EOL> HBASE_CONF_DIR = Config ( <EOL> key = '<STR_LIT>' , <EOL> help = _t ( '<STR_LIT>' ) , <EOL> default = os . environ . get ( "<STR_LIT>" , '<STR_LIT>' ) <EOL> ) <EOL> USE_DOAS = Config ( <EOL> key = '<STR_LIT>' , <EOL> help = _t ( '<STR_LIT>' ) , <EOL> default = False , <EOL> type = coerce_bool <EOL> ) <EOL> def config_validator ( user ) : <EOL> res = [ ] <EOL> from hbase . api import HbaseApi <EOL> from hbase . settings import NICE_NAME <EOL> try : <EOL> if not '<STR_LIT:test>' in sys . argv : <EOL> api = HbaseApi ( user = user ) <EOL> cluster_name = api . getClusters ( ) [ <NUM_LIT:0> ] [ '<STR_LIT:name>' ] <EOL> api . connectCluster ( cluster_name ) <EOL> api . getTableList ( cluster_name ) <EOL> except Exception , e : <EOL> print e <EOL> if '<STR_LIT>' in str ( e ) : <EOL> msg = "<STR_LIT>" <EOL> else : <EOL> msg = '<STR_LIT>' <EOL> LOG . exception ( msg ) <EOL> res . append ( ( NICE_NAME , _ ( msg ) ) ) <EOL> res . extend ( validate_thrift_transport ( THRIFT_TRANSPORT ) ) <EOL> return res </s>
