def plugin(act): if len(act) > 0: if (act[0] == "load"): if (len(act) > 1): return plug.loadPlugin(act[1]) else: return "What to load?" elif (act[0] == "unload"): if (len(act) > 1): return plug.unloadPlugin(act[1]) else: return "What to unload?" elif (act[0] == "rload"): if (len(act) > 1): plug.reloadPlugin(act[1]) return "Done!" else: return "What to reload?" elif (act[0] == "list"): #send = ", ".join(plug.loadedPlugins) send = pluglist() return send else: return "Unkown Command!" return "Use %splugin <load [name], unload [name], rload [name], list>" % cor.conf['aprefix']
def main(argv): plugin_results = dict() # Add our folder to the system path sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) parser = argparse.ArgumentParser(description='Report on AWS costs by team') parser.add_argument('-d','--debug', help='Enable debug output',action='store_true') parser.add_argument('-c','--config', help='Full path to a config file',required=True) parser.add_argument('-t','--team', help='Team name to generate the repot for',required=True) args = parser.parse_args() configMap = readConfigFile(args.config) if configMap: # Invoke each of the plugins and store the results for config_plugin in configMap['plugins']: plugin_name = config_plugin['name'] print "Loading plugin %s" % plugin_name # Load the plugin from the plugins folder plugin_handle = plugin.loadPlugin(plugin_name) # Store the plugin output in a dict plugin_results[plugin_name] = plugin_handle.getTeamCost(args.team,configMap,args.debug) # Output the results for the run of each plugin output.outputResults(args.team,configMap,plugin_results,args.debug)
def parseConf(path): global config, conf config = ConfigParser.RawConfigParser() config.read(path) conf['me'] = config.get('bot','nick') conf['nspassword'] = config.get('nickserv','password') conf['password'] = config.get('bot','password') conf['admins'] = config.get('bot','admins').split(', ') conf['server'] = config.get('bot','server') conf['port'] = int(config.get('bot', 'port')) conf['chan'] = config.get('bot', 'channel') plugins = config.get('bot','plugins').split(',') for x in plugins: plug.loadPlugin(x.replace(' ','')) conf['prefix'] = config.get('bot','prefix') conf['aprefix'] = config.get('bot','aprefix') if (config.has_option('bot','vhost') == True): conf['vhost'] = config.get('bot','vhost') else: conf['vhost'] = ""
def main(argv): plugin_results = dict() # Add our folder to the system path sys.path.append( os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) parser = argparse.ArgumentParser(description='Report on AWS costs by team') parser.add_argument('-d', '--debug', help='Enable debug output', action='store_true') parser.add_argument('-c', '--config', help='Full path to a config file', required=True) parser.add_argument('-t', '--team', help='Team name to generate the repot for', required=True) args = parser.parse_args() configMap = readConfigFile(args.config) if configMap: # Invoke each of the plugins and store the results for config_plugin in configMap['plugins']: plugin_name = config_plugin['name'] print "Loading plugin %s" % plugin_name # Load the plugin from the plugins folder plugin_handle = plugin.loadPlugin(plugin_name) # Store the plugin output in a dict plugin_results[plugin_name] = plugin_handle.getTeamCost( args.team, configMap, args.debug) # Output the results for the run of each plugin output.outputResults(args.team, configMap, plugin_results, args.debug)