def proc_sympa_remove(request): """Execute the request for removing a sympa mailing list. @type request: ?? @param request: A dict-like object containing all the parameters for sympa list removal. """ try: state = pickle.loads(str(request["state_data"])) except: logger.exception("Corrupt request state for sympa request %s: %s", request["request_id"], request["state_data"]) return True try: listname = state["listname"] host = state["run_host"] except KeyError: logger.error("No listname/runhost specified for request %s", request["request_id"]) return True cmd = [cereconf.SYMPA_SCRIPT, host, 'rmlist', listname] return spawn_and_log_output(cmd) == EXIT_SUCCESS
def proc_sympa_create(request): """Execute the request for creating a sympa mailing list. @type request: ?? @param request: An object describing the sympa list creation request. """ try: listname = get_address(request["entity_id"]) except Errors.NotFoundError: logger.info("Sympa list address %s is deleted! No need to create", listname) return True try: state = json.loads(request["state_data"]) except ValueError: state = None # Remove this when there's no chance of pickled data if state is None: try: state = pickle.loads(request["state_data"]) except Exception: pass if state is None: logger.error("Cannot parse request state for sympa list=%s: %s", listname, request["state_data"]) return True try: host = state["runhost"] profile = state["profile"] description = state["description"] admins = state["admins"] admins = ",".join(admins) except KeyError: logger.error("No host/profile/description specified for sympa list %s", listname) return True # 2008-08-01 IVR FIXME: Safe quote everything fished out from state. cmd = [ cereconf.SYMPA_SCRIPT, host, 'newlist', listname, admins, profile, description ] return spawn_and_log_output(cmd) == EXIT_SUCCESS
def proc_sympa_create(request): """Execute the request for creating a sympa mailing list. @type request: ?? @param request: An object describing the sympa list creation request. """ try: listname = get_address(request["entity_id"]) except Errors.NotFoundError: logger.info("Sympa list address %s is deleted! No need to create", listname) return True try: state = json.loads(request["state_data"]) except ValueError: state = None # Remove this when there's no chance of pickled data if state is None: try: state = pickle.loads(request["state_data"]) except Exception: pass if state is None: logger.error("Cannot parse request state for sympa list=%s: %s", listname, request["state_data"]) return True try: host = state["runhost"] profile = state["profile"] description = state["description"] admins = state["admins"] admins = ",".join(admins) except KeyError: logger.error("No host/profile/description specified for sympa list %s", listname) return True # 2008-08-01 IVR FIXME: Safe quote everything fished out from state. cmd = [cereconf.SYMPA_SCRIPT, host, 'newlist', listname, admins, profile, description] return spawn_and_log_output(cmd) == EXIT_SUCCESS
def proc_sympa_remove(request): """Execute the request for removing a sympa mailing list. @type request: ?? @param request: A dict-like object containing all the parameters for sympa list removal. """ try: state = json.loads(request["state_data"]) except ValueError: state = None # Remove this when there's no chance of pickled data if state is None: try: state = pickle.loads(request["state_data"]) except Exception: pass if state is None: logger.error("Cannot parse request state for sympa request %s: %s", request["request_id"], request["state_data"]) return True try: listname = state["listname"] host = state["run_host"] except KeyError: logger.error("No listname/runhost specified for request %s", request["request_id"]) return True cmd = [cereconf.SYMPA_SCRIPT, host, 'rmlist', listname] return spawn_and_log_output(cmd) == EXIT_SUCCESS