<s> import socket <EOL> from oslo . config import cfg <EOL> from rack import utils <EOL> CONF = cfg . CONF <EOL> def _get_my_ip ( ) : <EOL> """<STR_LIT>""" <EOL> try : <EOL> csock = socket . socket ( socket . AF_INET , socket . SOCK_DGRAM ) <EOL> csock . connect ( ( '<STR_LIT>' , <NUM_LIT> ) ) <EOL> ( addr , port ) = csock . getsockname ( ) <EOL> csock . close ( ) <EOL> return addr <EOL> except socket . error : <EOL> return utils . get_my_ipv4_address ( ) <EOL> netconf_opts = [ <EOL> cfg . StrOpt ( '<STR_LIT>' , <EOL> default = _get_my_ip ( ) , <EOL> help = '<STR_LIT>' ) , <EOL> cfg . StrOpt ( '<STR_LIT:host>' , <EOL> default = socket . gethostname ( ) , <EOL> help = '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' ) , <EOL> cfg . BoolOpt ( '<STR_LIT>' , <EOL> default = False , <EOL> help = '<STR_LIT>' ) , <EOL> ] <EOL> CONF . register_opts ( netconf_opts ) </s>
