<s> """<STR_LIT>""" <EOL> import logging <EOL> import os <EOL> from oslo_config import cfg <EOL> from freezer_api . common import _i18n <EOL> from freezer_api . storage import elastic <EOL> CONF = cfg . CONF <EOL> def get_elk_opts ( ) : <EOL> storage_opts = [ <EOL> cfg . StrOpt ( '<STR_LIT>' , <EOL> default = '<STR_LIT>' , <EOL> help = '<STR_LIT>' ) , <EOL> cfg . StrOpt ( '<STR_LIT>' , <EOL> default = '<STR_LIT>' , <EOL> help = '<STR_LIT>' ) , <EOL> cfg . StrOpt ( '<STR_LIT>' , <EOL> default = '<STR_LIT>' , <EOL> help = '<STR_LIT>' ) , <EOL> cfg . StrOpt ( '<STR_LIT:index>' , <EOL> default = '<STR_LIT>' , <EOL> help = '<STR_LIT>' ) , <EOL> cfg . IntOpt ( '<STR_LIT>' , <EOL> default = <NUM_LIT> , <EOL> help = '<STR_LIT>' ) , <EOL> cfg . IntOpt ( '<STR_LIT>' , <EOL> default = <NUM_LIT:20> , <EOL> help = '<STR_LIT>' ) , <EOL> cfg . BoolOpt ( '<STR_LIT>' , <EOL> default = False , <EOL> help = '<STR_LIT>' ) , <EOL> cfg . BoolOpt ( '<STR_LIT>' , <EOL> default = False , <EOL> help = '<STR_LIT>' ) , <EOL> cfg . StrOpt ( '<STR_LIT>' , <EOL> default = None , <EOL> help = '<STR_LIT>' ) , <EOL> cfg . IntOpt ( '<STR_LIT>' , <EOL> default = <NUM_LIT:2> , <EOL> help = '<STR_LIT>' <EOL> '<STR_LIT>' ) <EOL> ] <EOL> return storage_opts <EOL> def register_elk_opts ( ) : <EOL> opt_group = cfg . OptGroup ( name = '<STR_LIT>' , <EOL> title = '<STR_LIT>' ) <EOL> CONF . register_group ( opt_group ) <EOL> CONF . register_opts ( get_elk_opts ( ) , opt_group ) <EOL> def get_options ( ) : <EOL> if CONF . storage . ca_certs : <EOL> if not os . path . isfile ( CONF . storage . ca_certs ) : <EOL> raise Exception ( '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> . format ( CONF . storage . ca_certs ) ) <EOL> hosts = CONF . storage . endpoint or CONF . storage . hosts <EOL> if not hosts : <EOL> raise Exception ( '<STR_LIT>' ) <EOL> opts = dict ( CONF . storage ) <EOL> opts . pop ( '<STR_LIT>' ) <EOL> opts [ '<STR_LIT>' ] = hosts . split ( '<STR_LIT:U+002C>' ) <EOL> return opts <EOL> def get_db ( ) : <EOL> opts = get_options ( ) <EOL> db_engine = opts . pop ( '<STR_LIT>' ) <EOL> if db_engine == '<STR_LIT>' : <EOL> logging . debug ( _i18n . _LI ( '<STR_LIT>' ) % str ( opts ) ) <EOL> db = elastic . ElasticSearchEngine ( ** opts ) <EOL> else : <EOL> raise Exception ( _i18n . _ ( '<STR_LIT>' ) % db_engine ) <EOL> return db </s>
