<s> import os <EOL> import yaml <EOL> from opennode . cli . config import get_config <EOL> def get_oms_server ( ) : <EOL> """<STR_LIT>""" <EOL> minion_conf_file = get_config ( ) . getstring ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> if not os . path . exists ( minion_conf_file ) : <EOL> minion_conf_file = '<STR_LIT>' <EOL> if not os . path . exists ( minion_conf_file ) : <EOL> return ( '<STR_LIT:localhost>' , <NUM_LIT> ) <EOL> with open ( minion_conf_file , '<STR_LIT:r>' ) as minion_conf : <EOL> minion_config = yaml . safe_load ( minion_conf . read ( ) ) <EOL> if minion_config is None : <EOL> return ( '<STR_LIT:localhost>' , <NUM_LIT> ) <EOL> oms_server = minion_config . get ( '<STR_LIT>' , '<STR_LIT:localhost>' ) <EOL> oms_server_port = minion_config . get ( '<STR_LIT>' , <NUM_LIT> ) <EOL> return ( oms_server , oms_server_port ) <EOL> def set_oms_server ( server , port = <NUM_LIT> ) : <EOL> """<STR_LIT>""" <EOL> minion_conf_file = get_config ( ) . getstring ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> if not os . path . exists ( minion_conf_file ) : <EOL> minion_conf_file = '<STR_LIT>' <EOL> if not os . path . exists ( minion_conf_file ) : <EOL> return <EOL> with open ( minion_conf_file , '<STR_LIT:r>' ) as minion_conf : <EOL> minion_config = yaml . safe_load ( minion_conf . read ( ) ) <EOL> if minion_config is None : <EOL> minion_config = { } <EOL> minion_config [ '<STR_LIT>' ] = server <EOL> minion_config [ '<STR_LIT>' ] = port <EOL> minion_config [ '<STR_LIT>' ] = <NUM_LIT:0> <EOL> with open ( minion_conf_file , '<STR_LIT:w>' ) as conf : <EOL> yaml . dump ( minion_config , conf , default_flow_style = False ) <EOL> def register_oms_server ( server , port ) : <EOL> """<STR_LIT>""" <EOL> set_oms_server ( server , port ) <EOL> os . popen ( '<STR_LIT>' ) <EOL> os . popen ( '<STR_LIT>' ) <EOL> def configure_oms_vm ( ctid , ipaddr ) : <EOL> """<STR_LIT>""" <EOL> pass </s>
