<s> from oslo_config import cfg <EOL> from oslo_log import log as oslo_logging <EOL> from cloudbaseinit import exception <EOL> from cloudbaseinit . utils import classloader <EOL> opts = [ <EOL> cfg . ListOpt ( <EOL> '<STR_LIT>' , <EOL> default = [ <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' , <EOL> ] , <EOL> help = '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' ) <EOL> ] <EOL> CONF = cfg . CONF <EOL> CONF . register_opts ( opts ) <EOL> LOG = oslo_logging . getLogger ( __name__ ) <EOL> def get_metadata_service ( ) : <EOL> cl = classloader . ClassLoader ( ) <EOL> for class_path in CONF . metadata_services : <EOL> service = cl . load_class ( class_path ) ( ) <EOL> try : <EOL> if service . load ( ) : <EOL> return service <EOL> except Exception as ex : <EOL> LOG . error ( "<STR_LIT>" % class_path ) <EOL> LOG . exception ( ex ) <EOL> raise exception . CloudbaseInitException ( "<STR_LIT>" ) </s>
