Fix bugs found in testing

This commit is contained in:
Giulio 2021-06-25 02:05:54 +02:00
parent 0256ec981d
commit 0b476df8b5
2 changed files with 6 additions and 6 deletions

View File

@ -74,7 +74,7 @@ class Action(RuleChoice):
return 'action=' + str(self) return 'action=' + str(self)
class ForwardType(RuleOption): class ForwardType(RuleChoice):
external = 'external' external = 'external'
internal = 'internal' internal = 'internal'

View File

@ -148,8 +148,8 @@ def rules_list_table(vm):
:param vm: VM object :param vm: VM object
:return: None :return: None
''' '''
header = ['NO', 'ACTION', 'FORWARD TYPE', 'HOST', 'PROTOCOL', 'SRCPORT', 'PORT(S)', header = ['NO', 'ACTION', 'FORWARD TYPE', 'HOST', 'PROTOCOL', 'SRCPORT(s)',
'SPECIAL TARGET', 'ICMP TYPE', 'EXPIRE', 'COMMENT'] 'PORT(S)', 'SPECIAL TARGET', 'ICMP TYPE', 'EXPIRE', 'COMMENT']
rows = [] rows = []
for (rule, rule_no) in zip(vm.firewall.rules, itertools.count()): for (rule, rule_no) in zip(vm.firewall.rules, itertools.count()):
row = [x.pretty_value if x is not None else '-' for x in [ row = [x.pretty_value if x is not None else '-' for x in [
@ -157,12 +157,12 @@ def rules_list_table(vm):
rule.forwardtype, rule.forwardtype,
rule.dsthost, rule.dsthost,
rule.proto, rule.proto,
rule.dstports,
rule.srcports, rule.srcports,
rule.dstports,
rule.specialtarget, rule.specialtarget,
rule.icmptype, rule.icmptype,
rule.expire, rule.expire,
rule.comment, rule.comment
]] ]]
rows.append([str(rule_no)] + row) rows.append([str(rule_no)] + row)
qubesadmin.tools.print_table([header] + rows) qubesadmin.tools.print_table([header] + rows)
@ -216,7 +216,7 @@ def main(args=None, app=None):
rules_list_table(vm) rules_list_table(vm)
if args.reload: if args.reload:
vm.firewall.reload() vm.firewall.reload()
except qubesadmin.exc.QubesException as e:"" except qubesadmin.exc.QubesException as e:
parser.print_error(str(e)) parser.print_error(str(e))
return 1 return 1
return 0 return 0