def __init__(self): self.active = [] aulog.info("List of installed plugins:\n") for plugin in plugins.plugins: aulog.info('\t{}{} ({}) Version: {}{}'.format( bcolors.OKGREEN, plugin.DESCRIPTION, plugin.NAME, plugin.VERSION, bcolors.ENDC, )) aulog.info('\n')
def __init__(self): self.active = [] aulog.info("List of installed plugins:\n") for plugin in plugins.plugins: aulog.info( '\t{}{} ({}) Version: {}{}'.format( bcolors.OKGREEN, plugin.DESCRIPTION, plugin.NAME, plugin.VERSION, bcolors.ENDC, ) ) aulog.info('\n')
def start(self, **kwargs): """ Starts all the plugins in order @throw PluginError when a plugin could not be initialized """ # holds status of all plugins we run results = {} # common parameters we pass to all plugins host = kwargs['session'] option = kwargs['options'] kwargs['results'] = results plugin_type = "" phase = self.get_phase(option) aulog.debug("Running {} plugins".format(phase)) # print "Setting term len to zero", status aulog.debug("Setting terminal len to 0") host.sendline("terminal len 0") prompt = kwargs.get('prompt', "#") failed = False retry = 0 while not failed and retry < 3: index = host.expect_exact( [prompt, MORE, INVALID_INPUT, LOGIN_PROMPT_ERR, pexpect.TIMEOUT], timeout=20) if index == 0: break if index == 1: host.sendline('q') if index == 4: failed = True retry += 1 else: return 1 # ??? no clue what to return yet pno = 1 for plugin in plugins.plugin_map[phase]: aulog.info( "++++" * 5 + bcolors.HEADER + " (%d) (%s) Check " % (pno, plugin.DESCRIPTION) + bcolors.ENDC + "++++" * 5) aulog.info("\nStarting => %s...." % plugin.DESCRIPTION) status = plugin.start(**kwargs) return_status = {plugin.NAME: status} results.update(return_status) if status == SUCCESS or status == SYSTEM_RELOADED or status == INSTALL_METHOD_PROCESS_RESTART: aulog.info(bcolors.OKGREEN + "\nPassed => %s\n" % plugin.DESCRIPTION + bcolors.ENDC) elif status == IGNORE: aulog.info(bcolors.WARNING + "\nIgnoring => %s\n" % plugin.DESCRIPTION + bcolors.ENDC) else: if not option.ignore_fail: aulog.error(bcolors.FAIL + "\nFailed => %s\n" % plugin.DESCRIPTION + bcolors.ENDC) else: # TODO(klstanie): There is no reference to ignore error aulog.ignore_error( bcolors.FAIL + "\nFailed => %s\n" % i.DESCRIPTIONe + bcolors.ENDC) self.active.append(plugin) pno += 1 time.sleep(1) if pno == 1: aulog.info( bcolors.HEADER + "++++" * 5 + " Notice " + "++++" * 5 + bcolors.ENDC) aulog.info( bcolors.WARNING + "Didn't find any plugins of type ** %s **" % plugin_type) aulog.info( bcolors.HEADER + "++++" * 5 + " Done " + "++++" * 5 + bcolors.ENDC) return status
def start(self, **kwargs): """ Starts all the plugins in order @throw PluginError when a plugin could not be initialized """ # holds status of all plugins we run results = {} # common parameters we pass to all plugins host = kwargs['session'] option = kwargs['options'] kwargs['results'] = results plugin_type = "" phase = self.get_phase(option) aulog.debug("Running {} plugins".format(phase)) # print "Setting term len to zero", status aulog.debug("Setting terminal len to 0") host.sendline("terminal len 0") prompt = kwargs.get('prompt', "#") failed = False retry = 0 while not failed and retry < 3: index = host.expect_exact([ prompt, MORE, INVALID_INPUT, LOGIN_PROMPT_ERR, pexpect.TIMEOUT ], timeout=20) if index == 0: break if index == 1: host.sendline('q') if index == 4: failed = True retry += 1 else: return 1 # ??? no clue what to return yet pno = 1 for plugin in plugins.plugin_map[phase]: aulog.info("++++" * 5 + bcolors.HEADER + " (%d) (%s) Check " % (pno, plugin.DESCRIPTION) + bcolors.ENDC + "++++" * 5) aulog.info("\nStarting => %s...." % plugin.DESCRIPTION) status = plugin.start(**kwargs) return_status = {plugin.NAME: status} results.update(return_status) if status == SUCCESS or status == SYSTEM_RELOADED or status == INSTALL_METHOD_PROCESS_RESTART: aulog.info(bcolors.OKGREEN + "\nPassed => %s\n" % plugin.DESCRIPTION + bcolors.ENDC) elif status == IGNORE: aulog.info(bcolors.WARNING + "\nIgnoring => %s\n" % plugin.DESCRIPTION + bcolors.ENDC) else: if not option.ignore_fail: aulog.error(bcolors.FAIL + "\nFailed => %s\n" % plugin.DESCRIPTION + bcolors.ENDC) else: # TODO(klstanie): There is no reference to ignore error aulog.ignore_error(bcolors.FAIL + "\nFailed => %s\n" % i.DESCRIPTIONe + bcolors.ENDC) self.active.append(plugin) pno += 1 time.sleep(1) if pno == 1: aulog.info(bcolors.HEADER + "++++" * 5 + " Notice " + "++++" * 5 + bcolors.ENDC) aulog.info(bcolors.WARNING + "Didn't find any plugins of type ** %s **" % plugin_type) aulog.info(bcolors.HEADER + "++++" * 5 + " Done " + "++++" * 5 + bcolors.ENDC) return status