Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return '\n'.join(target)
class Error(Exception):
"""Base error class."""
class BadPortsError(Error):
"""Too many ports for a single iptables statement."""
class UnsupportedFilterError(Error):
"""Raised when we see an inappropriate filter."""
class NoIptablesPolicyError(Error):
"""Raised when a policy is received that doesn't support iptables."""
class TcpEstablishedError(Error):
"""Raised when a term has tcp-established option but not proto tcp only."""
class EstablishedError(Error):
"""Raised when a term has established option with inappropriate protocol."""
class UnsupportedDefaultActionError(Error):
"""Raised when a filter has an impermissible default action specified."""
class UnsupportedTargetOptionError(Error):
"""Too many ports for a single iptables statement."""
class UnsupportedFilterError(Error):
"""Raised when we see an inappropriate filter."""
class NoIptablesPolicyError(Error):
"""Raised when a policy is received that doesn't support iptables."""
class TcpEstablishedError(Error):
"""Raised when a term has tcp-established option but not proto tcp only."""
class EstablishedError(Error):
"""Raised when a term has established option with inappropriate protocol."""
class UnsupportedDefaultActionError(Error):
"""Raised when a filter has an impermissible default action specified."""
class UnsupportedTargetOptionError(Error):
"""Raised when a filter has an impermissible default action specified."""
class LimitButNoLogError(Error):
"""Raised when log-limit is used by logging is not."""
"""Raised when a policy is received that doesn't support iptables."""
class TcpEstablishedError(Error):
"""Raised when a term has tcp-established option but not proto tcp only."""
class EstablishedError(Error):
"""Raised when a term has established option with inappropriate protocol."""
class UnsupportedDefaultAction(Error):
"""Raised when a filter has an impermissible default action specified."""
class UnsupportedTargetOption(Error):
"""Raised when a filter has an impermissible default action specified."""
class LimitButNoLogError(Error):
"""Raised when log-limit is used by logging is not."""
input_file, write_files)
if nft:
acl_obj = nftables.Nftables(nft, exp_info)
RenderACL(str(acl_obj), acl_obj.SUFFIX, output_directory,
input_file, write_files)
if gcefw:
acl_obj = gce.GCE(gcefw, exp_info)
RenderACL(str(acl_obj), acl_obj.SUFFIX, output_directory,
input_file, write_files)
if paloalto:
acl_obj = paloaltofw.PaloAltoFW(paloalto, exp_info)
RenderACL(str(acl_obj), acl_obj.SUFFIX, output_directory,
input_file, write_files)
# TODO(robankeny) add additional errors.
except (juniper.Error, junipersrx.Error, cisco.Error, ipset.Error,
iptables.Error, speedway.Error, pcap.Error,
aclgenerator.Error, aruba.Error, nftables.Error, gce.Error) as e:
raise ACLGeneratorError(
'Error generating target ACL for %s:\n%s' % (input_file, e))
"""Base error class."""
class BadPortsError(Error):
"""Too many ports for a single iptables statement."""
class UnsupportedFilterError(Error):
"""Raised when we see an inappropriate filter."""
class NoIptablesPolicyError(Error):
"""Raised when a policy is received that doesn't support iptables."""
class TcpEstablishedError(Error):
"""Raised when a term has tcp-established option but not proto tcp only."""
class EstablishedError(Error):
"""Raised when a term has established option with inappropriate protocol."""
class UnsupportedDefaultAction(Error):
"""Raised when a filter has an impermissible default action specified."""
class UnsupportedTargetOption(Error):
"""Raised when a filter has an impermissible default action specified."""
class LimitButNoLogError(Error):
"""Raised when log-limit is used by logging is not."""
"""Raised when we see an inappropriate filter."""
class NoIptablesPolicyError(Error):
"""Raised when a policy is received that doesn't support iptables."""
class TcpEstablishedError(Error):
"""Raised when a term has tcp-established option but not proto tcp only."""
class EstablishedError(Error):
"""Raised when a term has established option with inappropriate protocol."""
class UnsupportedDefaultAction(Error):
"""Raised when a filter has an impermissible default action specified."""
class UnsupportedTargetOption(Error):
"""Raised when a filter has an impermissible default action specified."""
class LimitButNoLogError(Error):
"""Raised when log-limit is used by logging is not."""
"""Base error class."""
class BadPortsError(Error):
"""Too many ports for a single iptables statement."""
class UnsupportedFilterError(Error):
"""Raised when we see an inappropriate filter."""
class NoIptablesPolicyError(Error):
"""Raised when a policy is received that doesn't support iptables."""
class TcpEstablishedError(Error):
"""Raised when a term has tcp-established option but not proto tcp only."""
class EstablishedError(Error):
"""Raised when a term has established option with inappropriate protocol."""
class UnsupportedDefaultActionError(Error):
"""Raised when a filter has an impermissible default action specified."""
class UnsupportedTargetOptionError(Error):
"""Raised when a filter has an impermissible default action specified."""
class LimitButNoLogError(Error):
class TcpEstablishedError(Error):
"""Raised when a term has tcp-established option but not proto tcp only."""
class EstablishedError(Error):
"""Raised when a term has established option with inappropriate protocol."""
class UnsupportedDefaultAction(Error):
"""Raised when a filter has an impermissible default action specified."""
class UnsupportedTargetOption(Error):
"""Raised when a filter has an impermissible default action specified."""
class LimitButNoLogError(Error):
"""Raised when log-limit is used by logging is not."""
term_str = str(term)
if term_str:
target.append(term_str)
if self._RENDER_SUFFIX:
target.append(self._RENDER_SUFFIX)
target.append('')
return '\n'.join(target)
class Error(Exception):
"""Base error class."""
class BadPortsError(Error):
"""Too many ports for a single iptables statement."""
class UnsupportedFilterError(Error):
"""Raised when we see an inappropriate filter."""
class NoIptablesPolicyError(Error):
"""Raised when a policy is received that doesn't support iptables."""
class TcpEstablishedError(Error):
"""Raised when a term has tcp-established option but not proto tcp only."""
class EstablishedError(Error):
term_str = str(term)
if term_str:
target.append(term_str)
if self._RENDER_SUFFIX:
target.append(self._RENDER_SUFFIX)
target.append('')
return '\n'.join(target)
class Error(Exception):
"""Base error class."""
class BadPortsError(Error):
"""Too many ports for a single iptables statement."""
class UnsupportedFilterError(Error):
"""Raised when we see an inappropriate filter."""
class NoIptablesPolicyError(Error):
"""Raised when a policy is received that doesn't support iptables."""
class TcpEstablishedError(Error):
"""Raised when a term has tcp-established option but not proto tcp only."""
class EstablishedError(Error):