def r(self, retcode, msg, log_level): ''' record Session command input/output to 'commands' table, and logging message facility ''' l(self.line, retcode, msg, log_level) Sessions.Instance().insert_table_commands( self.line, # @UndefinedVariable msg, retcode, log_level)
def main(): # check '~/.pyraxshell' and config files exist, create them if missing if not check_dir_home(): print("This is the first time 'pyraxshell' runs, please, configure " "'%s' according to your needs" % CONFIG_FILE) #create db DB() Sessions.Instance().create_table_sessions() # @UndefinedVariable Sessions.Instance().create_table_commands() # @UndefinedVariable # create default configuration file Configuration.Instance() # @UndefinedVariable sys.exit(0) # ######################################## # VERSION CHECK if not version.check_version_file(): sys.exit(1) # ######################################## # LOGGING start_logging() logging.debug('starting') # from baseconfigfile import BaseConfigFile # bcf = BaseConfigFile() # ######################################## # ACCOUNTS accounts = Account.Instance() # @UnusedVariable @UndefinedVariable # config file is read by 'BaseConfigFile' constructor # ######################################## # CONFIGURATION cfg = Configuration.Instance() # @UndefinedVariable # override settings with CLI params cfg.parse_cli(sys.argv) logging.debug("configuration: %s" % cfg) # set user's log level if specified if not Configuration.Instance().log_level == None: # @UndefinedVariable l = logging.getLogger() for h in l.handlers: h.setLevel(cfg.log_level) # ######################################## # START SESSION Sessions.Instance().start_session() # @UndefinedVariable # Sessions.Instance().insert_table_commands('IN', 'OUT') # @UndefinedVariable # ######################################## # DO STUFF # handle configuration if cfg.pyrax_http_debug == True: pyrax.set_http_debug(True) if cfg.pyrax_no_verify_ssl == True: # see: https://github.com/rackspace/pyrax/issues/187 pyrax.set_setting("verify_ssl", False) # start notifier Notifier().start() # main loop Cmd_Pyraxshell().cmdloop()