Logo Search packages:      
Sourcecode: ufw version File versions

def src::frontend::UFWFrontend::do_action (   self,
  action,
  rule,
  ip_version 
)

Perform action on rule. action, rule and ip_version are usually
   based on return values from parse_command().

Definition at line 384 of file frontend.py.

00384                                                  :
        '''Perform action on rule. action, rule and ip_version are usually
           based on return values from parse_command().
        '''
        res = ""
        if action == "logging-on":
            res = self.set_loglevel("on")
        elif action == "logging-off":
            res = self.set_loglevel("off")
        elif action == "default-allow":
            res = self.set_default_policy("allow")
        elif action == "default-deny":
            res = self.set_default_policy("deny")
        elif action == "status":
            res = self.get_status()
        elif action == "enable":
            res = self.set_enabled(True)
        elif action == "disable":
            res = self.set_enabled(False)
        elif action == "allow" or action == "deny" or action == "limit":
            res = self.set_rule(rule, ip_version)
        else:
            err_msg = _("Unsupported action '%s'") % (action)
            raise UFWError(err_msg)

        return res



Generated by  Doxygen 1.6.0   Back to index