Updates for PEP8.
This commit is contained in:
parent
396501a0f4
commit
0afaac6633
25
varnish.py
25
varnish.py
|
@ -1,4 +1,5 @@
|
|||
#!/usr/bin/python
|
||||
"""Script to create a ACL file for inclusion within Varnish."""
|
||||
|
||||
import blocklist
|
||||
import sys
|
||||
|
@ -6,18 +7,22 @@ import sys
|
|||
class VarnishBlockList(blocklist.BlockList):
|
||||
"""New class to extend the main BlockList class for implementation with Varnish."""
|
||||
def export(self):
|
||||
"""Exports blocklist addresses for use within Varnish."""
|
||||
print "acl block_list {"
|
||||
for address in self.data.keys():
|
||||
print "\t\"%s\";" % address
|
||||
print "}"
|
||||
"""Exports blocklist addresses for use within Varnish."""
|
||||
print "acl block_list {"
|
||||
for address in self.data.keys():
|
||||
print "\t\"%s\";" % address
|
||||
print "}"
|
||||
|
||||
if __name__ == "__main__":
|
||||
blocklist = VarnishBlockList()
|
||||
def main():
|
||||
"""Main program loop."""
|
||||
block_list = VarnishBlockList()
|
||||
|
||||
blocklist.read("http://server1.example.com/default/blocks.txt")
|
||||
blocklist.read("http://server2.example.com/default/blocks.txt")
|
||||
block_list.read("http://server1.example.com/default/blocks.txt")
|
||||
block_list.read("http://server2.example.com/default/blocks.txt")
|
||||
|
||||
blocklist.export()
|
||||
block_list.export()
|
||||
|
||||
sys.exit(0)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
Loading…
Reference in a new issue