[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [oonib/master] Skip policy check if not specified
commit bdacf8d6bd390ba9b1386d2c7c735ee28a14861b
Author: aagbsn <aagbsn@xxxxxxxx>
Date: Thu Sep 12 15:00:42 2013 +0200
Skip policy check if not specified
---
oonib/policy/handlers.py | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/oonib/policy/handlers.py b/oonib/policy/handlers.py
index 9b92403..abce0b3 100644
--- a/oonib/policy/handlers.py
+++ b/oonib/policy/handlers.py
@@ -13,11 +13,16 @@ class Policy(object):
def __init__(self):
with open(config.main.policy_file) as f:
p = yaml.safe_load(f)
- self.nettest = list(p['nettest'])
- self.input = list(p['input'])
+ self.input = self.nettest = []
+ if 'nettest' in p.keys():
+ self.nettest = list(p['nettest'])
+ if 'input' in p.keys():
+ self.input = list(p['input'])
def validateInputHash(self, input_hash):
valid = False
+ if not self.input:
+ valid = True
for i in self.input:
if input_hash == i['id']:
valid = True
@@ -28,6 +33,8 @@ class Policy(object):
def validateNettest(self, nettest_name):
# XXX add support for version checking too.
valid = False
+ if self.nettest:
+ valid = True
for nt in self.nettest:
if nettest_name == nt['name']:
valid = True
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits