Ejemplo n.º 1
0
 def get_endidx ( self ):
     if util.isPlatformWindows ():
         import pyreadline
         return Readline ().get_endidx ()
     else:
         import readline
         return readline.get_endidx ()
Ejemplo n.º 2
0
 def get_endidx(self):
     if util.isPlatformWindows():
         import pyreadline
         return Readline().get_endidx()
     else:
         import readline
         return readline.get_endidx()
Ejemplo n.º 3
0
 def parse_and_bind ( self, complete_key ):
     if util.isPlatformWindows ():
         import pyreadline
         Readline ().parse_and_bind ( complete_key )
     else:
         import readline
         readline.parse_and_bind ( complete_key )
Ejemplo n.º 4
0
    def get_line_buffer ( self ):
        if util.isPlatformWindows ():
            import pyreadline
            return Readline ().get_line_buffer ()
        else:
            import readline
	    return readline.get_line_buffer()
Ejemplo n.º 5
0
 def set_completion_display_matches_hook ( self, function ):
     if util.isPlatformWindows ():
         import pyreadline
         Readline ().set_completion_display_matches_hook ( function )
     else:
         import readline
         readline.set_completion_display_matches_hook ( function )
Ejemplo n.º 6
0
 def redisplay ( self ):
     if util.isPlatformWindows ():
         import pyreadline
         Readline ().redisplay ()
     else:
         import readline
         readline.redisplay ()
Ejemplo n.º 7
0
 def insert_text(self, line):
     if util.isPlatformWindows():
         import pyreadline
         Readline().insert_text(line)
     else:
         import readline
         readline.insert_text(line)
Ejemplo n.º 8
0
 def set_completer ( self, comp_func ):
     if util.isPlatformWindows ():
         import pyreadline
         Readline ().set_completer ( comp_func )
     else:
         import readline
         readline.set_completer ( comp_func )
Ejemplo n.º 9
0
 def insert_text ( self, line ):
     if util.isPlatformWindows ():
         import pyreadline
         Readline ().insert_text ( line )
     else:
         import readline
         readline.insert_text ( line )
Ejemplo n.º 10
0
 def parse_and_bind(self, complete_key):
     if util.isPlatformWindows():
         import pyreadline
         Readline().parse_and_bind(complete_key)
     else:
         import readline
         readline.parse_and_bind(complete_key)
Ejemplo n.º 11
0
 def redisplay(self):
     if util.isPlatformWindows():
         import pyreadline
         Readline().redisplay()
     else:
         import readline
         readline.redisplay()
Ejemplo n.º 12
0
 def set_completion_display_matches_hook(self, function):
     if util.isPlatformWindows():
         import pyreadline
         Readline().set_completion_display_matches_hook(function)
     else:
         import readline
         readline.set_completion_display_matches_hook(function)
Ejemplo n.º 13
0
 def set_completer(self, comp_func):
     if util.isPlatformWindows():
         import pyreadline
         Readline().set_completer(comp_func)
     else:
         import readline
         readline.set_completer(comp_func)
Ejemplo n.º 14
0
 def get_completer(self):
     if util.isPlatformWindows():
         import pyreadline
         return Readline().get_completer()
     else:
         import readline
         return readline.get_completer
Ejemplo n.º 15
0
 def getTemplate(self):
     ''' 
     Finds template based on o/s on which OpenClos is running
     and 1stage/2stage ZTP process
     returns: jinja2 template 
     '''
     if util.isPlatformUbuntu():
         if util.isZtpStaged(self.__conf):
             return self.templateEnv.get_template('ubuntu.2stage.dhcp.conf')
         else:
             return self.templateEnv.get_template('ubuntu.1stage.dhcp.conf')
     elif util.isPlatformCentos():
         if util.isZtpStaged(self.__conf):
             return self.templateEnv.get_template('centos.2stage.dhcp.conf')
         else:
             return self.templateEnv.get_template('centos.1stage.dhcp.conf')
     elif util.isPlatformWindows():
         ''' 
         this code is for testing only, generated dhcpd.conf would not work on windows  
         '''
         if util.isZtpStaged(self.__conf):
             return self.templateEnv.get_template('ubuntu.2stage.dhcp.conf')
         else:
             return self.templateEnv.get_template('ubuntu.1stage.dhcp.conf')
Ejemplo n.º 16
0
 def getTemplate(self):
     ''' 
     Finds template based on o/s on which OpenClos is running
     and 1stage/2stage ZTP process
     returns: jinja2 template 
     '''
     if util.isPlatformUbuntu():
         if util.isZtpStaged(self.__conf):
             return self.templateEnv.get_template('ubuntu.2stage.dhcp.conf')
         else:
             return self.templateEnv.get_template('ubuntu.1stage.dhcp.conf')
     elif util.isPlatformCentos():
         if util.isZtpStaged(self.__conf):
             return self.templateEnv.get_template('centos.2stage.dhcp.conf')
         else:
             return self.templateEnv.get_template('centos.1stage.dhcp.conf')
     elif util.isPlatformWindows():
         ''' 
         this code is for testing only, generated dhcpd.conf would not work on windows  
         '''
         if util.isZtpStaged(self.__conf):
             return self.templateEnv.get_template('ubuntu.2stage.dhcp.conf')
         else:
             return self.templateEnv.get_template('ubuntu.1stage.dhcp.conf')
Ejemplo n.º 17
0
 def do_clear ( self, *args ):
     if util.isPlatformWindows ():
         os.system ( 'cls' )
     else:
         os.system ( 'clear' )
Ejemplo n.º 18
0
 def do_clear(self, *args):
     if util.isPlatformWindows():
         os.system('cls')
     else:
         os.system('clear')