tools: remove policy handling from qvm-firewall tool
Follow the API removal QubesOS/qubes-issues#2869
This commit is contained in:
parent
942e122d27
commit
627aebf2cd
@ -2,7 +2,7 @@
|
||||
#
|
||||
# The Qubes OS Project, http://www.qubes-os.org
|
||||
#
|
||||
# Copyright (C) 2016 Marek Marczykowski-Górecki
|
||||
# Copyright (C) 2016 Marek Marczykowski-Górecki
|
||||
# <marmarek@invisiblethingslab.com>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
@ -195,24 +195,3 @@ class TC_10_qvm_firewall(qubesadmin.tests.QubesTestCase):
|
||||
['test-vm', 'del', 'drop', 'proto=icmp'],
|
||||
app=self.app
|
||||
)
|
||||
|
||||
def test_030_policy_get(self):
|
||||
self.app.expected_calls[('test-vm', 'admin.vm.firewall.GetPolicy',
|
||||
None, None)] = b'0\0accept'
|
||||
with qubesadmin.tests.tools.StdoutBuffer() as stdout:
|
||||
qubesadmin.tools.qvm_firewall.main(
|
||||
['test-vm', 'policy'],
|
||||
app=self.app
|
||||
)
|
||||
self.assertEqual(stdout.getvalue(), 'accept\n')
|
||||
|
||||
def test_031_policy_set(self):
|
||||
self.app.expected_calls[('test-vm', 'admin.vm.firewall.SetPolicy',
|
||||
None, b'accept')] = b'0\0'
|
||||
with qubesadmin.tests.tools.StdoutBuffer() as stdout:
|
||||
qubesadmin.tools.qvm_firewall.main(
|
||||
['test-vm', 'policy', 'accept'],
|
||||
app=self.app
|
||||
)
|
||||
self.assertEqual(stdout.getvalue(), '')
|
||||
|
||||
|
@ -86,11 +86,6 @@ action_del.add_argument('rule', nargs='*', action=RuleAction,
|
||||
|
||||
action_list = action.add_parser('list', help='list rules')
|
||||
|
||||
action_policy = action.add_parser('policy',
|
||||
help='get/set policy - default action')
|
||||
action_policy.add_argument('policy', choices=['accept', 'drop'],
|
||||
help='policy value', default=None, nargs='?')
|
||||
|
||||
parser.add_argument('--reload', '-r', action='store_true',
|
||||
help='force reloading rules even when unchanged')
|
||||
|
||||
@ -150,14 +145,6 @@ def rules_del(vm, args):
|
||||
vm.firewall.save_rules()
|
||||
|
||||
|
||||
def policy(vm, args):
|
||||
'''Get/Set default action (policy)'''
|
||||
if args.policy is not None:
|
||||
vm.firewall.policy = args.policy
|
||||
else:
|
||||
print(vm.firewall.policy)
|
||||
|
||||
|
||||
def main(args=None, app=None):
|
||||
'''Main routine of :program:`qvm-firewall`.'''
|
||||
try:
|
||||
@ -167,8 +154,6 @@ def main(args=None, app=None):
|
||||
rules_add(vm, args)
|
||||
elif args.command == 'del':
|
||||
rules_del(vm, args)
|
||||
elif args.command == 'policy':
|
||||
policy(vm, args)
|
||||
elif args.command == 'list':
|
||||
if args.raw:
|
||||
rules_list_raw(vm)
|
||||
|
Loading…
Reference in New Issue
Block a user