def _save_config(self): config = Config() i = 0 length = len(self.cmd_list) while i < length: name = self.cmd_list[i]['name'] command = self.cmd_list[i]['command'] item = {} item['name'] = name item['command'] = command config.plugin_set(self.__class__.__name__, name, item) config.save() i = i + 1
def _save_config(self): config = Config() i = 0 length = len(self.cmd_list) while i < length: enabled = self.cmd_list[i]['enabled'] name = self.cmd_list[i]['name'] command = self.cmd_list[i]['command'] item = {} item['enabled'] = enabled item['name'] = name item['command'] = command config.plugin_set(self.__class__.__name__, name, item) config.save() i = i + 1
def _save_config(self): config = Config() config.plugin_del_config(self.__class__.__name__) i = 0 for command in [ self.cmd_list[key] for key in sorted(self.cmd_list.keys()) ] : enabled = command['enabled'] name = command['name'] command = command['command'] item = {} item['enabled'] = enabled item['name'] = name item['command'] = command item['position'] = i config.plugin_set(self.__class__.__name__, name, item) i = i + 1 config.save()
def _save_config(self): log_debug("_save_config") config = Config() config.plugin_del_config(self.__class__.__name__) i = 0 for ssh_conf in self.cmd_list : ip = ssh_conf['ip'] user = ssh_conf['user'] port = ssh_conf['port'] last_time = ssh_conf['last_time'] passwd = ssh_conf['passwd'] item = { 'ip': ip, 'user': user, 'port': port, 'last_time': last_time, 'passwd': passwd} ssh_key = user+"@"+ip config.plugin_set(self.__class__.__name__, ssh_key, item) i = i + 1 config.save()
def _save_config(self): config = Config() config.plugin_del_config(self.__class__.__name__) i = 0 for command in [ self.cmd_list[key] for key in sorted(self.cmd_list.keys()) ]: enabled = command['enabled'] regexp = command['regexp'] command = command['command'] item = {} item['enabled'] = enabled item['regexp'] = regexp item['command'] = command item['position'] = i config.plugin_set(self.__class__.__name__, regexp, item) i = i + 1 config.save() self._load_configured_handlers()
class JiraUrlPlugin(plugin.URLHandler): capabilties = ["url_handler"] handler_name = "jira_ticket" config = None plugin_name = "JiraUrlPlugin" def __init__(self): self.config = Config() if self.config.plugin_get_config(self.plugin_name) is None: for key, value in CONFIG_DEFAULTS.iteritems(): self.config.plugin_set(self.plugin_name, key, value) self.config.save() self.match = self.config.plugin_get(self.plugin_name, "match") self.jira_url = self.config.plugin_get(self.plugin_name, "jira_url") def callback(self, url): if not (self.match or self.jira_url): return for item in re.findall(self.match, url): return("%s/%s" % (self.jira_url, item))