<s> import abc <EOL> from oslo_config import cfg <EOL> import six <EOL> from sahara import exceptions as ex <EOL> from sahara . i18n import _ <EOL> ssh_opts = [ <EOL> cfg . IntOpt ( '<STR_LIT>' , default = <NUM_LIT:100> , <EOL> help = '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' ) , <EOL> cfg . IntOpt ( '<STR_LIT>' , default = <NUM_LIT> , <EOL> help = '<STR_LIT>' <EOL> '<STR_LIT>' ) , <EOL> cfg . StrOpt ( '<STR_LIT>' , default = '<STR_LIT>' , <EOL> help = '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' ) , <EOL> ] <EOL> CONF = cfg . CONF <EOL> CONF . register_opts ( ssh_opts ) <EOL> DRIVER = None <EOL> @ six . add_metaclass ( abc . ABCMeta ) <EOL> class RemoteDriver ( object ) : <EOL> @ abc . abstractmethod <EOL> def setup_remote ( self , engine ) : <EOL> """<STR_LIT>""" <EOL> @ abc . abstractmethod <EOL> def get_remote ( self , instance ) : <EOL> """<STR_LIT>""" <EOL> @ abc . abstractmethod <EOL> def get_userdata_template ( self ) : <EOL> """<STR_LIT>""" <EOL> @ abc . abstractmethod <EOL> def get_type_and_version ( self ) : <EOL> """<STR_LIT>""" <EOL> @ six . add_metaclass ( abc . ABCMeta ) <EOL> class Remote ( object ) : <EOL> @ abc . abstractmethod <EOL> def get_neutron_info ( self ) : <EOL> """<STR_LIT>""" <EOL> @ abc . abstractmethod <EOL> def get_http_client ( self , port , info = None ) : <EOL> """<STR_LIT>""" <EOL> @ abc . abstractmethod <EOL> def close_http_session ( self , port ) : <EOL> """<STR_LIT>""" <EOL> @ abc . abstractmethod <EOL> def execute_command ( self , cmd , run_as_root = False , get_stderr = False , <EOL> raise_when_error = True , timeout = <NUM_LIT> ) : <EOL> """<STR_LIT>""" <EOL> @ abc . abstractmethod <EOL> def write_file_to ( self , remote_file , data , run_as_root = False , timeout = <NUM_LIT> ) : <EOL> """<STR_LIT>""" <EOL> @ abc . abstractmethod <EOL> def append_to_file ( self , r_file , data , run_as_root = False , timeout = <NUM_LIT> ) : <EOL> """<STR_LIT>""" <EOL> @ abc . abstractmethod <EOL> def write_files_to ( self , files , run_as_root = False , timeout = <NUM_LIT> ) : <EOL> """<STR_LIT>""" <EOL> @ abc . abstractmethod <EOL> def append_to_files ( self , files , run_as_root = False , timeout = <NUM_LIT> ) : <EOL> """<STR_LIT>""" <EOL> @ abc . abstractmethod <EOL> def read_file_from ( self , remote_file , run_as_root = False , timeout = <NUM_LIT> ) : <EOL> """<STR_LIT>""" <EOL> @ abc . abstractmethod <EOL> def replace_remote_string ( self , remote_file , old_str , new_str , <EOL> timeout = <NUM_LIT> ) : <EOL> """<STR_LIT>""" <EOL> def setup_remote ( driver , engine ) : <EOL> global DRIVER <EOL> DRIVER = driver <EOL> DRIVER . setup_remote ( engine ) <EOL> def get_remote_type_and_version ( ) : <EOL> return DRIVER . get_type_and_version ( ) <EOL> def _check_driver_is_loaded ( ) : <EOL> if not DRIVER : <EOL> raise ex . SystemError ( _ ( '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' ) ) <EOL> def get_remote ( instance ) : <EOL> """<STR_LIT>""" <EOL> _check_driver_is_loaded ( ) <EOL> return DRIVER . get_remote ( instance ) <EOL> def get_userdata_template ( ) : <EOL> """<STR_LIT>""" <EOL> _check_driver_is_loaded ( ) <EOL> return DRIVER . get_userdata_template ( ) </s>
