def get_saved_policy(table='filter', chain=None, conf_file=None, family='ipv4'):
 if (not chain):
  return 'Error: Chain needs to be specified'
 rules = _parse_conf(conf_file, family=family)
 try:
  return rules[table][chain]['policy']
 except KeyError:
  return None

def get_saved_policy ( table = 'filter' , chain = None , conf_file = None , family = 'ipv4' ) : if ( not chain ) : return 'Error: Chain needs to be specified' rules = _parse_conf ( conf_file , family = family ) try : return rules [ table ] [ chain ] [ 'policy' ] except KeyError : return None
return the current policy for the specified table/chain cli examples: .